2008 Mar 20 1:23 PM
I'm using BAPI_PO_CREATE1 to create purchase orders. I know it doesn't actually create the order itself when run from SE37, but is this also the case if called in a program which is run via SE80 or SE38? I even added a t-code to the program, but the documents don't show up in EKKO... the BAPI gives me a few warning mesages, but basically states that a PO has been created with number so-and-so. Do I need a commit work or something in my program?
2008 Mar 20 1:39 PM
hi
I have used this particular FM to create PO' and it works fine, please check this sample program
* Create Purchase Order.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = wa_header
poheaderx = wa_headerx
* poaddrvendor =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
* NO_MESSAGING =
* NO_MESSAGE_REQ =
* NO_AUTHORITY =
no_price_from_po = 'X'
IMPORTING
exppurchaseorder = ponumber
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
return = t_return
poitem = t_item
poitemx = t_itemx
* poaddrdelivery =
poschedule = t_schedule
poschedulex = t_schedulex
poaccount = t_account
* POACCOUNTPROFITSEGMENT =
poaccountx = t_accountx
* POCONDHEADER =
* POCONDHEADERX =
pocond = t_pocond "JJC042107
pocondx = t_pocondx "JJC042107
polimits = t_limits
* POCONTRACTLIMITS =
* POSERVICES =
posrvaccessvalues = t_posrvaccessvalues
* POSERVICESTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* POEXPIMPITEM =
* POEXPIMPITEMX =
potextheader = t_potextheader
potextitem = t_potextitem "dar020107
* ALLVERSIONS =
popartner = t_popartner.
IF ponumber NE space.
COMMIT WORK AND WAIT.
ENDIF.
Small correction add a Commit work and wait after checking whether PO has been created (BAPI already exports this to our program as you can see from the above program)
Also please check whether you have authorisations to create new purchase order in System->user Profile -> Own Data
I'm using BAPI_PO_CREATE1 to create purchase orders. I know it doesn't actually create the order itself when run from SE37, but is this also the case if called in a program which is run via SE80 or SE38? I even added a t-code to the program, but the documents don't show up in EKKO... the BAPI gives me a few warning mesages, but basically states that a PO has been created with number so-and-so. Do I need a commit work or something in my program?
2008 Mar 20 1:31 PM
It does create in SE37.
To do this, please use BAPI_TRANSACTION_COMMIT .
goto test>TEST SEQUENCE
run bapi_po_creat, follow by bapi_transaction_commit.
For your program, put in BAPI_TRANSACTION_COMMIT after BAPI_PO_CREATE.
good luck
2008 Mar 20 1:39 PM
hi
I have used this particular FM to create PO' and it works fine, please check this sample program
* Create Purchase Order.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = wa_header
poheaderx = wa_headerx
* poaddrvendor =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
* NO_MESSAGING =
* NO_MESSAGE_REQ =
* NO_AUTHORITY =
no_price_from_po = 'X'
IMPORTING
exppurchaseorder = ponumber
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
return = t_return
poitem = t_item
poitemx = t_itemx
* poaddrdelivery =
poschedule = t_schedule
poschedulex = t_schedulex
poaccount = t_account
* POACCOUNTPROFITSEGMENT =
poaccountx = t_accountx
* POCONDHEADER =
* POCONDHEADERX =
pocond = t_pocond "JJC042107
pocondx = t_pocondx "JJC042107
polimits = t_limits
* POCONTRACTLIMITS =
* POSERVICES =
posrvaccessvalues = t_posrvaccessvalues
* POSERVICESTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* POEXPIMPITEM =
* POEXPIMPITEMX =
potextheader = t_potextheader
potextitem = t_potextitem "dar020107
* ALLVERSIONS =
popartner = t_popartner.
IF ponumber NE space.
COMMIT WORK AND WAIT.
ENDIF.
Small correction add a Commit work and wait after checking whether PO has been created (BAPI already exports this to our program as you can see from the above program)
Also please check whether you have authorisations to create new purchase order in System->user Profile -> Own Data
2010 Sep 23 7:54 PM
Do you have the data that you used to populate the variables? I have seen a multitude of different ways to use this data. I am having a problem and can't seem to find why the PO number is not being generated.
*************************************************************************
*Call BAPI to create STO
*NOTE: gs_po_header, gv_po_num and gt_po_item are declared in the PROTECTED SECTION
*************************************************************************
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = gs_po_header
poheaderx = gs_po_headerx
IMPORTING
exppurchaseorder = gv_po_num
TABLES
return = lt_errmsg
poitem = gt_po_item
poitemx = gt_po_itemx
poschedule = gt_po_sch
poschedulex = gt_po_schx
. "END OF BAPI_PO_CREATE1 CALL
*--
LOOP AT lt_errmsg INTO ls_errmsg.
lv_err_msg_type = ls_errmsg-type.
IF lv_err_msg_type = 'E'. "Error message indicating
MOVE ls_errmsg TO et_msg_log.
ENDIF.
EXIT.
ENDLOOP.
*--
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = wa_commit.
ENDMETHOD.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |