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

problems using bapi_po_creeate1

Former Member
0 Likes
559

the following is the code

data: del_date type sy-datum.

data: head type bapimepoheader .

data: headx type bapimepoheaderx .

data: exp_head type bapimepoheader.

data: item type standard table of bapimepoitem with header line.

data: itemx type standard table of bapimepoitemx with header line.

data: ex_po_number type bapimepoheader-po_number.

head-comp_code = '1000'.

head-doc_type = 'NB' .

head-vendor = '1000'.

head-purch_org = '1000'.

head-pur_group = '001'.

head-langu = sy-langu.

head-doc_date = sy-datum.

headx-comp_code = 'X'.

headx-doc_type = 'X'.

headx-vendor = 'X'.

headx-langu = 'X'.

headx-purch_org = 'X'.

headx-pur_group = 'X'.

headx-doc_date = 'X'.

item-po_item = 00010.

item-material = '100-110'.

item-plant = '1000'.

item-stge_loc = '0001'.

item-quantity = '25'.

append item.

itemx-po_item = 'X'.

itemx-po_itemx = 'X'.

itemx-material = 'X'.

itemx-plant = 'X'.

itemx-stge_loc = 'X' .

itemx-quantity = 'X' .

append itemx.

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

poheader = HEAD

POHEADERX = HEADX

IMPORTING

EXPPURCHASEORDER = EX_PO_NUMBER

EXPHEADER = EXP_HEAD

TABLES

POITEM = ITEM

POITEMX = ITEMX

write: EX_PO_NUMBER.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

  • IMPORTING

  • RETURN =

.

if not ex_po_number is initial.

CALL FUNCTION 'DEQUEUE_ALL'

  • EXPORTING

  • _SYNCHRON = ' '

.

endif.

after the 'BAPI_PO_CREATE1' has finished i am trying to print 'ex_po_number' to get the purchase order number but it is coming blank.....

If anyone can plz suggest me where is the problem

5 REPLIES 5
Read only

Former Member
0 Likes
533

Sb,

is your whole code is in loop?

if not than it should be in loop.

Amit.

Read only

0 Likes
533

why do i need a loop.....i am supplying the values and creating the PO only once...

Read only

0 Likes
533

than it should come under BAPIMEPOHEADER-ebeln but in your case ex_po_number-ebeln .

Amit.

Read only

0 Likes
533

defining ex_po as character is not helping it's giving error......and in my prog ex_po_number is under bapimepoheader-po_number only

Read only

GauthamV
Active Contributor
0 Likes
533

hi,

if the po is created and u r not getting po number then declare like this.

data : po_no(10).

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

poheader = poheader

POHEADERX = poheaderx

  • POADDRVENDOR =

  • TESTRUN =

  • MEMORY_UNCOMPLETE =

  • MEMORY_COMPLETE =

  • POEXPIMPHEADER =

  • POEXPIMPHEADERX =

  • VERSIONS =

  • NO_MESSAGING =

  • NO_MESSAGE_REQ =

  • NO_AUTHORITY =

  • NO_PRICE_FROM_PO =

IMPORTING

EXPPURCHASEORDER = po_no

  • EXPHEADER =

  • EXPPOEXPIMPHEADER =

TABLES

RETURN = return

POITEM = poitem

POITEMX = poitemx

  • POADDRDELIVERY =

  • POSCHEDULE =

  • POSCHEDULEX =

POACCOUNT = poaccount

  • POACCOUNTPROFITSEGMENT =

POACCOUNTX = poaccountx

POCONDHEADER = pocondheader

POCONDHEADERX = pocondheaderx

  • POCOND =

  • POCONDX =

  • POLIMITS =

  • POCONTRACTLIMITS =

  • POSERVICES = POSRVACCESSVALUES =

  • POSERVICESTEXT =

  • EXTENSIONIN =

  • EXTENSIONOUT =

  • POEXPIMPITEM =

  • POEXPIMPITEMX =

  • POTEXTHEADER =

  • POTEXTITEM =

  • ALLVERSIONS =

  • POPARTNER =

.