2014 Apr 07 7:27 AM
Hello experts,
When I create a Goods Reciept with reference to Purchase Order using BAPI_GOODSMVT_CREATE, the following error message appears.
No goods receipt possible for purchase order <PO number> <line item number>.
But the GR is getting created manually using Transaction MIGO for the same PO number.
I found some blogs to check for deletion indicator and Movement type and quantity, when I searched SDN for the same Issue.
In my case
1.deletion indicator is not set for the Purchase order line items
2.And Movement type is 101
3.And gm_code is 01.
Could anyone please suggest me, what else could be the reason for this error?
2014 Apr 07 10:07 AM
Here is the code what i have written.
f_gmvt_header-pstng_date = sy-datum.
f_gmvt_header-doc_date = sy-datum.
f_gmvt_header-pr_uname = sy-uname.
f_gmvt_header-ref_doc_no = p_ebeln.
f_goodsmvt_code_tmp = '01'.
* Looping the PO details.
CLEAR: gf_item,f_gmvt_item.
LOOP AT gt_item INTO gf_item.
* fill the bapi item structure details
f_gmvt_item-material = gf_item-material.
f_gmvt_item-plant = gf_sbms-werks.
f_gmvt_item-stge_loc = '0001'.
f_gmvt_item-move_type = '101'.
f_gmvt_item-po_number = p_ebeln.
f_gmvt_item-po_item = gf_item-po_item.
f_gmvt_item-entry_qnt = gf_item-quantity.
f_gmvt_item-entry_uom = 'PC'.
f_gmvt_item-entry_uom_iso = 'PCE'.
f_gmvt_item-po_pr_qnt = gf_item-quantity.
f_gmvt_item-orderpr_un = 'PC'.
f_gmvt_item-orderpr_un_iso = 'PCE'.
f_gmvt_item-no_more_gr = 'X'.
f_gmvt_item-ref_doc = p_ebeln.
f_gmvt_item-prod_date = sy-datum.
f_gmvt_item-mvt_ind = 'B'.
f_gmvt_item-move_reas = '101'.
f_gmvt_item-vendor = gf_lfm1-lifnr.
APPEND f_gmvt_item TO t_gmvt_item.
CLEAR f_gmvt_item.
ENDLOOP.
* cALL THE bapi fm FOR gr POSTING
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = f_gmvt_header
goodsmvt_code = f_goodsmvt_code_tmp
* TESTRUN = ' '
* GOODSMVT_REF_EWM =
IMPORTING
goodsmvt_headret = f_gmvt_headret
* MATERIALDOCUMENT =
* MATDOCUMENTYEAR =
TABLES
goodsmvt_item = t_gmvt_item
* GOODSMVT_SERIALNUMBER =
return = t_return
* GOODSMVT_SERV_PART_DATA =
* EXTENSIONIN =
.
IF sy-subrc = 0.
* For commit the changes use BAPI_TRANSACTION_COMMIT FM.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
* MOVE: f_GMVT_HEADRET-MAT_DOC TO WA_DET-MBLNR,
* f_GMVT_HEADRET-DOC_YEAR TO WA_DET-MJAHR,
* f_GMVT_HEADER-REF_DOC_NO TO WA_DET-EBELN.
* APPEND WA_DET TO IT_DET.
* CLEAR WA_DET.
ENDIF.
2014 Apr 07 7:41 AM
Hello Srirangarajan Sridhar.
Did you pass all the data as mandated by the function module documentation?
Did you pass PO and item number in correct format (like preceding zeroes,if any) ?
Regards.
2014 Apr 07 7:42 AM
What all you get in RETURN table of BAPI apart from this message?
Nabheet
2014 Apr 07 7:48 AM
Hi Srirangarajan Sridhar,
If you are able to do it manually from MIGO then there is definitely issue with the data passed to BAPI. Please pass all parameters correctly. It should do it.
Also paste ur code here so that we can help u.
Thanks,
Sachin
2014 Apr 07 10:07 AM
Here is the code what i have written.
f_gmvt_header-pstng_date = sy-datum.
f_gmvt_header-doc_date = sy-datum.
f_gmvt_header-pr_uname = sy-uname.
f_gmvt_header-ref_doc_no = p_ebeln.
f_goodsmvt_code_tmp = '01'.
* Looping the PO details.
CLEAR: gf_item,f_gmvt_item.
LOOP AT gt_item INTO gf_item.
* fill the bapi item structure details
f_gmvt_item-material = gf_item-material.
f_gmvt_item-plant = gf_sbms-werks.
f_gmvt_item-stge_loc = '0001'.
f_gmvt_item-move_type = '101'.
f_gmvt_item-po_number = p_ebeln.
f_gmvt_item-po_item = gf_item-po_item.
f_gmvt_item-entry_qnt = gf_item-quantity.
f_gmvt_item-entry_uom = 'PC'.
f_gmvt_item-entry_uom_iso = 'PCE'.
f_gmvt_item-po_pr_qnt = gf_item-quantity.
f_gmvt_item-orderpr_un = 'PC'.
f_gmvt_item-orderpr_un_iso = 'PCE'.
f_gmvt_item-no_more_gr = 'X'.
f_gmvt_item-ref_doc = p_ebeln.
f_gmvt_item-prod_date = sy-datum.
f_gmvt_item-mvt_ind = 'B'.
f_gmvt_item-move_reas = '101'.
f_gmvt_item-vendor = gf_lfm1-lifnr.
APPEND f_gmvt_item TO t_gmvt_item.
CLEAR f_gmvt_item.
ENDLOOP.
* cALL THE bapi fm FOR gr POSTING
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = f_gmvt_header
goodsmvt_code = f_goodsmvt_code_tmp
* TESTRUN = ' '
* GOODSMVT_REF_EWM =
IMPORTING
goodsmvt_headret = f_gmvt_headret
* MATERIALDOCUMENT =
* MATDOCUMENTYEAR =
TABLES
goodsmvt_item = t_gmvt_item
* GOODSMVT_SERIALNUMBER =
return = t_return
* GOODSMVT_SERV_PART_DATA =
* EXTENSIONIN =
.
IF sy-subrc = 0.
* For commit the changes use BAPI_TRANSACTION_COMMIT FM.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
* MOVE: f_GMVT_HEADRET-MAT_DOC TO WA_DET-MBLNR,
* f_GMVT_HEADRET-DOC_YEAR TO WA_DET-MJAHR,
* f_GMVT_HEADER-REF_DOC_NO TO WA_DET-EBELN.
* APPEND WA_DET TO IT_DET.
* CLEAR WA_DET.
ENDIF.
2014 Apr 07 10:13 AM
2014 Apr 07 10:20 AM
Srirangarajan Sridhar,
In the item internal table, pass the following data alone and try:
move_type ('101'),
entry_uom,
entry_qnt,
po_number,
po_item AND
mvt_ind ('B')
2014 Apr 07 10:55 AM
I debugged the BAPI. this FM ME_READ_ITEM_GOODS_RECEIPT is failing to read the item details .
The return message is of message class M7 no.036. No goods receipt possible for purchase order 1940000498 00010.
2014 Apr 07 11:23 AM
Hello All,
Thank you so much..Issue got resolved. Just removed the reference document number passed to GR header level.
Passed only the following fields:
move_type ('101'),
entry_uom,
entry_qnt,
po_number,
po_item AND
mvt_ind ('B')
material
plant
stge_loc
no_more_gr
prod_date
2024 May 25 11:35 AM
I have the Same Error "no goods receipt possible for purchase order"
input :
HEADER-PSTNG_DATE = SY-DATUM.
HEADER-DOC_DATE = SY-DATUM.
HEADER-PR_UNAME = SY-UNAME.
----
ls_gm-move_type = '101'.
ls_gm-material = MATNR-LOW.
ls_gm-QUANTITY = '1'.
ls_gm-orderpr_un = 'PC'.
ls_gm-ENTRY_QNT = '1'.
ls_gm-ENTRY_UOM = 'PC'.
ls_gm-PO_NUMBER = PO_NO.
ls_gm-PO_ITEM = '00010'.
ls_gm-MVT_IND = 'B'.""B
ls_gm-PLANT = '1100'.
ls_gm-STGE_LOC = '1100'.
ls_gm-NO_MORE_GR = 'X'.
ls_gm-VENDOR = 'V0000040'.
If anyone Can help ? Thanks Alot
2024 Oct 07 1:37 PM
Hello experts,
When I create a Goods Reciept with reference to Purchase Order using BAPI_GOODSMVT_CREATE, the following error message appears.
No goods receipt possible for purchase order <PO number> <line item number>.
But the GR is getting created manually using Transaction MIGO for the same PO number.
Here is the code:
SELECT deliverydocument, "vbeln
deliverydocumentitem, "posnr
plant "werks
FROM i_deliverydocumentitem "lips
INTO TABLE @DATA(dlv_item)
WHERE deliverydocument IN @inb_delv " OR deliverydocument IN @delv_num )
AND plant IN @Store.
IF sy-subrc = 0.
SELECT deliverydocument, "vbeln
supplier "lifnr
FROM i_deliverydocument "likp
INTO TABLE @DATA(dlv_hdr)
FOR ALL ENTRIES IN @dlv_item
WHERE deliverydocument = @dlv_item-deliverydocument
AND deliverydate IN @s_date_tmp
AND sddocumentcategory = '7'.
IF sy-subrc = 0.
SELECT businesspartner, "partner
bpidentificationtype, "type
bpidentificationnumber "idnumber
FROM i_bupaidentification "but0id
INTO TABLE @DATA(bp_id)
FOR ALL ENTRIES IN @dlv_hdr
WHERE businesspartner = @dlv_hdr-supplier
AND bpidentificationtype = 'GLREG'.
IF sy-subrc = 0.
SELECT low
FROM ztle_constant
INTO TABLE @DATA(legacy_vendor)
WHERE name = 'ZS4_LEGACY_VENDOR'.
IF sy-subrc = 0 AND legacy_vendor IS NOT INITIAL.
LOOP AT bp_id ASSIGNING FIELD-SYMBOL(<lfs_bp_id>).
* READ TABLE legacy_vendor WITH KEY low = <lfs_bp_id>-bpidentificationnumber TRANSPORTING NO FIELDS.
* IF sy-subrc = 0.
IF line_exists( legacy_vendor[ low = <lfs_bp_id>-bpidentificationnumber ] ).
IF NOT dlv_hdr IS INITIAL.
DELETE dlv_hdr WHERE supplier = <lfs_bp_id>-businesspartner.
ELSE.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
IF NOT dlv_hdr IS INITIAL.
SELECT deliverydocument, "vbeln
deliverydocumentitem, "posnr
material, "matnr
plant, "werks
actualdeliveryquantity, "lfimg
baseunit, "Meins
referencesddocument, "vgbel
referencesddocumentitem, "vgpos
goodsmovementstatus "wbsta
FROM i_deliverydocumentitem "lips
INTO TABLE @DATA(dlv_item_final)
FOR ALL ENTRIES IN @dlv_hdr
WHERE deliverydocument = @dlv_hdr-deliverydocument
AND ( goodsmovementstatus = 'A'
OR goodsmovementstatus = 'B').
IF sy-subrc = 0.
SORT dlv_item_final BY referencesddocument referencesddocumentitem.
* DELETE ADJACENT DUPLICATES FROM dlv_item_final COMPARING referencesddocument referencesddocumentitem.
SELECT b~purchasingdocument, "ebeln
b~purchasingdocumentitem, "ebelp
b~supplierconfirmationcontrolkey, "bstae
a~purchasingdocumenttype "bsart
FROM i_purchasingdocumentitem AS b "ekpo
INNER JOIN i_purchasingdocument AS a "ekko
ON b~purchasingdocument = a~purchasingdocument
FOR ALL ENTRIES IN @dlv_item_final
WHERE b~purchasingdocument = @dlv_item_final-referencesddocument
AND b~purchasingdocumentitem = @dlv_item_final-referencesddocumentitem+1(5)
AND b~supplierconfirmationcontrolkey IN ( 'Z002' , 'Z003' )
AND a~purchasingdocumenttype = 'ZDNB'
INTO TABLE @DATA(dsp_po).
IF sy-subrc = 0.
SORT dsp_po BY purchasingdocument purchasingdocumentitem.
* DELETE ADJACENT DUPLICATES FROM dsp_po COMPARING purchasingdocument purchasingdocumentitem.
LOOP AT dlv_item_final ASSIGNING FIELD-SYMBOL(<lfs_item>).
DATA(index) = sy-tabix.
* READ TABLE dsp_po WITH KEY purchasingdocument = <lfs_item>-referencesddocument
* purchasingdocumentitem = <lfs_item>-referencesddocumentitem+1(5)
* BINARY SEARCH
* TRANSPORTING NO FIELDS.
* IF sy-subrc NE 0.
IF NOT line_exists( dsp_po[ purchasingdocument = <lfs_item>-referencesddocument
purchasingdocumentitem = <lfs_item>-referencesddocumentitem+1(5) ] ).
DELETE dlv_item_final INDEX index.
ENDIF.
ENDLOOP.
ENDIF.
ELSE.
MESSAGE 'GR is already done for this delivery'(007) TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
CLEAR: goodsmvt_item.
SORT dlv_hdr BY deliverydocument.
* DELETE ADJACENT DUPLICATES FROM dlv_hdr COMPARING deliverydocument.
SORT dlv_item_final BY deliverydocument deliverydocumentitem.
* DELETE ADJACENT DUPLICATES FROM dlv_item_final COMPARING referencesddocument referencesddocumentitem.
LOOP AT dlv_hdr ASSIGNING FIELD-SYMBOL(<lfs_dlv_hdr>).
READ TABLE dlv_item_final ASSIGNING FIELD-SYMBOL(<lfs_dlv_item>) WITH KEY deliverydocument = <lfs_dlv_hdr>-deliverydocument
BINARY SEARCH.
IF sy-subrc = 0.
DATA(item_indx) = sy-tabix.
goodsmvt_header-pstng_date = sy-datum.
goodsmvt_header-ref_doc_no = <lfs_dlv_item>-referencesddocument.
goodsmvt_code-gm_code = gm_code_gr.
LOOP AT dlv_item_final ASSIGNING <lfs_item> FROM item_indx.
IF <lfs_item>-deliverydocument NE <lfs_dlv_hdr>-deliverydocument.
EXIT.
ENDIF.
APPEND VALUE #( material = <lfs_item>-material
plant = <lfs_item>-plant
no_more_gr = abap_true
mvt_ind = movement_indicator
move_type = movement_type_gr
entry_qnt = <lfs_item>-actualdeliveryquantity
entry_uom = <lfs_item>-baseunit
po_number = <lfs_item>-referencesddocument
po_item = <lfs_item>-referencesddocumentitem+1(5)
ref_doc = <lfs_item>-referencesddocument
ref_doc_it = <lfs_item>-referencesddocumentitem+1(5)
deliv_numb = <lfs_item>-deliverydocument
deliv_item = <lfs_item>-deliverydocumentitem ) TO goodsmvt_item.
ENDLOOP.
IF goodsmvt_item IS NOT INITIAL.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = goodsmvt_header
goodsmvt_code = goodsmvt_code
IMPORTING
materialdocument = materialdocument
matdocumentyear = matdocumentyear
TABLES
goodsmvt_item = goodsmvt_item
return = return.
READ TABLE return WITH KEY type = 'E' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDIF.