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

Difference between the Two BAPI.

thangam_perumal
Contributor
0 Likes
864

Hi Experts,

                    I have to do one work on Goods Receipts against the Purchase Order. i think two BAPI are Available

                                        1. BAPI_GOODSMVT_CREATE

                                        2./AFS/BAPI_GOODSMVT_CREATE

Please anyone suggest me Which BAPI is Best to Use,What is the Difference Between Two Methods.

I have tried  Both Function Modules

While Using BAPI_GOODSMVT_CREATE but documents are Not Posted it shows the error like

No goods receipt possible for purchase order 4500216300 00010.

another one is /AFS/BAPI_GOODSMVT_CREATE the  Documents are gets posted but i can't reverse it.

it shows the error while am try to reverse in MIGO  like

                              Account determination for entry JKCA KBS 1000 not possible

                                  Message no. M8147.

Blindly i dont know what to do, Please anyone help me out.. is it possible to reverse via MIGO or  some other method .

2 REPLIES 2
Read only

arivazhagan_sivasamy
Active Contributor
0 Likes
624

Hi,

You can use BAPI_GOODSMVT_CREATE, it will work.

Please try to post your purchase order using MIGO, if get posted, definitely above BAPI will work.

You have to use GMCODE as '01'.

Arivazhagan S

Read only

0 Likes
624

Mr Arivazhagan,

                         I Have tried that BAPI but not getting Posted.

My code is

     data: gt_goodsmvt_header  like bapi2017_gm_head_01,
       gt_goodsmvt_item    like bapi2017_gm_item_create occurs 0 with header line,
       gt_return           like bapiret2 occurs 0 with header line.
data: gt_goodsmvt_headret like bapi2017_gm_head_ret,
       goodsmvt_code_tmp   type bapi2017_gm_code,
       testrun             type c value 'X'.
     data: l_return like bapiret2.

   gt_goodsmvt_header-pstng_date = sy-datum.
   gt_goodsmvt_header-doc_date   = sy-datum.
   gt_goodsmvt_header-bill_of_lading = ''.
   gt_goodsmvt_header-header_txt = 'D.G.K. Dyeing Mills'.
   gt_goodsmvt_header-ref_doc_no = '0100'.
***<<<<<<<<<<<BAPI Communication Structure: Material Document Header Data>>>>>>>
*    gt_goodsmvt_item-material             =  lips-matnr .

     gt_goodsmvt_item-plant                '1002'.
     gt_goodsmvt_item-stge_loc             'FB01'.
*    gt_goodsmvt_item-deliv_numb_to_search = lips-vbeln.
*    gt_goodsmvt_item-deliv_item_to_search = lips-posnr.
     gt_goodsmvt_item-move_type            = '101' .    "'101'.
     gt_goodsmvt_item-entry_qnt            = '10' .    "'50'.
     gt_goodsmvt_item-entry_uom            = 'KG'.
     gt_goodsmvt_item-mvt_ind              = 'B'.
     gt_goodsmvt_item-po_number            = '4500216300'.
     gt_goodsmvt_item-po_item              = '00010'.
     gt_goodsmvt_item-no_more_gr           = 'X'.
     gt_goodsmvt_item-vendor               = '0000020503'.
     gt_goodsmvt_item-gl_account           = '0000251102'.
     gt_goodsmvt_item-stck_type            = 'F'.
     gt_goodsmvt_item-item_text            = 'INWARD'.
     gt_goodsmvt_item-sales_ord        '0020110291'.
     gt_goodsmvt_item-s_ord_item       = '0010'.
     gt_goodsmvt_item-ref_doc          = '4500216300'.
     append  gt_goodsmvt_item.
     goodsmvt_code_tmp =          '01'. "Assign code to transaction for BAPI goods movement
****<<<<<<<Post goods movements with MB_CREATE_GOODS_MOVEMENT>>>>>>>>>>>>>>>>>>>
   call function 'BAPI_GOODSMVT_CREATE'
     exporting
       goodsmvt_header          = gt_goodsmvt_header
       goodsmvt_code            = goodsmvt_code_tmp
*      testrun                  = testrun
    importing
      goodsmvt_headret          gt_goodsmvt_headret
     tables
       goodsmvt_item            = gt_goodsmvt_item
*   GOODSMVT_SERIALNUMBER       =
       return                   = gt_return.

   if gt_return[] is initial.
     call function 'BAPI_TRANSACTION_COMMIT'
      exporting
        wait          = 'X'
      importing
        return        = l_return.

     write:/3  'ASN Number', gt_goodsmvt_item-deliv_numb_to_search,
           /3  'Item',gt_goodsmvt_item-deliv_item_to_search.
   else.
     read table gt_return index 1.
     write: '~ERROR~',
            / gt_return-message.
   endif.

Please Suggest if any thing wrong in my code