Sei sulla pagina 1di 4

11/23/2016

SAPTechnical.COMWorkingwithBusinessObjects

Search

Home Trai ni ngs Qui z Ti ps Tutori al s Functi onal Cert Q's I ntervi ew Q's Jobs Testi moni al s Adverti se Contact Us

SAP Virtual/Onsite
Trainings
Document Categories:
ABAPTM
AdobeForms
ABAPHR
ALE&IDocs
ALV
BAPI
BASIS
BSP
BusinessObjects
BusinessWorkflow
CRMNEW
LSMW
SAPScript/SmartForms
BI/BW
eXchangeInfrastructure(XI)
EnterprisePortals(EP)
eCATT
ObjectOrientedProgramming
SAPQuery
Userexits/BADIs
WebDynproforJava/ABAPTM
Others

What's New?
ABAPTestCockpitHOT
SAPABAPPragmas
UnderstandingSE32(ABAPText
ElementMaintenance)
CreatinganIDocFileonSAP
ApplicationServer
UnderstandingAdvancewith
dialogoptionofSAPWorkflow
SAPWorkflowScenario:
MaintenanceNotification
Approval
Enhancementstoastandard
class
WorkingwithFloatingFieldin
AdobeForms
InsertingdatafromInternalTable
intothestepSendMail
DisplayGLAccountlongtext
usingenhancementframework
Differencesbetween
polymorphisminJAVAand
ABAP
Passingmultilineparameters
fromanABAPClasseventtoa
Workflowcontainer
ConceptofReevaluateagents
foractiveworkitemsinSAP
Workflow
Dynamiccreationofcomponent
usageinABAPWebDynpro
AdobeForms:Displaysymbols
likecopyrightandothers
DeactivateHoldfunctionalityin
Purchaseorder(ME21N)
QuizonOOABAP
AddfieldsinFBL5NusingBADIs
TutorialonWidecasting
DefiningaRangeinModulePool
Program
Copyfieldsfromone
structure/tableintoanother
structure/table
SidePanelUsageinNWBC

Retirement
Planning
AreYouPreparedFor
Retirement?EstimateYour
RetirementCorpus.
bigdecisions.com

Working with Business Objects in SAP


BySwetabhShukla,Infosys
Business Object type contains methods, attributes and events which give a component based view of any
BusinessProcess.
For example we have a Purchase Order business process. This process includes various small
functionalities. It will have process of changing Purchase orders based upon requirements, functionality to
retrieve the details of purchase order etc. Each of these functionalities is encapsulated inside a method.
The method can call the function modules present in R3 system or can have there own code to execute
somefunctionality.SoifweconsiderPurchaseOrderasaBusinessObjectthenitwillbeidentifiedbykey
field Purchase Order number. Each purchase order business object based upon key field purchase order
numberisdifferent.Itssobecauseeachpurchaseorderisdifferentandwillcontaindifferentdetails.
So the methods contain business functionality. Attributes are just like properties of the Business object.
ForexampleforanypurchaseorderPurchasingGroup,PurchasingOrganizationetcareattributes.
Technically we can say that business object types are just like any template. At runtime we instantiate or
createruntimeobjectsforanyBO(BusinessObject)typebaseduponthekeyfieldswepass.Tworuntime
BusinessobjectsofsameBOtypearedifferentfromeachotherbaseduponthekeyfieldswepass.Sothe
keyfieldisthedifferentiatingfactorfortwoormoreruntimebusinessobjectsofsameBOtype.
To Browse for BO open tcode SWO2 (Path > Tools >ABAP Workbench>Overview>Business Object
Browser).

Contribute?

Sample Specs
What's Hot?
WebDynproforABAPTutorials

YoucanexpandthenodesandcancheckvariousbusinessobjectsinBOR.YoucandoubleclickontheBO
nodeanditwilltakeyoutoBOdisplay(SWO1).

1 WorkingwithBusinessObjectinourprograms

For creating a Business Object and its attributes there are many already existing tutorials. So in this
tutorialwewillnotdiscusscreationofBOanditsattributes.

JointheMailingList
Enternameandemailaddressbelow:

1.1To create instance of a BO

http://saptechnical.com/Tutorials/Workflow/BusinessObjects/Page1.htm

1/4

11/23/2016

SAPTechnical.COMWorkingwithBusinessObjects
Name:

TocreateaninstanceofBOweneedtohavethekeyfieldsofthatBO.Keyfieldswillbeusedtouniquely
identifytheBO.WecanusetheFM'SWO_CREATE'tocreateaninstanceofBOinanyreportprogram.

Email:
Subscribe

DATA:
i_objtypeTYPEswo_objtyp,
i_objkeyTYPEswo_typeid,
objectTYPEswo_objhnd.

Unsubscribe

GO

i_objtype=<BusinessObject>
i_objkey=<BOkey>
CALLFUNCTION'SWO_CREATE'
EXPORTING
objtype=i_objtype
objkey=i_objkey
IMPORTING
object=object.

Thevariableobjectwillholdruntimeinstanceoftheobjecttype.
Theotherwayistousethemacrosdefinedininclude<cntn01>
INCLUDE<cntn01>.
DATA:
i_objtypeTYPEswo_objtyp,
i_objkeyTYPEswo_typeid,
objectTYPEswc_object.
*CreateinstanceofObjecttype
swc_create_objectobjecti_objtypei_objkey.

Internally the macro calls the FM SWO_CREATE. So you can either go for direct FM call or the macro
call.

1.2Container
Basically the term Container is used with reference to Business Objects and Workflows. The Container
actually holds import and export parameters associated with any method of Business Object at runtime.
When ever we are calling any method of Business Object we need to populate container for import
parametersandafterthemethodgetsexecuteditreturnsthevalues(exportparameters)inContainer.
BusinessObjectcontaineristechnicallyoftypeSWCONTstructure.

Here ELEMENT will be name of the variable/internal table which container holds and VALUE will have
corresponding value. For multi line variable or internal tables, the container will hold multiple values with
sameelementname.

1.2.1Lets take an example to check what Container is


For example lets create a Business Object ZSWE1 with only one method READ. We will discuss the
creationofBOinverybrief.
KeyfieldwillbePurchaseOrdernumber(EKKO_EBELN)forBO.
MethodREADwilltakePurchaseOrdernumberasinputandwillgiveallthePurchaseLineitemsinitinan
internaltable.
Step1:CreateBOZSWE1fortestpurpose.Youcangiveitanyname.

http://saptechnical.com/Tutorials/Workflow/BusinessObjects/Page1.htm

2/4

11/23/2016

SAPTechnical.COMWorkingwithBusinessObjects

Step2:NowcreateamethodREAD

Savethemethod.Nowwewillcreatetheparametersofthemethod.
ImportParameters

PurchaseDocument

EKKOEBELN

ExportParameter

ITEM

EKKOEBELP(multiline)

PurchasingDocumentwillbeaimportparameteroftypeEKKO_EBELN.
ITEMwillbeaexportparameteroftypeEKKO_EBELPandwillbeamultilinevariable(internaltable)

http://saptechnical.com/Tutorials/Workflow/BusinessObjects/Page1.htm

3/4

11/23/2016

SAPTechnical.COMWorkingwithBusinessObjects

Clickheretocontinue...

Retirement
Planning
AreYouPreparedFor
Retirement?EstimateYour
RetirementCorpus.
bigdecisions.com

Pleasesendusyourfeedback/suggestionsatwebmaster@SAPTechnical.COM
HomeContributeAboutUsPrivacyTermsOfUseDisclaimerSafeCompanies:AdvertiseonSAPTechnical.COM|PostJobContactUs
20062007SAPTechnical.COM.Allrightsreserved.
Allproductnamesaretrademarksoftheirrespectivecompanies.SAPTechnical.COMisinnowayaffiliatedwithSAPAG.
SAP,SAPR/3,R/3software,mySAP,ABAP,BAPI,xApps,SAPNetWeaver,andandanyotherSAPtrademarksareregisteredtrademarksofSAPAGinGermanyandinseveralothercountries.
Everyeffortismadetoensurecontentintegrity.Useinformationonthissiteatyourownrisk.

GraphicDesignbyRoundtheBendWizards

http://saptechnical.com/Tutorials/Workflow/BusinessObjects/Page1.htm

4/4

Potrebbero piacerti anche