Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BADI not working

Sijin_Chandran
Active Contributor
0 Kudos

Hello ABAP Experts ,

I am subjected to a  client requirement according to which whenever purchase orders are created with stock transfer document type (ZSTM , ZSTO are the customised types used) , Commitment item field under the ACCOUNT ASSIGNMENT Tab in me21n should be filled with value 'DUMMY'.

So i choose ME_PROCESS_PO_CUST Badi to accomplish this task.

And taking the below conditions i wrote my code :

Whenever Purchase Order type ZSTM or ZSTO is selected Item Category is automatically assigned with value 7 ( its displayed as value U but is saved as value 7 in EKPO)

So whenever EKPO-PSTYP = '7'

                     set EKKN-FIPOS = 'DUMMY'.

My code is as follows which i wrote under METHOD PROCESS_ACCOUNT

method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ACCOUNT.

    DATA: LS_ACCOUNT TYPE MEPOACCOUNTING ,

          LS_ITEM TYPE REF TO IF_PURCHASE_ORDER_ITEM_MM,

          PO_ITEM TYPE MEPOITEM.

   BREAK : SAPABAP.

   LS_ITEM = IM_ACCOUNT->GET_ITEM( ).  "for getting PO line item being processed

   PO_ITEM = LS_ITEM->GET_DATA( ).

   LS_ACCOUNT = IM_ACCOUNT->GET_DATA( ). "for getting PO line item Account Assignment

   IF PO_ITEM-PSTYP eq '7'.

     LS_ACCOUNT-FIPOS = 'DUMMY'.

     CALL METHOD IM_ACCOUNT->SET_DATA( LS_ACCOUNT ).

   ENDIF.

Break point is also not working.

Thanks n Regards ,

Sij


7 REPLIES 7

Puneet_Gupta
Contributor
0 Kudos

Are you using the classic BADi ME_PROCESS_PO_CUST  or have you implemented it from the new Enhancement Spot ME_PROCESS_PO_CUST ?

The classic BADI has been migrated to the new Enhancement Spot ME_PROCESS_PO_CUST.

- Puneet

0 Kudos

Hello Puneet ,

I have implemented using the classic BADI ME_PROCESS_PO_CUST.

I will  try your suggestion and revert you back.

Thanks n Regards ,

Sij.

0 Kudos

Hello Puneet ,

I have checked and found that my implementation is showing in new Enhancement Spot ME_PROCESS_PO_CUST  also.

You can check it out from the below screen shot


0 Kudos

Hi Sijin Chandran,

This BADI ME_PROCESS_PO_CUST is not a multiple use and allows only an implementation.

Please check if exists other implementation active in the system. I suspect that's it.

Regards

Bruno Xavier.

Sijin_Chandran
Active Contributor
0 Kudos

Hello Bruno ,

No this the only implementation in our system. If multiple usage is not allowed in this BADI then how can i create a new one.

Anyway i have managed the solution by implementing the same in Method PROCESS_ITEM.

And its working , whenever the user creates a PO with type ZSTM or ZSTO Commitment Item field gets filled with DUMMY value.

Thank you all for spending your valuable time for helping me to find the solution.

Former Member
0 Kudos

This is because the Classical BAdi has migrated to new BADI... check the implementation of the enhancement spot and it should work for you..

Sijin_Chandran
Active Contributor
0 Kudos

Hello All ,

I got the solution for this problem by writing  code in Method PROCESS_ITEM instead.

Thanks to all for your contributions.