Application Development 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: 

BAPI

Former Member
0 Kudos

plz gimme name of BAPI FM for purchase order creation along with sample code...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

look at this code

when 'DISP' or 'CHAN'.

clear c_temp.

c_temp = ok_code_5000.

  • This method enables you to list the detailed data on a purchase order

call function 'BAPI_PO_GETDETAIL'

exporting

purchaseorder = ekko-ebeln

items = 'X'

importing

po_header = wa_po_header

tables

po_items = t_po_item.

leave to screen 5001.

clear ok_code_5000

call function 'BAPI_PO_CHANGE'

exporting

purchaseorder = wa_ebeln

poheader = wa_ekko

poheaderx = t_ekkox

tables

return = t_return

poitem = t_ekpo_bapi

poitemx = t_ekpox.

clear w_ebeln.

w_ebeln = wa_ebeln.

if sy-subrc = 0.

    • Function module BAPI_PO_CREATE1 enables you to create POs.

    • The BAPI uses the technology behind transaction (ME21N)

    • Controlling adoption of field values via X bar

call function 'BAPI_PO_CREATE1'

exporting

poheader = wa_ekko

poheaderx = t_ekkox

importing

exppurchaseorder = wa_ebeln

tables

return = t_return

poitem = t_ekpo_bapi

poitemx = t_ekpox.

clear w_ebeln.

w_ebeln = wa_ebeln.

if sy-subrc = 0.

message i001 with wa_ebeln. " PO Created Sucessfully

call function 'BAPI_TRANSACTION_COMMIT'.

clear ok_code_5000.

leave to screen 5001.

Dont Forget To use

call function 'BAPI_TRANSACTION_COMMIT'.

clear ok_code_5000.

leave to screen 5001.

endif.

elseif c_temp = 'CREA'.

at end..

<REMOVED BY MODERATOR>

Gaurav J.

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 3:39 PM

7 REPLIES 7

Former Member
0 Kudos

hi,

you can use: bapi_po_create1.

for further help, you can check this link:

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 3:37 PM

Former Member
0 Kudos

Hi,

<REMOVED BY MODERATOR>

call function 'BAPI_PO_CREATE1'

exporting

poheader = zpoheader

poheaderx = zpoheaderx

  • POADDRVENDOR =

  • TESTRUN =

  • MEMORY_UNCOMPLETE =

  • MEMORY_COMPLETE =

  • POEXPIMPHEADER =

  • POEXPIMPHEADERX =

  • VERSIONS =

  • NO_MESSAGING =

  • NO_MESSAGE_REQ =

  • NO_AUTHORITY =

  • NO_PRICE_FROM_PO =

importing

exppurchaseorder = po_num

  • EXPHEADER = PO_NUM_HEAD

  • EXPPOEXPIMPHEADER =

tables

  • RETURN = zreturn

poitem = zitem

poitemx = zitemx

  • POADDRDELIVERY =

  • POSCHEDULE =

  • POSCHEDULEX =

  • POACCOUNT =

  • POACCOUNTPROFITSEGMENT =

  • POACCOUNTX =

  • POCONDHEADER =

  • POCONDHEADERX =

  • POCOND =

  • POCONDX =

  • POLIMITS =

  • POCONTRACTLIMITS =

  • POSERVICES =

  • POSRVACCESSVALUES =

  • POSERVICESTEXT =

  • EXTENSIONIN =

  • EXTENSIONOUT =

  • POEXPIMPITEM =

  • POEXPIMPITEMX =

  • POTEXTHEADER =

  • POTEXTITEM =

  • ALLVERSIONS =

  • POPARTNER =

  • POCOMPONENTS =

  • POCOMPONENTSX =

  • POSHIPPING =

  • POSHIPPINGX =

  • POSHIPPINGEXP =

.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'

  • IMPORTING

  • RETURN =

.

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 3:38 PM

Former Member
0 Kudos

Use this BAPI BAPI_PO_CREATE1.

Check this forum thread:

Check this Post

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 3:37 PM

Former Member
0 Kudos

Hi

Use BAPI_PO_CREATE

Thanks

Vijay

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 3:38 PM

Former Member
0 Kudos

just use transaction code BAPI and watch out there is heirarchical display of allll object type in that extend the MM tree in that expand the purchase order traa in that expand the purchase order in that you can find CREATE FROM DATA OR DATA1 JUST EXECUTE THAT NODE YOU CAN FIND FUNCTION MODULE AND KEY FIELDS AND METHODS FOR FUNCTION MODULE EVERY THING ABOUT THAT BAPI OK. ANDY QUERIES REGARDING BAPI LET ME KNOW. OK

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 3:39 PM

Former Member
0 Kudos

Hi,

look at this code

when 'DISP' or 'CHAN'.

clear c_temp.

c_temp = ok_code_5000.

  • This method enables you to list the detailed data on a purchase order

call function 'BAPI_PO_GETDETAIL'

exporting

purchaseorder = ekko-ebeln

items = 'X'

importing

po_header = wa_po_header

tables

po_items = t_po_item.

leave to screen 5001.

clear ok_code_5000

call function 'BAPI_PO_CHANGE'

exporting

purchaseorder = wa_ebeln

poheader = wa_ekko

poheaderx = t_ekkox

tables

return = t_return

poitem = t_ekpo_bapi

poitemx = t_ekpox.

clear w_ebeln.

w_ebeln = wa_ebeln.

if sy-subrc = 0.

    • Function module BAPI_PO_CREATE1 enables you to create POs.

    • The BAPI uses the technology behind transaction (ME21N)

    • Controlling adoption of field values via X bar

call function 'BAPI_PO_CREATE1'

exporting

poheader = wa_ekko

poheaderx = t_ekkox

importing

exppurchaseorder = wa_ebeln

tables

return = t_return

poitem = t_ekpo_bapi

poitemx = t_ekpox.

clear w_ebeln.

w_ebeln = wa_ebeln.

if sy-subrc = 0.

message i001 with wa_ebeln. " PO Created Sucessfully

call function 'BAPI_TRANSACTION_COMMIT'.

clear ok_code_5000.

leave to screen 5001.

Dont Forget To use

call function 'BAPI_TRANSACTION_COMMIT'.

clear ok_code_5000.

leave to screen 5001.

endif.

elseif c_temp = 'CREA'.

at end..

<REMOVED BY MODERATOR>

Gaurav J.

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 3:39 PM

0 Kudos

Oh darn... you shot Vivek in the face....