Download doc - BAPI User Guide

Transcript

BAPI User GuideBAPI User Guide................................................................................................................... 1Introduction........................................................................................................................... 3 Business Framework........................................................................................................ 4 SAP Business Objects..................................................................................................... 6 Business A!ication Pro"rammin" Inter#ace $BAPI%........................................................&Ad'anta"es o# Usin" BAPIs...................................................................................... 1()*aracteristics o# BAPIs............................................................................................ 11Standardi+ed BAPIs.................................................................................................. 13Ser'ice BAPIs #or ,e! Functions.............................................................................1-SAP .n*ancements to BAPIs................................................................................... 1/ BAPIs o# SAP Inter#ace 01es........................................................................................ 1& Business Object 2eositor1........................................................................................... 1&Pro"rammin" wit* BAPIs.................................................................................................... 3( Object4oriented Access to BAPIs.................................................................................... 33 Function4oriented Access to BAPIs................................................................................ 3- Pro"rammin" 5ia!o" A!ications................................................................................... 36 Pro"rammin" 5istributed A!ications............................................................................36 0ransaction 7ode! #or 5e'e!oin" BAPIs.......................................................................3/BAPI 0ransaction 7ode! wit* )ommit.......................................................................3/BAPI 0ransaction 7ode! 8it*out )ommit..................................................................3( 5eterminin" BAPIs o# Business Objects........................................................................33Seci#1in" t*e 9e1 Fie!ds o# t*e Business Object.....................................................33Seci#1in" t*e BAPI Parameters...............................................................................335eterminin" t*e :ame o# t*e Function 7odu!e.........................................................345is!a1in" BAPI 5ocumentation................................................................................34 5eterminin" BAPIs o# Inter#ace 01es............................................................................ 3-Seci#1in" t*e BAPI Parameters...............................................................................3-5is!a1in" BAPI 5ocumentation................................................................................36 .;am!es o# BAPI )a!!s................................................................................................. 36)a!!in" BAPIs #rom 3 S1stems? #or e;am!e? so t*at occasiona! users can access 2>3.0*ese #ront4ends can be im!emented as 8indows4based c!ient a!ications? #or e;am!e? as macros #or deskto a!ications $7icroso#t .;ce! or Access%? w*ic* are usua!!1 written in =isua! Basic #or A!ications or im!emented as a!ications in =isua! Basic? 5)O7 E )omonent Object 7ode! > 5istributed )omonent Object 7ode!2F)E 2emote Function )a!!)O2BA E )ommon Object 2eFuest Broker Arc*itectureIntegrationAccessing Business #$ectsAstheabovegraphicshows) theinterfacela"erseparatesabusinessobect=sdataandtheapplications and technologies that can be used to access it. To the outside) the SAP BusinessObects reveal onl"their interface) whichconsists of a set of clearl"definedmethods.Applications can onl" access the business obect data b" the obect=s methods.AnapplicationprogramthataccessesanSAP BusinessObectanditsdataonl"needstheinformation re!uired to e,ecute the methods. Therefore) an application programmer can workwith the SAP Business Obects and invoke their methods without having to know or considerthe obect=s underl"ing implementation details.The set of methods that is associated with a business obect represents the obect=s behavior.>hen a method is e,ecuted on a business obect) the method can change the obect=s internalstate) that is) the obect=s data. For e,ample) one method that "ou can use on the business obect Employee is to hereas class methods are instance-independent. This section provides an overview ofthe standardi*ed BAP&s and how the" are assigned to method t"pes.BAPIs &or Reading 'ataThefollowingBAP&sprovide"ouwithread-onl"accesstodataintheassociatedbusinessobect;GetList>ith the BAP&GetList"ou can select a range of obect ke" values) for e,ample) compan"codes and material numbers. Method type; 3lass methodsFor more information see Programming 1etEist BAP&s. GetDetailThe BAP& Getetail uses a ke" to retrieve details about an instance 'one specific occurrence(ofabusinessobect andreturnsthisdatatothecallingprogram. Thenthisinformationisreported back to the calling program. Method type; &nstance methodFor more information see Programming 1et2etail BAP&s. GetStatusThe BAP& Get!tatus is used to !uer" the status of an SAP Business Obect) for e,ample) theprocessing status of a sales order. This BAP& is used onl" for displa"ing the status of an obectand does not retrieve full details like the BAP& Getetail. Method type; &nstance methodFor more information see Programming 1etStatus BAP&s.ExistenceCheckThe BAP&E"istenceCheckchecks whether an entr" e,ists for an SAP Business Obect) fore,ample) whether the customer master has been created. Method type; &nstance methodFor more information see Programming :,istence3heck BAP&s. BAPIs &or Creating or C/anging 'ataThe following BAP&s can create) change or delete instances of a business obect;Create or CreateFromData The BAP& Create or Create#romata creates an instance o# an SAP Business Object? #ore;am!e? a urc*ase order. Method type; 3lass methodsFor more information see Programming 3reate BAP&s. ChangeThe BAP&Chan$echanges an e,isting instance of aSAP Business Obect) for e,ample)apurchase order. Method type; &nstance methodFor more information see Programming 3hange BAP&s.Delete and Undelete TheBAP&eletedeletesaninstanceof anSAPBusinessObect fromthedatabase) fore,ample) a purchase order. The BAP& %ndelete removes a deletion flag.Method type; &nstance methodFor more information see Programming 2elete BAP&s. Add3 S1stem? 1ou must t*en ca!! t*is met*od to ass t*e c*an"es to t*e database. +api!ervice..ransactionRollback0*is met*od e;ecutes a 2OAABA)9 8O29 command. 8*en 1ou ca!! BAPIs in 1our ro"ram t*at c*an"e data in t*e 2>3 S1stem? a#terwards 1ou must ca!! t*is met*od to ass t*e c*an"es to t*e database. 0*is works ro'ided t*at t*e BAPI +api!ervice..ransactionCommit *as not a!read1 assed t*e c*an"es to t*e database.BAPIs &or Con%erting Between Internal and E6ternal 'ata Formats !'omain Con%ersion"BAP&sareprogramminginterfaces) not end-user interfaces. For thisreasonaneutral dataformat 'withsome e,ceptions( must be used inBAP&s. Fields inBAP& parameters aredispla"ed in the BAP& interface in the internal format used in the database) not in a formattedform.>hen "ou call a BAP& in "our program) "ou need to use the e,ternal data format) to displa"data on the screen) for e,ample. 9ou can use the following conversion BAP&s to displa" thedata in the re!uired format; +api!ervice.ataConversion,nt/E"t0*is BAPI con'erts data #rom t*e interna! #ormat into t*e reFuired e;terna! #ormat. +api!ervice.ataConversionE"t/,nt0*is BAPI con'erts data #rom t*e e;terna! #ormat into t*e reFuired interna! #ormat.Theseconversionscanonl"becarriedout providedthat) theconversionroutinesfor thedomains underl"ing the data to be converted) are maintained in the ABAP2ictionar".Otherwise the data is returned unconverted. The graphic below shows where conversion BAP&s are used; Con%ersion BAPIsApplicationprogramApplicationprogramGUI GUIBAPI.;terna! data #ormat? #or e;am!e? on t*e screen $GUI%Interna! data #ormatActi%itiesFor details of individual service BAP&s refer to the documentation created in the BO# for theBAP& in !uestion. (AP En/ancements to BAPIsPurposeOnthebasis of SAP#eleasestrateg"andthestrict rulesfor enhancinge,istingBAP&s)application developers can rel" on the stabilit" of BAP& interfaces. :ach enhancement to a released BAP& is carried out ensuring that the s"nta, and contents aredownwardl" compatible. This means that applications programmed with BAP&s in a particular#$% #elease are not affected b" changes to this BAP& in later releases. &f changes that are not downwards compatible need to be made to an e,isting BAP&) a newinterface)thatis)anewadditionalBAP&iscreated. ThisBAP&hasthesamenameof thee,isting BAP& to be replaced but with a number added at the end) for e,ample)CustomerCode.Getetail0.The BAP& to be replaced is marked as e,piring 'obsolete( in the #elease in which the successorBAP& is implemented) but will continue to be supported in the ne,t two functional #eleases.BAPIs t*at are set to Iobso!eteJ in an 2>3 2e!ease are !isted in :ote (1(6644? I)o!!ecti'e :ote #or Obso!ete BAPIs as o# 2e!ease 4.-AJ in t*e On!ine So#tware Ser'ice $OSS% Process FlowThe graphic below illustrates the e,pir" phase of BAP&s; &n this e,ample) the successor BAP&was implemented in #elease -./. The replaced BAP& will therefore be supported in #elease -./'that is) in the correction release in which the successor BAP& was implemented( and in thene,t two functional releases) FF+G and FF@G. &n the following functional release FF%G) thisBAP& will no longer be available. E6pir2 P/ase o& a BAPIReleaseBAPIBusiness#$ectBAPI BAPIBusiness#$ectBAPI BAPI3ewF7 *87 98: F;Suorted unti! F3Suorted as o# 4.(F E #unctiona! 2e!easeF*For further information see :nhancing :,isting BAP&s in BAP& Programming.BAPIs o& (AP Inter&ace 12pesUseFrom #elease -..A BAP&s can also describe interfaces implemented outside the #$% S"stemthat an#$%S"stemcancall ine,ternal s"stems. SuchBAP&s are knownasBAPIs "oroutboundprocessin!. The target s"stemfor the BAP& can be determined through thedistribution model in Application Eink :nabling 'AE:(. BAP&sused for outbound processing aredefinedinthe BusinessObect #epositor" as AP&methods o" #AP Inter"ace ypes. Functionsimplementedoutsidethe#$%S"stemcanbestandardi*edandmadeavailableasBAP&s.Business #$ect Repositor2'e&initionAll SAP Business Obect t"pes and SAP &nterface T"pes and their methods are defined anddescribed in the #$% Business Obect #epositor" 'BO#(. The Business Obect #epositor" wasintroduced in #$% #elease %./) at the same as time as SAP Business Obects and SAP Business>orkflow. Presentl") the BO# is mainl" used b" SAP Business >orkflow. Use>ith the introduction of BAP&s in #$% #elease %.+) the BO# assumed an important new role -it is now the central access point for e,ternal applications to access SAP Business Obects andSAP &nterface T"pes and their BAP&s. The BO# has two essential functions; It de#ines and describes SAP Business Objects and SAP Inter#ace 01es and t*eirBAPIs.I# 1ou are de'e!oin" an a!ication ro"ram? 1ou retrie'e detai!s o# t*e SAP Business Object t1es or SAP Inter#ace 01es? t*eir ke1 #ie!ds and t*eir BAPI met*ods #rom t*e BO2. 0*e BO2 contains a!! t*e in#ormation 1ou need to inte"rate t*e correct object t1e de#initions and BAPI ca!!s into 1our a!ication ro"ram. It creates instances o# SAP Business Objects. 0*e runtime en'ironment o# t*e Business Object 2eositor1 recei'es reFuests #rom c!ient a!ications to create runtime objects and t*en creates t*e re!e'ant object instances. For further informationoncreatingbusiness obects refer tothe documentationon SAPBusiness >orkflow.Programming wit/ BAPIsUse&nthissectionit isassumedthat theapplication"oudevelopedistousethedataheldinbusiness obects in the #$% S"stem and that this data is to be accessed b" calling one or moreBAP&s. 9our application can be as simple or as comple, as "ou like and can include calls forone or more BAP&s.IntegrationBAP&saredefinedintheBusinessObect#epositor"'BO#(asmethodsofSAP BusinessObects or SAP &nterface T"pes and are implemented as function modules. The separation of aBAP& definition from its actual implementation enables "ou to access a BAP& in two wa"s; Kou can ca!! t*e BAPI in t*e BO2 t*rou"* object4oriented met*od ca!!s $see Object4oriented Access to BAPIs%. Kou can make 2F) ca!!s to t*e #unction modu!e on w*ic* t*e BAPI is based $see Function4oriented Access to BAPIs%.The two approaches are illustrated in the graphic below.3 objects and )O7 objects to be seam!ess!1 inte"rated. SAP Business Objects and t*eir BAPIs can be accessed direct!1 #rom )O74based de'e!oment too!s? and t*e ot*er wa1 around? )O7 comonents can be accessed #rom t*e SAP de'e!oment en'ironment.0*e 2>3 5)O7 )omonent )onnector So#tware 5e'e!oment 9it $S59% is s*ied as art o# 2F) S59 #or 8indows :0.#$ectBridge #rom =isua! .d"e =isau! .d"eCs midd!eware roduct IObjectBrid"eJ enab!es automatic access to BAPIs #rom a!! )O2BA 3.(4enab!ed Object 2eFuest Brokers $O2Bs% as we!! as#rom ot*er object4oriented rotoco!s suc* as Acti'eL>5)O7. For #urt*er detai!s see t*e ObjectBrid"e roduct in#ormation.Programming En%ironments'elp/i)Connect &or (AP#rom InriseFor #urt*er detai!s see 5e!*i>)onnect roduct in#ormation.Access Builder &or (AP R)*#rom IB7Access Bui!der #or SAP 2>3 is used to inte"rate BAPIs into IB7Cs de'e!oment en'ironment? =isua! A"e #or ithin the conte,t of the transaction model used to develop BAP&s for #$% #eleases %.+ and-./ a transaction represents one processing step or one logical unit of work 'E0>(. An #$%E0> is all the steps involved in a transaction including updating the database.The whole transaction must be programmed to be stateless.The A3&2 principle applies to transaction models) meaning that transactions are; Atomic8*en a transaction is ca!!ed? database oerations are eit*er #u!!1 e;ecuted or not at a!!. .it*er all re!e'ant data *as to be c*an"ed in t*e database or none at a!!. ConsistentI# a transaction is ca!!ed more t*an once? eac* ca!! must *a'e t*e same resu!t. :o data is imorted t*at ma1 indirect!1 a##ect t*e resu!t. Iso!ated0*ere must be no #unctiona! deendencies between two transactions? one transaction must not a##ect anot*er transaction. 'urab!e)*an"es cannot be re'ersed and transactions cannot be cance!ed. FeaturesThe following sections describe how the transaction model effects BAP& development; &n #elease %.+ the BAP&s themselves e,ecuted the 3O44&T >O#C command) BAP&s hadthe same purpose as an E0> or transaction. To integrate BAP&s into an E0>) the new BAP&sno longer e,ecute 3O44&T >O#C commands as of #elease -./. The outcome is two transaction models;BAP& Transaction 4odel with 3ommit 'as of #elease %.+(BAP& Transaction 4odel >ithout 3ommit 'as of #elease -./( I# a BAPI e;ecutes a )O77I0 8O29 command? t*is must be mentioned in t*e BAPI documentation. 0*is is t*e on!1 wa1 users are ab!e to know t*at t*e BAPI contains a )O77I0 8O29 command.BAPI 1ransaction +odel wit/ CommitUseThe e,ample below of an e,ternal program calling a BAP& to change data in an #$% S"stem)illustrates how the transaction model affects BAP& development in #elease %.+. For e,ample)thiscouldinvolveatransactionimplementedwith6isual Basic. Onl"datafromthe#$%S"stem is to be changed. The#F3connectionislivethewholetimethee,ternal programisloggedontothe#$%S"stem to avoid having to connect and disconnect repeatedl". >hen the #F3 connection isalread" established) an #F3 call does not essentiall" take up an" more 3P0 time than a directcall to the function module from within the #$% S"stem.There is one BAP& call for each transaction in the transaction model supported in %.+. BAP&scan onl" be called s"nchronousl". A BAP& call is essentiall" the call of the underl"ing #F3capable function module.The process flow of the program consists of the following steps below 'see graphic below(;Eog on... Source code3all BAP& to read and$or change data... Source code3all BAP& to read and$or change data... Source codeEog off1ransaction +odel &or Release *87>hat do the terms < and ork and in addition is supposed to be stateless)BAP&s are affected as follows; Initia! state eac* time a BAPI is ca!!edA reeated ca!! o# one BAPI must roduce t*e same resu!t. On!1 data t*at is not a##ected b1 t*e e;ecution o# t*e BAPI? #or e;am!e? )ustomi+in" data? can be bu##ered.For BAPIs t*is means? #or e;am!e? t*at due to transarenc1? Set and Get arameters and t*e "!oba! memor1 s*ou!d not be used.,owe'er? 1ou can kee )ustomi+in" data in a "!oba! memor1 as t*is data remainsunc*an"ed e'en i# transaction ca!!s are reeated. A!! or not*in" rinci!eA database c*an"e? #or e;am!e? creatin" a new sa!es order? must be carried out com!ete!1 or not at a!! $AU8%.0*is is w*1 BAPIs to be im!emented in 3.1 are created wit* inte"rated commit contro!. 0*e )O77I0 8O29 command is a!wa1s in'oked at t*e end o# t*e #unction modu!e o# a BAPI t*at modi#ies data. :o #unctiona! deendenc1 between two BAPIsA BAPI ca!! must not be ne"ati'e!1 a##ected b1 an ear!ier ca!! o# anot*er BAPI. A #o!!ow u ca!! must not resuose an ear!ier ca!!. For t*is reason a!so? 1ou s*ou!dnot use Set and Get arameters in t*e BAPI nor use t*e "!oba! memor1. 7ake sure t*at a )O77I0 8O29 command on!1 de!etes t*e memor1 o# t*e #unction modu!e? and not t*e memor1 o# t*e #unction "rou. 0*e "!oba! data o# t*e #unction "rou remains and cou!d re'ent anot*er BAPI #rom bein" ca!!ed? and t*us imair t*e BAPICs #unctiona! indeendence. Ot*er searate AU8s are not tri""ered0*e ca!! o# a BAPI must not tri""er #urt*er AU8s t*at are indeendent o# t*e BAPI.For t*is reason BAPIs must not contain t*e #o!!owin" commandsG )AAA 02A:SA)0IO: SUB7I0 2.PO20 SUB7I0 2.PO20 A:5 2.0U2:

BAPI 1ransaction +odel 3 S1stem. 3. )*oose .ools +usiness #rame3ork +A1, +ro3ser or enter t*e transaction code BAPI in t*e SAP"ui command #ie!d. 0*e +A1, +ro3ser o# t*e BO2 is dis!a1ed in w*ic* a!! Business Objects wit* BAPIs are dis!a1ed in t*e 2>3 a!ication *ierarc*1. 3. .;and t*e nodes and t*e subordinate nodes o# one o# t*e a!ication comonentsunti! 1ou "et to t*e !e'e! w*ere t*e SAP Business Objects are assi"ned. On!1 t*osebusiness objects #or w*ic* BAPIs *a'e been im!emented are dis!a1ed.4. 0o oen a business object? doub!e4c!ick on it. 0*e nodes 4ey -ields and Methods are dis!a1ed. -. .;and t*e node Methods to dis!a1 a !ist o# t*e BAPIs a'ai!ab!e #or t*e se!ected SAP Business Object t1e. Se!ect t*e in#ormation icon to dis!a1 descritions o# indi'idua! BAPIs.6. .;and t*e node 4ey -ields, to !ist t*e ke1 #ie!ds o# t*e object. Se!ect t*e in#ormation icon to dis!a1 descritions o# indi'idua! ke1 #ie!ds.)*oose %tilities Color 4ey to dis!a1 a descrition o# indi'idua! icons in t*e BAPI Browser. After "ou have found the BAP& "ou want) "ou have to specif" the information "ou have toforward to call the BAP& or function in "our application program.&nformation re!uired is; 0*e1 9e1 Fie!ds o# t*e SAP Business Object 0*e Imort? .;ort and Imort>.;ort Parameters o# t*e BAPI 0*e :ame o# t*e Function 7odu!e? i# 1ou direct 2F) ca!!s to t*e #unction modu!e under!1in" t*e BAPI.Also refer to the 2ocumentation) provided with each BAP&.Once"ouhavegatheredallthenecessar"information) "oucanaddtheBAP&callto"ourapplication code.(peci&2ing t/e Ke2 Fields o& t/e Business #$ectPrerequisitesThe ke" fields of SAP Business Obects specif" the identification structure with which clientprograms can uni!uel" access a specific instance of the obect t"pe.The ke" fields of an SAP Business Obect are re!uired if the BAP& in !uestion is using specificobect t"pe instances.BAP&s can be divided into the following categories according to whether the" access specificobect instances; Instance4deendent BAPIsInstance4deendent BAPIs use seci#ic instances o# an object t1e w*ic* t*e c!ient a!ication must seci#1 in t*e ke1 #ie!ds o# t*e Business Object. An e;am!eo# an instacne4deendent BAPI is CompanyCode.Getetail and w*en used t*e c!ient a!icaiton must seci#1 t*e coman1 code I5? #or e;am!e? Get!A12b(ect56CompanyCode6,6777068. Instance4indeendent BAPIsInstance4indeendent BAPIs do not use seci#ic object instances. 0*e usua!!1 return a !ist o# object instances in tab!es to t*e ca!!in" ro"ram. Instance4indeendent BAPIs are a!so ca!!ed c!ass met*ods. An e;am!e o# t*is BAPI is CompanyCode.GetList? w*ic* returns a !ist o# coman1 codes.Some instance4deendent BAPIs "enerate object instances and reorts back in#ormation on t*e "enerated object instance to t*e ca!!in" a!ication. An e;am!eo# t*is t1e o# BAPI is !ales2rder.Create#romata? w*ic* creates a customer order and reorts back in#ormation to t*e ca!!in" ro"ram.ProcedureTo displa" the ke" fields of an SAP Business Obect) select the Business Obect in the BAP&Browserande,pandthenodeKeyfields,asdescribedin2eterminingBAP&sofBusinessObects.Select the relevant icon in the BAP& Browser to displa"further information about theindividualke"fields. 3hoose%tilitiesColor4eyto dis!a1 adescritiono# indi'idua!icons in t*e BAPI Browser. (peci&2ing t/e BAPI ParametersPrerequisitesOnce "ou have found the BAP& "ou want "ou have to specif" which parameters "ou can ormust declare. BAP&s haveimport$e,port parameters 'table parameters( as well as importparameters and e,port parameters for importing and e,porting data.ProcedureTo displa" the parameters of the BAP&;1. Oen t*e Business Object and t*e node Methods in t*e BAPI Browser? as described in 5is!a1in" BAPIs in t*e BAPI Browser. 3. .;and t*e node #or t*e re!e'ant BAPI and t*en t*e node 1arameters.ResultA list of all the BAP&5s parameters is displa"ed. Select the relevant icon in the BAP& Browser to displa"further information about theindividual parameters. 3hoose%tilitiesColor 4ey to dis!a1 a descrition o# indi'idua!icons in t*e BAPI Browser. 'etermining t/e 3ame o& t/e Function +odulePrerequisites&f "ou want to call the BAP& b" making an #F3 call to the underl"ing function module) "ouhave to know the name of the function module.ProcedureTo determine the name of the function module implementing the BAP&;1. Oen t*e Business Object in t*e BAPI Browser? as described in 5is!a1in" BAPIs in t*e BAPI Browser. 3. Oen t*e node Methods and osition t*e cursor on t*e re!e'ant BAPI.3. 0o dis!a1 t*e BAPI documentation se!ect t*e in#ormation icon. 0*e name o# t*e #unction modu!e is "i'en at t*e start o# t*e documentation. 0*e names o# BAPI #unction modu!es a!wa1s be"in wit* IBAPIJ. 3hoose%tilitiesColor 4eytodis!a1adescritiono# indi'idua! iconsint*eBAPIBrowser. 'ispla2ing t/e Function +odule9ou can displa" the BAP& function module in the Function Builder;1. )*oose .ools A+A1 9orkbench and t*en #unction +uilder. A!ternati'e!1 enter t*e 0ransaction SE37 in t*e SAP"ui command #ie!d. 3. 5is!a1 t*e BAPI #unction modu!e b1 enterin" t*e names o# t*e #unction modu!e in t*e #ie!d #unction module and se!ectin" isplay.'ispla2ing BAPI 'ocumentation2ocumentation describing functionalit" and parameters is provided on each BAP&.To displa" documentation on a particular BAP&;1. Oen t*e Business Object in t*e BAPI Browser? as described in 5is!a1in" BAPIs in t*e BAPI Browser. 3. Oen t*e node Methods and osition t*e cursor on t*e re!e'ant BAPI.3. Se!ect t*e in#ormation icon to dis!a1 t*e documentation on t*e BAPI and its associated arameters.3hoose%tilitiesColor 4eytodis!a1adescritiono# indi'idua! iconsint*eBAPIBrowser. 'etermining BAPIs o& Inter&ace 12pesProcedureSAP &nterface T"pes and their BAP&s are managed in the Business Obect #epositor" 'BO#( ina structure basedonthe #$%Application3omponent hierarch". &ntheBusiness &bjectBuilder "ou can displa" all the SAP &nterface T"pes in the application hierarch" . Follow the steps below;1. Ao" on to t*e 2>3 S1stem. 3. )*oose .ools +usiness #rame3ork +A1, evelopment +usiness 2b(ect +uilder or enter t*e transaction code SWO1 in t*e SAP"ui command #ie!d. 3. Se!ect +usiness 2b(ect Repository.4. In t*e ne;t dia!o" bo; se!ect t*e #i!ter 2ther settin$s.In t*e #ie!d .ype se!ect t*e settin" ,nter-ace and deacti'ate t*e settin" 2b(ect, in t*e #ie!d .ype se!ect t*e settin" 2thers and mark a!! t*e settin"s in t*e #ie!d !tatus. 0*e +usiness 2b(ect Repository +ro3ser is dis!a1ed in w*ic* a!! t*e SAP Inter#ace 01es wit* BAPIs are dis!a1ed in t*e 2>3 a!ication *ierarc*1. -. .;and t*e nodes and t*e subordinate nodes o# one o# t*e a!ication comonentsunti! 1ou "et to t*e !e'e! w*ere t*e SAP Inter#ace 01es are assi"ned.6. 0o oen an SAP Inter#ace 01e? doub!e4c!ick on it. 0*e nodes ,nter-aces, Attributes,Methods and Events are dis!a1ed. 6. .;and t*e node Methods to dis!a1 a !ist o# t*e met*ods a'ai!ab!e #or t*e se!ectedSAP Inter#ace 01e.BAPIs are marked b1 a "reen circ!e ne;t to t*e met*od name.Once "ou have found the BAP& "ou want) "ou should retrieve the information on the BAP&interface which "ou need to implement and use the BAP& 'seeSpecif"ing the BAP&Parameters(. Also use the 2ocumentation) provided with each BAP&.Once "ou have gathered all the necessar" information) "ou can implement the interface and usethe BAP& in "our application program. (peci&2ing t/e BAPI ParametersPrerequisitesOnce "ou have found the BAP& "ou want) "ou have to specif" the optional and mandator"parameters of the BAP& interface. BAP&s have import$e,port parameters 'table parameters( aswell as import parameters and e,port parameters for importing and e,porting data.ProcedureTo displa" the parameters of a BAP&;1. In t*e Business Object 2eositor1 Browser e;and t*e node Methods, as described in 5eterminin" BAPIs o# Business Objects. 3. Position t*e cursor on t*e re!e'ant BAPI and se!ect1arameters'ispla2ing BAPI 'ocumentationFor each BAP& of an interface t"pe) documentation is available describing the BAP&5sparameters and the functionalit" to be implemented. To displa" documentation on a particular BAP&;1. In t*e Business Object 2eositor1 Browser e;and t*e node Methods, as described in 5eterminin" Inter#ace 01e BAPIs. 3. Position t*e cursor on t*e re!e'ant BAPI and c*oose Goto ocumentationE6amples o& BAPI CallsThe following e,amples illustrate how BAP&s are called from different development platforms. 3alling BAP&s from 8ava 3alling BAP&s from 6isual Basic 3alling BAP&s from ABAPCalling BAPIs &rom -a%aThis is an e,ample program for calling a BAP& from the &B4 development platform) AccessBuilder for SAP #$%. 2etailed program e,amples are shipped with the Access Builder for #$%.Access Builder &or (AP R)*//Importing the required classes:import com.sap.rfc.*; import com.sap.rfc.exception.*; import com.ibm.sap.bapi.*;import com.ibm.sap.bapi.generated.*;//Connecting to the R/3 System:static priate I!fc"onnection estab#is$"onnection%&idd#e'areInfoa&idd#e'areInfo(t$ro's )!fc!emoteException*I!fc"onnection a"onnection + n,## ;"onnectInfo a"onnectInfo + n,## ;-serInfo a-serInfo + n,## ;String orbSerer.ame + a&idd#e'areInfo.getOrbSerer.ame%( ;// P#ease ad0,st t$e a#,es 'ritten in -PPE!"ASE 1E22E!S// in t$e #ines be#o' so t$at t$e3 fit to 3o,r needs4// If 3o, don5t 6no' t$e correct a#,es as6 3o,r s3stem // administrator4// After correcting t$ese a#,es 3o, s$o,#d c$ange t$e // 7bAd0,sted8 ariab#e in t$e fo##o'ing #ine// from 9fa#se9 to 9tr,e9.// 2$en 3o, can re:compi#e %90aac Samp#e"ompan3"ode.0aa9( and // re:r,n %90aa Samp#e"ompan3"ode :conn ).I9( t$is samp#e...boo#ean bAd0,sted + tr,e;if %4bAd0,sted( *t$ro' %ne' )!fc!fc"onnectionException %9P#ease ad0,st t$e "onnection:Parameters to 3o,r needs4 %See met$od ;9estab#is$"onnection;9(9((;+!/>n,##= // String [email protected]>.79= // String aAost.ame BO-!AOS2.A&E %e.g. IP: //address(C=// int aS3stem.o BO-! SBS2E&:.-&BE!n,##= // String aDate'a3Aostn,##= // String aDate'a3Sericen,##= // String aS3stem.amen,##= // String aDro,p.amen,##= // String a&sgSererfa#se= // Boo#ean is1oadBa#ancingtr,e(; // Boo#ean is"$ec6A,t$oriEation//User information:a-serInfo + ne' -serInfo % 9&-S2E!9= // String a-ser.ame=BO-! -SE!I?9I?ES9= // String aPass'ord=BO-! PASSWO!?9FCC9= // String a"#ient= BO-! "1IE.2 .-&BE!9e9=// String a1ang,age= BO-! P!EGE!!E? //1A.D-ADE11C3(; // int a"odePage BO-! !EH-I!E? "O?EPADE//Technical conversion for the selected middleware// !pen connection:I!fc"onnectionGactor3 a"onnectionGactor3 +Gactor3&anager.getSing#eInstance%(.get!fc"onnectionGactor3%( ;a"onnection + a"onnectionGactor3.create!fc"onnection%a"onnectInfo=a-serInfo( ;a"onnection.open%( ; //!et,rning t$e connectionIret,rn a"onnection ; 1IME Str,ct,re1:Gie#d> Import Gie#dParameter3 1IME Str,ct,re> Export Str,ct,reParameterQ 1IME Str,ct,re>:Gie#d3 Export Gie#dParameterP 1IME Str,ct,re3 Imp/Ex. tab#e....ER2E.SIO.1 1IME 7"ontainer str,ct,re8Import Str,ct,reER2E.SIO.> 1IME 7"ontainer Str,ct,re8Imp/Ex. tab#e...Program code G,nction BAPIN7Ob0ect8N7&et$od8...GormParam + Parameter1...Gorm2ab#e + ParameterP...Parameter3+ 5"ontent5..."A11 "-S2O&E!:G-."2IO. T7t$ree digit n,mber8U%Interface as aboe(....endf,nctionFunction +odule 3ameThe customer-specific function is called using the command 3AEE 30STO4:#-F0A3T&OA.This function module must have the naming convention:D&TIJmodule pool nameKIJthree digit numberK.(pecial User E6itsThese are standardi*ed enhancements to BAP& interfaces for which customers do not have tochange the program code. &n this case the container parameter for the data transfer has thenaming convention;E"tension&name)) where &Name) describes the t"pe of enhancement. For e;am!e? t*e container arameter E"tension2rder cou!d be used in t*e 0ab!e !ALE! $sa!es order master data% o# t*e associated BAPI #or t*e customer I:)AU5. C,;!ALE!. Furt/er In&ormationFor further information see 2efining 0ser :,its in BAP&s in BAP& Programming.The standard rules for user e,its appl" and maintenance with Transaction S&O? 'SAP internaldevelopment(and"&O?'customerdevelopment(.#eferalsoto the documentationonSAP:nhancement 4anagement 'S&O?( and to B3 - :nhancing the SAP Standard '"&O?(.Customer En/ancementsPurpose3ustomers can modif" an e,isting BAP& or develop their own BAP&s) if re!uired. Process FlowBefore "ou decide to modif" an SAP BAP&) familiari*e "ourself with the general procedure formaking customer enhancements to the SAP standard s"stem. For more information refer to thedocumentB3- :nhancements to the SAPStandard. For further information see also4.-. In t*e #ie!d Name, enter t*e name o# t*e modi#ied #unction modu!e.6. Sa'e 1our entries.'e&ining t/e 'elegation Relations/ip Between #$ect 12pe !(upert2pe" and (ut2peTo define the delegation relationship between the supert"pe and subt"pe;1. )*oose .ools +usiness #rame3ork +A1, evelopment +usiness 2b(ect +uilder or enter t*e transaction code SWO1.3. )*oose !ettin$s ele$ate !ystem'3ide. 3. Switc* to t*e c*an"e mode and se!ect Ne3 entries. 4. .nter t*e name o# t*e ori"ina! object t1e $suert1e% in t*e #ie!d 2b(ect type and t*e name o# t*e subobject t1e in t*e #ie!d ele$ation type. 5eacti'ate t*e c*eck bo; G%,'speci-ic. -. Sa'e 1our entries. For further informationoncreatingbusiness obects refer tothe documentationon SAPBusiness >orkflow.I# "!oba! data is de#ined or #orm routines are ca!!ed in t*e #unction "rou associated wit* a BAPI #unction modu!e? 1ou ma1 *a'e to a!so co1 t*ese data dec!arations and #orm routines to ensure 1our co1 o# t*e BAPI can be e;ecuted.0*e BAPI Material.GetList #or t*e Business Object Material s*ou!d contain additiona! arameters. 0*e #unction modu!e associated wit* t*is BAPI is +A1,;MA.ER,AL;GE.L,!..)ustomers s*ou!d #irst create a sub4t1e BAPI 8i+ard. 0*is met*od is associated wit* t*e #unction modu!e


Recommended