Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

GR posting error in BAPI_GOODSMVT_CREATE

Rangan
Explorer
0 Likes
1,170

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_hdr-deliverydocument
                     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 sy-subrc 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.

 

3 REPLIES 3
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,160

First, ask the functional people, maybe this error would happen with MIGO.

Read only

0 Likes
1,115

Hi Sandra,

Functional people have confirmed there is no error when they are posting GR through standalone BAPI & MIGO

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,089

Through standalone BAPI. Did they run with SE37? If yes, just make sure that you pass exactly the same parameters, and that's it.