04-06-2011 4:04 PM
Hi friends,
I have a requirement where I need to do GR for a given PO from NON-SAP system.
Which I have done using basic IDOC type WMMBID02, message type - WMMBXY, process code - WMMB.
It is working perfectly.
Issue is - sometimes these GR will be done at SAP system. Such cases the IDOC should check whether the GR is already done or not, IF it exists then it should not process the IDOC.
I have checked all the fields I could not see anything that will check for GR status.
Please kindly help me resolve this issue.
Thanks,
Santo.
04-07-2011 10:23 AM
Hi Santo,
while posting within SAP, you need to query table EKBE to check whether PO is GRed.
Below is the code.
SELECT * FROM EKBE INTO TABLE LT_EKBE WHERE
EBELN = P_EBELN
AND VGABE = '1'. " GR
IF LT_EKBE[] IS INITIAL. " PO not yet GR'd
PERFORM POST_GR USING P_EBELN. " Use BAPI_GOODSMVT_CREATE to post GR
REFRESH: LT_EKBE.
ENDIF.
There can be partial postings, Deleted items(LOEKZ in EKPO) as well. These should be handled in your code.
Hope this helps.
Thanks,
Prathap