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

Data Refresh problem with BAPI

former_member207873
Participant
0 Likes
2,522

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.

5 REPLIES 5
Read only

SimoneMilesi
Active Contributor
0 Likes
1,720

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.

Read only

former_member207873
Participant
0 Likes
1,720

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.


Read only

former_member207873
Participant
0 Likes
1,720

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 .

Read only

former_member207873
Participant
0 Likes
1,720

Solved

Read only

0 Likes
1,720

Could you either Close the Question OR Explain what your solution was if it would be useful to others? Thanks

Nic T.