AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
GettingStarted Newsletters
Welcome,Guest
Login
Register
Store
SearchtheCommunity
Products
Services&Support
AboutSCN
Downloads
Industries
Training&Education
Partnership
DeveloperCenter
LinesofBusiness
UniversityAlliances
Events&Webinars
Innovation
AstepbystepguideforbeginnersonuserdefinedBAPIcreation
CreatedbyAbysonJoseph,lastmodifiedonNov08,2011
AstepbystepguideforbeginnersonuserdefinedBAPIcreation
LinktoContent'stargetSpace:
http://wiki.sdn.sap.com/wiki/display/ABAP/BAPI
Appliesto:
SAPERP
Summary
AsimpleguideforbeginnersoncreatingauserdefinedBAPIandhowtotestit.Theguideispreparedinastepbystepformatwithalmostallpossiblescreenshots.Thisguidecontains5stageswhichare
explainedin30simplesteps.AbasicknowledgeinABAPandFunctionmoduleispreferredforthereader.
Author:AbysonJosephChavara
Company:ApplexusTechnologies(P)LTD.
Createdon:26July2011
Author(s)Bio
AbysonJosephChavaraisworkingasanSAPABAPconsultantatApplexusTechnologies(P)LTD.Hehasanexperienceof2yearsinABAPprogrammingand1yearinSAPPI.
TableofContents
Stage1:CreatingastructureinSE11
Stage2:CreatingthefunctionmoduleinSE37
Stage3:CreatingthebusinessobjectinSWO1
Stage4:ViewingthecreatedBAPIinBAPIExplorer
Stage5:TestyourBAPI
Introduction
ABusinessApplicationProgrammingInterface(BAPI)isapreciselydefinedinterfaceprovidingaccesstoprocessesanddatainbusinessapplicationsystemssuchasR/3.BAPIsaredefinedasAPI
methodsofSAPbusinessobjecttypes.ThesebusinessobjecttypesandtheirBAPIsaredescribedandstoredintheBusinessObjectRepository(BOR).ABAPIisimplementedasafunctionmodule,that
isstoredanddescribedintheFunctionBuilder.
BAPIscanbecalledwithintheR/3Systemfromexternalapplicationsystemsandotherprograms.BAPIsarethecommunicationstandardforbusinessapplications.BAPIinterfacetechnologyformsthe
basisforthefollowingdevelopments:
Connecting:
NewR/3components,forexample,AdvancedPlannerandOptimizer(APO)andBusinessInformationWarehouse(BW).
NonSAPsoftware
Legacysystems
IsolatingcomponentswithintheR/3SysteminthecontextofBusinessFramework
DistributedR/3scenarioswithasynchronousconnectionsusingApplicationLinkEnabling(ALE)
ConnectingR/3SystemstotheInternetusingInternetApplicationComponents(IACs)
PCprogramsasfrontendstotheR/3System,forexample,VisualBasic(Microsoft)orVisualAgeforJava(IBM).
Workflowapplicationsthatextendbeyondsystemboundaries
Customers'andpartners'owndevelopments
BAPIisbasicallyaRFCenabledfunctionmodule.ThedifferencebetweenRFCenabledfunctionmoduleandBAPIisbusinessobjects.Youcreatebusinessobjectsandthosearethenregisteredinyour
BOR(BusinessObjectRepository)whichcanbeaccessedoutsidetheSAPsystembyusingsomeotherapplications(NonSAP)suchasVBorJAVA.Inthiscaseyouonlyspecifythebusinessobjectand
itsmethodfromexternalsystem.InBAPIthereisnodirectsystemcall,whileRFCaredirectsystemcall.SomeBAPIsprovidebasicfunctionsandcanbeusedformostSAPbusinessobjecttypes.These
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
1/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
BAPIsshouldbeimplementedthesameforallbusinessobjecttypes.InshortBAPIisaRFCenabledfunctionmoduleonthewrapperofBusinessobject.
InthisguideIhavestartedwithcreatingastructureindictionary.ThenIamcreatingasimpleremoteenabledfunctionmodule.ThefunctionmodulefetchessomedetailsfromTableT001basedontheinput
companycode(BUKRS).TableT001containstheCompanyCodes.ThenextstepiscreatingabusinessobjectusingSWO1andweareaddingtheabovefunctionmoduleasamethodofthatbusiness
object.AftercompletingthestepsinSWO1wewillfindourcreatedBAPIinBAPIExplorer.ThenwewilldothetestingofBAPIbyinputtingsomevalues.
Stage1:CreatingastructureinSE11
Step1:GototransactionSE11andcreateastructureasshownorasperyourrequirement.
Donotforgettosaveitinapackage.Checkthestructure(ctrl+F2)andactivate(ctrl+F3)thestructure.
Stage2:CreatingthefunctionmoduleinSE37
Step2:GototransactionSE37whereyoucreatefunctionmodules.
Clickoncreateafteryouenterthenameofthefunctionmodule.Enterthefunctiongroupandshorttext.Nowclickonsavebutton.
Note:Iffunctiongroupisnotalreadymade,youcouldcreateitfromGoto>Functiongroup>CreateGroupfromtheinitialscreenofSE37.
Step3:AmessagewillbedisplayedFunctionmodulenameisreservedforSAP.Justclickcontinue.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
2/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Step4:Ascreenwillbedisplayedasbelow.Intheattributestab,maketheprocessingtypeasRemoteEnabledModule.
Step5:NowgototheImporttabandenterthedetailsasfollowsorasperyourrequirement.HereIamgivingtheassociatedtypeasZBAPISTRT001BUKRSthatwehavecreatedinpreviousstage.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
3/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Step6:Intheexporttabenterthedetailsasbelow.
Step7:IntheTablestabenterthedetailsasbelow.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
4/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Step8:Nowgotothesourcecodetabandenterthecodeasshownbelow.
Step9:NextwehavetoreleasethefunctionmodulebyFunctionModule>Release>Release.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
5/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Stage3:CreatingthebusinessobjectinSWO1
Step10:GototransactionSWO1andenterthenameoftheBAPIyouwouldliketocreateandclickcreate.HereIhavegiventhenameZBAPI_ABY.InthecomingscreenEnterthedetailsasbeloworas
perrequirementandclickcontinue.Thatwillaskyoutosavetheobject.Saveitinapackage.
Step11:Intheresultingscreenclickonthemethodstodropdownandseewhatmethodsareprovidedbydefault.Therewouldbetwomethods,showinginredcolorwhichcomesbydefaultwhilecreating
theBAPI.NowselectAddMethodfromUtilities>APIMethods>AddMethod.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
6/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Step12:Onthescreenthatfollows,providethefunctionmodulenamethatwejustcreatedinthepreviousstageandclickonthecontinueicon.Inthecomingpopup,clickthenextstepicon.Weobserve
thattheinformationispredefinedinthefields.
Step13:Thisisthenextscreenwhereyouwouldjustclickonthenexticon.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
7/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Step14:Apopupwillbedisplayedasbelow.
ClickonYes.YoucanseeaninformationmessagereadingZBAPIT001inserted.
Step15:Nowsaveafteryouaddthemethod.Select&DoubleclickontheAPImethod.
GotoTab:ABAPCheck'APIFunction'asshownbelow.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
8/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
SelecttheRadiobuttonreadingAPIFunctionasalreadysaidabove.
Step16:NowselecttheObjectZBAPI_ABYasshownbelow.
Step17:NowGoto:Edit>ChangeReleaseStatus>Objecttype>ToModeled.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
9/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Step18:Thebelowshownscreenwillbedisplayed.Clickonyes.
Themessageshows,Theobjecttypestatussettomodeled.(oralreadymodeled)
Step19:Nowgoto:Edit>ChangeReleaseStatus>Objecttype>ToImplemented.YoucanseeamessagereadingObjecttypestatussettoimplemented.
Step20:Now,goto:Edit>ChangeReleaseStatus>Object>ToReleased.Therewouldbetwopopupscomingup.ClickcontinueonthePopUps.
Step21:Keepthecursoronthe'Method'.Nowgoto:Edit>ChangeReleaseStatus>Objecttypecomponent>ToModeled.(Shownasbelow).
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
10/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Step22:Now,goto:Edit>ChangeReleaseStatus>Objecttypecomponent>ToImplemented.Youcanseethemessagereadingstatusformethodzbapifmt001settoimplemented.
Step23:Nowgoto:Edit>ChangeReleasseStatus>Objecttypecomponent>ToReleased.Youcanseethemessagereadingstatusformethodzbapifmt001settoReleased.
Step24:ClickonGeneratefromObjectTypeasshownbelow.
Afterclickingonthegeneratebutton,youcanseethemessagereadingObjecttype'ZBAPI_ABY'generatedsuccessfully.NowwearedonewiththecreationofaBAPI.
Stage4:ViewingthecreatedBAPIinBAPIExplorer
Step25:GotoBAPIExplorer(TransactioncodeisBAPI)therewecanfindtheBAPI(ourBAPI).YoucanclickontheAlphabeticaltabsothatyoucanbrowsetheBAPIsinanalphabeticalorder.Findyour
BAPIasshown.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
11/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Stage5:TestyourBAPI
Step26:EnterthenameofyourBAPIinthetransactionSWO1andclickonTest.
Step27:Thebelowscreenisdisplayed.ClickontheExecuteicon(circledinred)againsttheBAPIasshown
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
12/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Step28:Thebelowscreenwillbedisplayedwhereyouwouldrequireenteringthedataagainsttheemptyinputfields.
Step29:YoucouldusetheinputhelpasshownbelowhereIhaveselected0001.Andclicktheexecutebutton.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
13/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Step30:Theresultingscreenisdisplayedbelow,whereyoucansee1Entry(circledinred)againstITEMTAB.Doubleclickon1Entry.
Theresultsasperourinputareasshownbelow.
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
14/15
2/25/2016
AstepbystepguideforbeginnersonuserdefinedBAPIcreationABAPDevelopmentSCNWiki
Bythis,wewouldgetitconfirmedthatourBAPIisworkingproperly.Wecanevencheckitbypassingdifferentvaluesagain.Comebacktotheinputandexecutionscreen.
WearenowdonewiththecreationandsuccessfulexecutionofaBAPI.
standard
ContactUs
Privacy
SAPHelpPortal
TermsofUse
LegalDisclosure
Copyright
http://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creation
template
document
paper
article
FollowSCN
15/15