Booking in Inbound Delivery using BAPI

Question:
I am using BAPI_GOODSMVT_CREATE to GR Inbound Deliveries. This is working very well and has done for a few weeks.
Last night one delivery failed to process correctly (out of the 20 deliveries received). I got message M7 264 which refers to missing quantity or delivery completed indicator for each line of the delivery (having tested this manually via SE37 this morning).
Has anyone got a clue why this might be happening - and how it could have only happened to one delivery out of many? (deliveries were successfully GR'd both before and after this delivery - including some which had materials in common).
Very confused
_________________
Kind Regards
Rosie Brent
Please remember to search the forum and check the FAQ before posting questions, thank you.
Tuly Idiot most of the time, part-time Guru
Answer:
bump - any ideas, please?
_________________
Kind Regards
Rosie Brent
Please remember to search the forum and check the FAQ before posting questions, thank you.
Tuly Idiot most of the time, part-time Guru
Answer:
I am using BAPI_GOODSMVT_CREATE to GR Inbound Deliveries. This is working very well and has done for a few weeks.
Please, could anyone show me the example of using BAPI_GOODSMVT_CREATE with Inbound Delivery, I can't find the actual parameters for it. When I insert PO number in the corresponding field - everything OK, but when I try to use the field DELIV_NUMB_TO_SEARCH and leave po number blank - error occurs: "No entry found/selected for search criteria".
I have only delivery number for creating GR.
Thank you in advance.
Answer:
This is the code that I am using:
  LOOP AT DELIVERY.
*   Populate BAPI variables ready for call
    GOODSMVT_HEADER-PSTNG_DATE = SY-DATLO.
    GOODSMVT_HEADER-DOC_DATE = SY-DATLO.
    GOODSMVT_HEADER-BILL_OF_LADING = DELIVERY-LIFEX.
    GOODSMVT_HEADER-REF_DOC_NO = DELIVERY-LIFEX.
    GOODSMVT_HEADER-PR_UNAME = SY-UNAME.
    GOODSMVT_HEADER-HEADER_TXT = 'Auto GR of I/Bound Del'.
    GOODSMVT_CODE-GM_CODE = CON_MOVE_CODE.
    GOODSMVT_ITEM-MATERIAL = DELIVERY-MATNR.
    GOODSMVT_ITEM-PLANT = DELIVERY-WERKS.
    GOODSMVT_ITEM-STGE_LOC = DELIVERY-LGORT.
    GOODSMVT_ITEM-MOVE_TYPE = CON_MOVE_TYPE.
    GOODSMVT_ITEM-VENDOR = DELIVERY-LIFNR.
    GOODSMVT_ITEM-ENTRY_QNT = DELIVERY-LFIMG.
    GOODSMVT_ITEM-ENTRY_UOM = DELIVERY-MEINS.
    GOODSMVT_ITEM-MVT_IND = CON_MOVE_ITEM.
    GOODSMVT_ITEM-DELIV_NUMB_TO_SEARCH = DELIVERY-VBELN.
    GOODSMVT_ITEM-DELIV_ITEM_TO_SEARCH = DELIVERY-POSNR.
    APPEND GOODSMVT_ITEM.
    CLEAR GOODSMVT_ITEM.
  ENDLOOP.
*Call BAPI
  CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
    EXPORTING
      GOODSMVT_HEADER             = GOODSMVT_HEADER
      GOODSMVT_CODE               = GOODSMVT_CODE
*     TESTRUN                     = ' '
    IMPORTING
      GOODSMVT_HEADRET            = GOODSMVT_HEADRET
      MATERIALDOCUMENT            = MATERIALDOCUMENT
      MATDOCUMENTYEAR             = MATDOCUMENTYEAR
    TABLES
      GOODSMVT_ITEM               = GOODSMVT_ITEM
*     GOODSMVT_SERIALNUMBER       =
      RETURN                      = RETURN.
*  Check BAPI RETURN table to ensure call was successful
  LOOP AT RETURN WHERE TYPE = 'E'.
    EXIT.
  ENDLOOP.
  IF SY-SUBRC EQ 0.
    ROLLBACK WORK.
    MESSAGE E999 WITH 'GR BAPI Failed, process delivery manually'.
  ENDIF.
The GM_CODE is 01 and the MVT_IND is B.
Hope this helps.
_________________
Kind Regards
Rosie Brent
Please remember to search the forum and check the FAQ before posting questions, thank you.
Tuly Idiot most of the time, part-time Guru

More Articles:

Purchase Orders IM Material?
Shipment cost processing AND 1-step stock transfer?
bye-prodcts?
Failure of Goods movement Idocs?
price transfer?
overdelivery tolerance in PO?