By Shilpa Bansal, Infosys

We create an implementation of BADI ME_PROCESS_PO_CUST to UPDATE/overwrite Functional area in a Purchase Order.

The functional area is required to create a profit and loss account in Financial Accounting using cost-of-sales accounting. The data element for this field is FKBER. The functional area field has a special position in the master data for P&L accounts and cost elements.

Deriving the functional area when posting

The following cases are possible when posting and can affect how the functional area is derived:

1) You post to a G/L account for which no cost element exists - The system derives the functional area based on the G/L account

2) You post to a G/L account for which a cost element exists (primary cost element)- The system derives the functional area based on the G/L account .

3) In Controlling, you post to a cost element for which no G/L account exists (secondary cost element)-The system derives the functional area based on the cost element.

Current scenario: When we create/change PO information, functional area is updated on the basis of G/L account . We can view this through the transaction FS00.

Required scenario: When we create or change PO, functional area should be updated on the basis of cost center entered by user. The BADI should overwrite the functional area fetched on basis of G/L account with the value fetched on basis of cost center and controlling area.

To do this, we write the following code in the implementation of BADI ME_PROCESS_PO_CUST, Method ‘PROCESS_ITEM’

Step 1) Goto Se19 . Enter BADI name ‘ME_PROCESS_PO_CUST’. Click on Create implementation button.


2) Enter the implementation name as ZIMP_PO_CUST and press enter.

On the next screen enter implementation short text and click on save. Save as local object. An information message is displayed ‘Implementation ZIMP_PO_CUST will be migrated’. Press enter.

3) In the following screen click on create button and enter the name of enhancement implementation. It can be different than BADI implementation name. Press enter and save as local object and activate it.

Enhancement Implementations already created for this BADI would be shown in the below screen.

4) Now we get the following screen:

5) As per our requirement we code the logic in method PROCESS_ITEM. For this, double click the method and write down the code.

However, simply with this code when we run ME21N/ME22N, we get following error:

As per the message description, we check if field FKBER exists in any of the structure MEPOITEM_TECH or MEPOSCHEDULE_TECH. Since it does not exist, the BADI should be able to modify it. The reason for error is the control enters into an infinite loop because of the statement:

The solution to this error is inserting the following piece of code after the above mentioned statement :

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image