09-06-2008 4:42 AM
Hi Experts,
can anybody tell me BAPI fm for stock transfer order
Thanks in advance..
Narendra
09-06-2008 4:48 AM
09-06-2008 6:14 AM
09-06-2008 6:30 AM
STO is also a one of the Purchase Order type. But it is for Plant to plant.
So you can the same BAPI for Creating the STO.
BAPI_PO_CREATE1 "<---Preferred
BAPI_PO_CREATE
09-06-2008 7:11 AM
Hi Vijay,
Thanks for giving answer.
Can u please give me the code for Stock transfer order
using bapi po create.
Thanks in advance
narendra
09-06-2008 7:23 AM
Hi,
Check this link for sample code of bapi Bapi_po_create1-
http://abapreports.blogspot.com/2008/06/purchage-order-creation-using-bapi.html
09-06-2008 8:44 AM
just check this sample code.., Replace the values which are mentioned and check .
REPORT ZTEST_PO_STO.
data: poheader type BAPIEKKOC,
poitem type table of BAPIEKPOC with header line,
return type table of BAPIRETURN with header line.
data: po type BAPIMEPOHEADER-PO_NUMBER.
data: POSCHED type table of BAPIEKET with header line.
poheader-doc_type = 'UB'. " it is for sto
poheader-SUPPL_PLNT = 'R300'. "<----supplying plant
poheader-PURCH_ORG = 'R300'. "<---Purchasing org
poheader-CO_CODE = 'R300'. "<---company code
poheader-PUR_GROUP = 'R30'. "<----Purchasing group
poheader-DOC_DATE = sy-datum.
poitem-MATERIAL = 'R100001'. "<---material
poitem-PUR_MAT = poitem-MATERIAL.
poitem-plant = 'R310'. "<----plant
poitem-PO_ITEM = '000010'.
poitem-STORE_LOC = '0001'. "<---storage location
poitem-ITEM_CAT = '7'. "<----item category for STO
append poitem.
POSCHED-PO_ITEM = '000010'.
POSCHED-DELIV_DATE = sy-datum.
POSCHED-QUANTITY = '1.00'.
append POSCHED.
CALL FUNCTION 'BAPI_PO_CREATE'
EXPORTING
po_header = poheader
IMPORTING
PURCHASEORDER = Po
TABLES
po_items = poitem
po_item_schedules = posched
RETURN = RETURN
.
read table return with key type = 'S' transporting no fields.
if sy-subrc eq 0.
write po.
call function 'BAPI_TRANSACTION_COMMIT'.
endif.