Account determination for GR/IR clearing account (WRX) as per Purchase order document type
As per standard SAP, system determines G/L account as per defined rule for the account determination. Where, we can’t use the option account modifier for some transaction event keys (like BSX, WRX) at the time goods movement (like goods receipt). As we know, account modifier or valuation modifier is an option to use different G/L account within a transaction event key. Although, you can assign a G/L account as per account modifier for the transaction event key WRX or BSX from OBYC, but system will not determine the G/L account as per your settings, system will still determine the G/L account which is assigned for blank account modifier. It is well possible to use the account modifier for some transaction event keys (like GBB, PRD) in standard SAP. But SAP has given an option for customer requirement. You can determine the G/L account by using the account modifier for the transaction key WRX via some user exit. But, it is not possible to use the account modifier for the transaction event key BSX. SAP has written it as hard code for the account modifier as blank for the transaction event key BSX. System reads the function module ‘MR_ACCOUNT_ASSIGNMENT’ for the account determination process. Here is the coding line for the transaction event key BSX:
The value VORGANGSSCHLUESSEL is equal to transaction event key (T030 – KTOSL) and KONTO_MODIF is equal to account modifier (T030 – KOMOK). You can find it also in the same function module:
So, you can’t use any account modifier for the transaction event key BSX. Also as per the business process, it should be. You should not use multiple G/L accounts for one valuation class for the stock account posting. It can create many problems during the balance sheet finalization.
Now, for the transaction key WRX, in standard, system will determine the G/L account without using the account modifier. But system has given an option to write your own coding to call the account modifier as per your defined rule. System is calling the user exit ‘EXIT_SAPLKONT_011’ to read the customer defined rule during the account determination process. Here is the customer call function:
You can see here, system is clearing the KONTO_MODIF and calling the customer function ‘011’, which means ‘EXIT_SAPLKONT_011’. You can double click on the call function to check the user exit name. So if we will define our own rule for the account modifier by coding in this user exit, then we can determine G/L account with regards to the account modifier as per our requirement.
Now let’s explain about the business requirement:
Suppose your company is using two different processes as standard and subcontracting for same material. We know that one material can have only one valuation class (without using split valuation). So, as per the standard SAP, it should get determine the same G/L account for transaction event key WRX for both standard and subcontracting process. But your organization wants it different. They want to use G/L account ZZZZ for the standard purchase order and G/L account YYYY for the subcontracting purchase order for the GR/IR clearing account (WRX).
You need to find the differences between these two PO types. I am going to use different document type for both processes. NB for the standard purchase order and ZSC for the subcontracting purchase order. As result, system will determine the G/L account ZZZZ for standard PO with document type NB and G/L account YYYY for subcontracting PO with document type ZSC. You can make some changes in your document type. Allow only the item category L for ZSC document type (for subcontracting purchase order) and do not allow the item category L for the document type NB (for standard purchase order). So that user can’t do mistake to choose document type for both processes.
Enhancement and Coding:
As explained, we need to use the user exit EXIT_SAPLKONT_011. The user exit includes the program ZXM08U18. Here, you need to take help from your ABAPer. You need to create this include program from SE38 (tell your ABAPer to do the same). Then you need to write the code accordingly:
IF sy-mandt = ‘400’.
SELECT SINGLE * FROM ekko
WHERE ebeln = i_wrxmod+0(10).
IF ekko-bsart = ‘ZSC’.
e_konto_modif = ‘JWK’.
Here, 400 is client, ZSC is document type for subcontracting purchase order and JWK is the account modifier which will be used to determine the G/L account. If you do not want to include the client, then you can remove the line item. Here, I’ve just defined the different account modifier for the subcontracting process, so that system will consider this account modifier (JWK) for the subcontracting process and blank account modifier for the standard process (as defined in standard program code). Activate the include program.
Now go to OBYC and enable the account modifier option from rule (note: before enable, take a backup of the all entries as because, once you change the rule, you will lose the existing entries). Now assign the G/L account as per your requirement:
Save the entry.
Create two purchase orders, one with document type NB and item category blank for standard purchase process, and create another purchase order with document type ZSC and item category L for subcontracting purchase process.
Post the goods receipt for the standard purchase order and check the accounting entry:
You can see the G/L account 150039 has been determined for the standard purchase order. Now post goods receipt for the subcontracting purchase order and check the accounting entry:
Here you can see the G/L account 150196 has been determined for the subcontracting purchase order.
Note: I have given an example by using the document type. If you want to do it differently (like as by using item category or any other which would be different for standard process and subcontracting process), then you can also do it by changing the coding part.