09-22-2013 6:09 PM
Hi Gurus,
I have a requirement of calculating the GR date automatically and updating it when ME21N/ME22N is triggered.
I am using the code below in the BADI ME_PROCESS_PO_CUST~PROCESS_ITEM.
Validation for document types is done.
* Geting the Header details
im_header = im_item->get_header( ).
* Getting the Items from the Header
lt_items = im_header->get_items( ).
LOOP AT lt_items
INTO lwa_items .
* Get PO item data
lwa_item = lwa_items-item->get_data( ).
The value 60 is fetched from a custom table.
lv_date = lwa_item-eeind + 60 .
IF lwa_item-lewed IS INITIAL
lwa_item-lewed = lv_date .
ELSEIF lwa_item-lewed <> lv_date .
MESSAGE 'Change the GR Date!!' TYPE ’E’.
ENDIF.
CALL METHOD lwa_items-item->set_data( lwa_item ).
ENDLOOP .
ENDIF.
For a change in delivery date i have to compare the calculated GR date value with the GR date that was available initially.
Can you please suggest if there are any structures to get the value of the GR date that was stored initially in Ekpo table.
The tables TEKPO BEKPO etc are not getting populated in this BADI.
Thanks,
Prema
09-23-2013 5:51 AM
Hello Prema ,
For this purpose better use Customer Exit MM06E005.
There are two internal tables available for EKPO , YEKPO ( Containing old values ) and XEKPO ( Containing new values ).
09-23-2013 5:51 AM
Hello Prema ,
For this purpose better use Customer Exit MM06E005.
There are two internal tables available for EKPO , YEKPO ( Containing old values ) and XEKPO ( Containing new values ).
09-26-2013 7:49 AM
Hello,
Thank you for the reply..
I have sorted it out by creating an internal table for EKPO where data is already available..
I have another issue of ME21N-Save is not getting triggered where as me22n N 23N is working fine..
Can you help??
Regards,
Prema
09-23-2013 7:13 AM
There are methods similar to get_data in this BAdI :
So the answer is GET_PERSISTENT_DATA
But you are writing your code in IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM, and there you process every item each time an item is changed . Why not use IF_EX_ME_PROCESS_PO_CUST~OPEN for already existing items, and then only update the current item in IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM ?
Also don't use a wild (or old-fashioned) MESSAGE statement, but use the available macros as described in BAdI documentation :
mmpur_metafield mmmfd_latest_gr. " Look at TYPE-POOLS MMMFD for a list of metafield
mmpur_message_forced 'E' 'ZXXXX' '123' lwa_item-lewed lv_date space space.
Regards,
Raymond
09-26-2013 7:48 AM
Hello,
Thank you for the reply..
I have sorted it out by creating an internal table for EKPO where data is already available..
I have another issue of ME21N-Save is not getting triggered where as me22n N 23N is working fine..
Can you help??
Regards,
Prema