GR posting error in BAPI_GOODSMVT_CREATE

fields have been picked up from LIPS table and passed into the BAPI

Facing issue when article is of MIX Quantity.

image (7).png

image (6).png

Providing some snippets of the code:

FETCHING DATA FROM LIPS table

 SELECT deliverydocument,                      “vbeln
                     deliverydocumentitem,                  “posnr
                     material,                              “matnr
                     plant,                                 “werks
                     actualdeliveryquantity,                “lfimg
*                     baseunit,                              “meins
                     deliveryquantityunit,                  “vrkme
                     referencesddocument,                   “vgbel
                     referencesddocumentitem,               “vgpos
                     goodsmovementstatus                    “wbsta
                     FROM i_deliverydocumentitem AS a       “lips
                     FOR ALL ENTRIES IN @dlv_hdr
                     WHERE a~deliverydocument @dlv_hdrdeliverydocument
                     INTO TABLE @DATA(dlv_item_final).

PASSING DATA INTO BAPI

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>deliveryquantityunit
*                                                     entry_uom_iso        =  <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
                                                     deliv_numb_to_search =  <lfs_item>deliverydocument
                                                     deliv_item_to_search =  <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 sysubrc 0.
                            CALL FUNCTION ‘BAPI_TRANSACTION_ROLLBACK’.
                          ELSE.
                            CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
                              EXPORTING
                                wait abap_true.
                          ENDIF.

 

Facing issue when article is of MIX Quantity.

Please can someone help to resolve this issue.

i have not provided the full code, just the required part is given.

 

Scroll to Top