BAPI PO Creation - Example & Documentation
BAPI PO Creation - Example & Documentation
BAPI PO Creation - Example & Documentation
BAPIPOCreation:Example&Documentation
FUBAPI_PO_CREATE1
____________________________________________________
ShortText
CreatePurchaseOrder
Functionality
FunctionmoduleBAPI_PO_CREATE1enablesyoutocreatepurchaseorders.TheBAPIusesthetechnologybehind
theEnjoypurchaseordertransaction(ME21N).
Alternatively, the IDoc type PORDCR1 is available. The data from this IDoc automatically populates the interface
parametersofthefunctionmoduleBAPI_PO_CREATE1.
FunctionalityinDetail
Authorization
ThefollowingauthorizationobjectsarecheckedwhenanEnjoypurchaseorderiscreated(activity01):
M_BEST_BSA(documenttypeinPO)
M_BEST_EKG(purchasinggroupinPO)
M_BEST_EKO(purchasingorganizationinPO)
M_BEST_WRK(plantinPO)
ControllingadoptionoffieldvaluesviaXparameter
For most tables, you can determine via your own parameters in the associated X parameter in each case (e.g.
PoItemX) whether fields are to be set initial, values inserted via the interface, or default values adopted (e.g. from
Customizing or master records) (for example, it is not mandatory to adopt the material group from an underlying
purchaserequisitionyoucanchangeitwiththeBAPI).
Transfer
Headerdata
TheheaderdataoftheEnjoypurchaseorderistransferredinthetablePoHeader.
Itemdata
TheitemdataoftheEnjoypurchaseorderisstoredinthetablePoItem(generalitemdata).Thedeliveryschedule
linesarestoredinthetablePoSchedule.
UsethetablePoAccounttospecifytheaccountassignmentinformation.Ifaccountassignmentshavebeenspecified
forservicesandlimits,youshowtherelevantaccountassignmentlineinPoAccountinthetablePoSrvAccessValues
viathepackagenumberoftheserviceorthelimit.
Servicesandlimits
Services, free limits and limits with contract reference can be specified in the tables PoServices, PoLimits, and
PoContractLimits.
Conditions
ConditionsaretransferredinthetablePoCondheaderconditionsinthetablePoCondHeader.Pricedeterminationis
reinitiatedviatheparameterCALCTYPEinthetablePoItem.
Vendoranddeliveryaddress
The vendor's address can be specified individually in the table PoAddrVendor the delivery address in the table
PoAddrDelivery.Ifyoudonotmakeanyindividualspecification,thefieldswillbepopulatedviathecentraladdress
managementfacility.
Note
Inthismethod,thefollowingrestrictionsapplywithregardtoaddresses:
http://teachsap.blogspot.my/2010/02/bapipocreationexampledocumentation.html 1/7
3/27/2017 BAPIPOCreation:Example&Documentation
Addressescanonlybecreatedwiththismethodtheycannotbechanged.Youcanonlychangeaddressdatawith
themethodBAPI_ADDRESSORG_CHANGE.
Whenyoucreateaddresses,theyarenotcheckedbythemethod.AnEnjoypurchaseordermaythereforecontain
faultyaddressdata.
Partnerroles
ThepartnerscanbemaintainedindividuallyviathetablePoPartner(withtheexceptionofthepartnerrole"vendor").
Import/exportdata
Import/ExportdatacanbespecifiedperiteminthetablePoExpImpItem.Foreigntradedatacanonlybetransferred
asdefaultdatafornewitems.
Texts
Header and item texts can be transferred in the tables PoTextHeader and PoTextItem. Texts for services are
importedinthetablePoServicesText.
VersionManagement
YoucanmakeuseoftheVersionManagementfacilityviathetableAllVersions.
Return
ThePOnumberisreturnedintheparameterExpPurchaseOrder.Inaddition,allinformationexcepttheserviceand
export/importtablesisplacedintheoutputstructures.
Returnmessages
Messages are returned in the parameter Return. This also contains information as to whether interface data has
beenwronglyorprobablywrongly(heuristicalinterfacecheck)populated.WhenaPOhasbeencreatedsuccessfully,
thePOnumberisalsoplacedinthereturntablewiththeappropriatemessage.
Restrictions
Withthisfunctionmodule,itisnotpossibleto:
Createsubcontractingcomponents(youcanonlyuseexistingones)
Createconfigurations(youcanonlyuseexistingones)
Change message records (table NAST) and additional message data (this data can only be determined via the
messagedeterminationfacility(Customizing))
Attachdocumentstothepurchaseorder
SeealsofurtherinformationinSAPNote197958.
Example
ExampleofpopulationofBAPIinterfaceintheFunctionBuilder
Parameter:POHEADER
COMP_CODE=1000
DOC_TYPE=NB
ITEM_INTVL=00001
VENDOR=0000001000
PMNTTRMS=0001
PURCH_ORG=1000
PUR_GROUP=001
CURRENCY=EUR
Parameter:POHEADERX
COMP_CODE=X
DOC_TYPE=X
ITEM_INTVL=X
http://teachsap.blogspot.my/2010/02/bapipocreationexampledocumentation.html 2/7
3/27/2017 BAPIPOCreation:Example&Documentation
VENDOR=X
PMNTTRMS=X
PURCH_ORG=X
PUR_GROUP=X
Parameter:POITEM
PO_ITEM=00001
MATERIAL=100100
PLANT=1000
STGE_LOC=0001
QUANTITY=15.000
TAX_CODE=V0
ITEM_CAT=0
ACCTASSCAT=K
Parameter:POITEMX
PO_ITEM=00001
MATERIAL=X
PLANT=X
STGE_LOC=X
QUANTITY=X
TAX_CODE=X
ITEM_CAT=X
ACCTASSCAT=X
Parameter:POSCHEDULE
PO_ITEM=00001
SCHED_LINE=0001
DELIVERY_DATE=02.12.2002
QUANTITY=6.000
PO_ITEM=00001
SCHED_LINE=0002
DELIVERY_DATE=03.12.2002
QUANTITY=5.000
PO_ITEM=00001
SCHED_LINE=0003
DELIVERY_DATE=04.12.2002
QUANTITY=4.000
Parameter:POSCHEDULEX
PO_ITEM=00001
SCHED_LINE=0001
PO_ITEMX=X
SCHED_LINEX=X
DELIVERY_DATE=X
QUANTITY=X
PO_ITEM=00001
SCHED_LINE=0002
PO_ITEMX=X
http://teachsap.blogspot.my/2010/02/bapipocreationexampledocumentation.html 3/7
3/27/2017 BAPIPOCreation:Example&Documentation
SCHED_LINEX=X
DELIVERY_DATE=X
QUANTITY=X
PO_ITEM=00001
SCHED_LINE=0003
PO_ITEMX=X
SCHED_LINEX=X
DELIVERY_DATE=X
QUANTITY=X
Parameter:POACCOUNT
PO_ITEM=00001
SERIAL_NO=01
QUANTITY=15.000
GL_ACCOUNT=0000400000
COSTCENTER=0000001000
CO_AREA=1000
Parameter:POACCOUNTX
PO_ITEM=00001
SERIAL_NO=01
QUANTITY=X
GL_ACCOUNT=X
COSTCENTER=X
CO_AREA=X
Parameter:POCOND
ITM_NUMBER=000001
COND_ST_NO=001
COND_TYPE=PB00
COND_VALUE=79.900000000
CURRENCY=EUR
CURRENCY_ISO=EUR
COND_UNIT=KG
COND_P_UNT=1
CHANGE_ID=U
Parameter:POCONDX
ITM_NUMBER=000001
COND_ST_NO=000
ITM_NUMBERX=X
COND_TYPE=X
COND_VALUE=X
CURRENCY=X
CHANGE_ID=X
Parameter:POPARTNER
PARTNERDESC=OA
LANGU=EN
http://teachsap.blogspot.my/2010/02/bapipocreationexampledocumentation.html 4/7
3/27/2017 BAPIPOCreation:Example&Documentation
BUSPARTNO=0000001100
PARTNERDESC=GS
LANGU=EN
BUSPARTNO=0000001200
PARTNERDESC=PI
LANGU=EN
BUSPARTNO=0000001000
HelpintheCaseofProblems
SAP Note 197958 lists answers to frequently asked questions (FAQs). (Note 499626 contains answers to FAQs
relatingspecificallytoExternalServicesManagement.)
IfyouhavedetectedanerrorinthefunctionofaBAPI,createareproducibleexampleinthetestdatadirectoryinthe
FunctionBuilder(transactioncodeSE37).SAPNote375886tellsyouhowtodothis.
Iftheproblempersists,createaCustomerProblemMessageforthecomponenteMMPURPOBAPI,anddocument
thereproducibleexamplewhereappropriate.
CustomerEnhancements
Thefollowingcustomerexits(functionmodules)areavailablefortheBAPIBAPI_PO_CREATE1:
EXIT_SAPL2012_001(atstartofBAPI)
EXIT_SAPL2012_003(atendofBAPI)
Thefollowingcustomerexits(functionmodules)areavailablefortheBAPIBAPI_PO_CHANGE:
EXIT_SAPL2012_002(atstartofBAPI)
EXIT_SAPL2012_004(atendofBAPI)
TheseexitsbelongtotheenhancementSAPL2012(seealsotransactioncodesSMODandCMOD).
There is also the option of populating customers' own fields for header, item, or account assignment data via the
parameterEXTENSIONIN.
Furtherinformation
FurtherinformationonpurchaseorderBAPIsisavailableinSAPNote197958.
IfyoutesttheBAPIsBAPI_PO_CREATE1orBAPI_PO_CHANGEintheFunctionBuilder(transactioncodeSE37),no
databaseupdateswillbecarriedout.Ifyouneedthisfunction,takealookatNote420646.
The BAPI BAPI_PO_GETDETAIL serves to read the details of a purchase order. The BAPI cannot read all details
(e.g.conditions).However,youcanusetheBAPIBAPI_PO_CHANGEforthispurposeifjustthedocumentnumberis
populatedandtheinvokerhaschangeauthorizationsforpurchaseorders.
Frequently used BAPIs for purchase orders are BAPI_PO_CREATE, BAPI_PO_CREATE1, BAPI_PO_CHANGE,
BAPI_PO_GETDETAIL,BAPI_PO_GETITEMS,BAPI_PO_GETITEMSREL,andBAPI_PO_GETRELINFO.
Formoreinformationonpurchaseorders,refertotheSAPlibrary(underMMPurchasing>PurchaseOrders)orthe
HelpfortheEnjoyPurchaseOrder,orchoosethepathTools>ABAPWorkbench>Overview>BAPIExplorerfrom
theSAPEasyAccessmenu.
Parameters
POHEADER
POHEADERX
POADDRVENDOR
TESTRUN
MEMORY_UNCOMPLETE
MEMORY_COMPLETE
POEXPIMPHEADER
POEXPIMPHEADERX
VERSIONS
NO_MESSAGING
http://teachsap.blogspot.my/2010/02/bapipocreationexampledocumentation.html 5/7
3/27/2017 BAPIPOCreation:Example&Documentation
NO_MESSAGE_REQ
NO_AUTHORITY
NO_PRICE_FROM_PO
EXPPURCHASEORDER
EXPHEADER
EXPPOEXPIMPHEADER
RETURN
POITEM
POITEMX
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
Exceptions
FunctionGroup
2012
Posted7thFebruary2010byJay
Labels:BAPI,PO
1 Viewcomments
shafi 11July2011at00:50
mentionclearlywithrelaventexamples
Reply
http://teachsap.blogspot.my/2010/02/bapipocreationexampledocumentation.html 6/7