‎2018 May 30 2:26 PM
Hello Experts,
I am running the BAPI BAPI_PO_CREATE1 multiple times to create multiple PO's. But the material number is not getting updated properly and hence causing wrong material number in PO.
Suppose a PO got created with materials with four line items.
Material Quantity
100001 100
100001 150
100001 200
100001 110
and then i need a PO with a single line item with material 100002, the PO is getting created with the material 100001. I notice that the material which goes into the BAPI is correct(100002) but after the BAPI runs, it is giving the wrong material number(100001) and creating a PO.
B.R.
‎2018 May 30 3:40 PM
If you could share a slice of formatted and relevant code in which you fill the tables and call the BAPI, it would help us in understanding the issue.
With the few information you gave, we can only guess, without giving any real help.
‎2018 May 30 3:56 PM
Hello Simone Milesi,
Thanks for your reply. The code is nothing complicated thats why i did not share. It is just normal BAPI code.
FORM proc_selec_lines USING ls_final_data TYPE ty_final_data.
MOVE: lv_po_item TO lt_ekpo-po_item,
lv_po_item TO lt_ekpox-po_item.
ls_final_data-lgort = '3100'.
MOVE: ls_final_data-matnr TO lt_ekpo-material,
ls_final_data-lgort TO lt_ekpo-stge_loc,
ls_final_data-verme TO lt_ekpo-quantity,
ls_final_data-meins TO lt_ekpo-po_unit.
APPEND lt_ekpo.
APPEND lt_ekpox.
ADD 1 TO lv_po_item.
ENDFORM.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = ls_ekko
poheaderx = ls_ekkox
IMPORTING
exppurchaseorder = lv_ebeln
TABLES
return = lt_return
poitem = lt_ekpo
poitemx = lt_ekpox
*** I have got a list of materials and some materials have to be grouped together and made into one PO. (Which is working perfectly) and other set have to be grouped together and made into another PO. But the material data is not getting changed the second time. Before the BAPI is called it is all perfect but after the BAPI runs it is creating PO with the material in the first list.
‎2018 May 30 4:16 PM
It is somwhat related to the memory issue.
I have seen codes like this in the standard SAP codes before using this BAPI.
" refresh buffer
call function 'ME_EKKO_BUFFER_REFRESH'.
call function 'ME_EKPO_BUFFER_REFRESH'.
call function 'ME_STATISTICS_TABLES_REFRESH'.
perform mepo_refresh in program saplmepo. "See SCN Thread 77429
commit work and wait.
But it is not helping either .
‎2018 May 30 5:22 PM
‎2018 May 30 10:23 PM