Você está na página 1de 3

9/23/2015

Workingwithconstructors(GlobalClass)

Search

Hom e Tra i ni ngs Qui z Ti ps Tutori a l s Functi ona l Ce rt Q's I nte rvi e w Q's Jobs Te sti m oni a l s Adve rti se Conta ct Us

SAP Virtual/Onsite Trainings


Document Categories:
ABAP TM
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/ABAP TM
Others

What's New?
ABAPTestCockpitHOT
SAPABAPPragmas
UnderstandingSE32(ABAPText
ElementMaintenance)
Creating an IDoc File on SAP
ApplicationServer
Understanding Advance with
dialogoptionofSAPWorkflow
SAP
Workflow
Scenario:
Maintenance
Notification
Approval
Enhancements to a standard
class
Working with Floating Field in
AdobeForms
Inserting data from Internal
TableintothestepSendMail
Display GL Account long text
usingenhancementframework
Differences
between
polymorphism in JAVA and
ABAP
Passing multiline parameters
from an ABAP Class event to a
Workflowcontainer
Concept of Reevaluate agents
for active work items in SAP
Workflow
Dynamic creation of component
usageinABAPWebDynpro
Adobe Forms: Display symbols
likecopyrightandothers
Deactivate Hold functionality in
Purchaseorder(ME21N)
QuizonOOABAP
AddfieldsinFBL5NusingBADIs
TutorialonWidecasting
Defining a Range in Module
PoolProgram
Copy
fields
from
one
structure/table into another
structure/table
SidePanelUsageinNWBC

Working with constructors (Global Class)


BySravanthi

1.ConstructorsarespecialmethodsthatcannotbecalledusingCALLMETHOD.Instead,theyarecalled
automaticallybythesystemtosetthestartingstateofanewobjectorclass.
2.Constructorsaremethodswithapredefinedname.Tousethem,youmustdeclarethemexplicitlyinthe
class.
3.TherearetwotypesofconstructorsInstanceconstructorsandStaticconstructors.
TheInstanceconstructorofaclassisthepredefinedinstancemethodCONSTRUCTOR.
Theconstructor'ssignaturecanhaveonlyimportingparametersorexceptions.
InstanceConstructorisaspecialinstancemethodcanaccesstheInstance Variables and Static
Variables.
Thismethodisusedtosetthedefaultvaluesinaclass.
TheStaticconstructorofaclassisthepredefinedstaticmethodCLASS_CONSTRUCTOR.
Theconstructor'ssignaturecannothaveimportingparametersorexceptions.
Thestaticconstructorisasspecialstaticmethodcanaccessthestaticvariables.
Theseareusedtosetdefaultvaluesfortheglobalattributesirrespectiveofinstances.
MultipleInstanceandStaticConstructorscannotbeusedinoneclass.
CreatingtheInstanceConstructorandStaticConstructorusingSE24(Globalclass)
Step1:GotoSE24CreateGlobalClassZCONSTRUCTOR_SALES

Step2:SelecttheClassandClickonContinue.

Step3:Continuewiththedefaultsettings

Step4:GotoMethodsCreateMethods.

Contribute?
Sample Specs
http://www.saptechnical.com/Tutorials/OOPS/Constructor/Index.htm

1/3

9/23/2015

Workingwithconstructors(GlobalClass)

What's Hot?
WebDynproforABAPTutorials
JointheMailingList
Enternameandemailaddressbelow :
Name:

Email:

Subscribe

GO

Unsubscribe

Step5:ConstructorMethodcanbecreated2ways.
1)GotoMenuEditCreateConstructor
2)ClickonConstructorasshownbelow

Step6:AssoonclickonConstructorConstructorMethodisautomaticallydefaultedintheMethods.
Thismethodisusedoinitialthevaluesfortheobject

Step7:CreateanothermethodSelecttofetchthedatafromtheVBAKtable

Step8:SelecttheConstructorMethodSelecttheParametersandCreatetheParameter

Step9:TheparameterIM_VBELNisusedtoimportingintoConstructorMethod.Usedtoinitializethevalue

Step10:FortheConstructor,parametertypeisalwaysimporting.NootherParametertypecanbeassigned

http://www.saptechnical.com/Tutorials/OOPS/Constructor/Index.htm

2/3

9/23/2015

Workingwithconstructors(GlobalClass)

Step11:GotoTypeTabCreateStructurety_vbakandVisibility(Public)

Step12:ClickonDirectTypeEntry

Step13:TodeclaretheStructure(withrequiredfields)andTable

Clickheretocontinue...

Pleas es endus yourfeedback/s ugges tions atwebm as ter@SAPTechnical.COM


Hom eContributeAboutUs PrivacyTerm s OfUs eDis claim erSafeCom panies :Advertis eonSAPTechnical.COM|Pos tJobContactUs
SAPTechnical.COM.Allrightsreserved.
Allproductnamesaretrademarksoftheirrespectivecompanies.SAPTechnical.COMisinnowayaffiliatedwithSAPAG.
SAP,SAPR/3,R/3software,mySAP,ABAP,BAPI,xApps,SAPNetWeaver,andandanyotherSAPtrademarksareregisteredtrademarksofSAPAGinGermanyandinseveralothercountries.
Everyeffortismadetoensurecontentintegrity.Useinformationonthissiteatyourownrisk.

GraphicDes ignbyRoundtheBendWizards

http://www.saptechnical.com/Tutorials/OOPS/Constructor/Index.htm

3/3

Você também pode gostar