Quantcast
Viewing all articles
Browse latest Browse all 3184

Add New item to PO using FM

Hi experts,

 

I am trying to add a new item to a PO using FM  BBP_PD_PO_UPDATE

 

CALL FUNCTION 'BBP_PD_PO_GETDETAIL'

   EXPORTING

     i_object_id       = lv_po_id

     i_attach_with_doc = ' '

     i_with_itemdata   = 'X'

     i_read_be_data    = ' '

   IMPORTING

     e_header          = ls_header_d

   TABLES

     e_item            = lt_item_d

     e_account         = lt_account_d

     e_partner         = lt_partner_d

     e_longtext        = lt_longtext_d

     e_orgdata         = lt_orgdata_d.

 

 

DATA: ls_header_u TYPE  bbp_pds_po_header_u .

 

MOVE-CORRESPONDING ls_header_d TO ls_header_u.

 

 

* Item data ...

READ TABLE lt_item_d INDEX 1.


lv_counter = 2.

   MOVE-CORRESPONDING lt_item_d TO lt_item_c.

   lt_item_c-number_int = lv_counter .

   MOVE lv_counter TO lt_item_c-guid.

   MOVE ls_header_u-guid TO lt_item_c-parent.

   APPEND lt_item_c.

 

CALL FUNCTION 'BBP_PD_PO_UPDATE'

   EXPORTING

     i_save     = 'X'

     i_header   = ls_header_u

     importing

       e_changed = lv_changed

       es_header = ls_header_new

   TABLES

     i_item     = lt_item_c

     e_messages = lt_messages.

 

 

 

CALL FUNCTION 'BBP_PD_PO_SAVE'

exporting

   iv_header_guid = ls_header_new-guid.

 

CALL FUNCTION 'BBP_PROCDOC_RESET_BUFFER'.

 

 

COMMIT WORK AND WAIT.

 

 

I am getting  'Buffer table not up to date' error. Am i missing something here?

 

thanks,

sankar.


Viewing all articles
Browse latest Browse all 3184

Trending Articles