Skip to Content
0

BADI ME_PROCESS_PO_CUST METHOD CHECK

Apr 18, 2017 at 06:36 PM

662

avatar image

I am trying to put in some logic based on a user making quantity changes in ME22N. I know I can see the change in method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM of my implementation by using GET_PREVIOUS_DATA. I am trying to see the same change in method IF_EX_ME_PROCESS_PO_CUST~CHECK of my implementation. Here is my code, can anyone tell me if I am missing something?

INCLUDE MM_MESSAGES_MAC .
DATA: V_PO_HDR TYPE MEPOHEADER,
I_ZBGR TYPE TABLE OF ZBGR,
V_ZBGR TYPE ZBGR,
V_DIFF TYPE I,
V_ITM_DATA TYPE PURCHASE_ORDER_ITEMS,
V_ITEM_DATA TYPE PURCHASE_ORDER_ITEM,
V_ITEM TYPE MEPOITEM,
V_ITM TYPE MEPOITEM.

V_PO_HDR = IM_HEADER->GET_DATA( ).
IF V_PO_HDR-RESWK = 'FKP' AND ( V_PO_HDR-BSART <> 'NB' AND V_PO_HDR-BSART <> 'Z001' ).
SELECT * FROM ZBGR INTO CORRESPONDING FIELDS OF TABLE I_ZBGR WHERE VBELN = V_PO_HDR-EBELN.
V_ITM_DATA = IM_HEADER->GET_ITEMS( ).
LOOP AT V_ITM_DATA INTO V_ITEM_DATA.
V_ITEM_DATA-ITEM->GET_PREVIOUS_DATA( IMPORTING EX_DATA = V_ITM
EXCEPTIONS NO_DATA = 1 ).
IF NOT V_ITM IS INITIAL.
V_ITEM = V_ITEM_DATA-ITEM->GET_DATA( ).
IF V_ITM-MENGE <> V_ITEM-MENGE.
READ TABLE I_ZBGR INTO V_ZBGR WITH KEY VBELN = V_ITEM-EBELN POSNR = V_ITEM-EBELP.
IF SY-SUBRC = 0.
CH_FAILED = 'X'.
V_DIFF = V_ITEM-MENGE - V_ITM-MENGE.
MMPUR_MESSAGE_FORCED 'E' '06' '078' V_DIFF '' '' ''.
ENDIF.
ENDIF.
ENDIF.
CLEAR: V_ITEM_DATA, V_ITM, V_ZBGR, V_DIFF.
ENDLOOP.
ENDIF.
CLEAR V_PO_HDR.
REFRESH: I_ZBGR, V_ITM_DATA.

Thanks,

Lee

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Nic Teunckens Apr 18, 2017 at 09:21 PM
0

You might want to replace the Method :

"Method description : Get Item Data Prior to Validation
V_ITEM_DATA-ITEM->GET_PREVIOUS_DATA( 
   IMPORTING  EX_DATA = V_ITM
   EXCEPTIONS NO_DATA = 1 ).

... by Method :

"Method description : Get Posted Item Data
V_ITEM_DATA-ITEM->GET_PERSISTENT_DATA(
   IMPORTING  EX_DATA = V_ITM
   EXCEPTIONS NO_DATA = 1 ).

See if that works ...

PS : By using the 'CODE' Button in your post you can insert the Sample-code much nicer / more readable ...

Kind regards

Nic T.

Share
10 |10000 characters needed characters left characters exceeded