working with constructors (global class)
DESCRIPTION
constructorTRANSCRIPT
9/23/2015 Working with constructors (Global Class)
http://www.saptechnical.com/Tutorials/OOPS/Constructor/Index.htm 1/3
Search
Home • Tra inings • Quiz • Tips • Tutoria ls • Functiona l • Cert Q's • Inte rview Q's • Jobs • Testimonia ls • Adve rtise • Contact Us
SAP Virtual/Onsite Trainings
Document Categories:
ABAPTM
Adobe FormsABAPHRALE & IDocsALVBAPIBASISBSPBusiness Objects Business WorkflowCRM NEWLSMWSAP Script/Smart FormsBI/BWeXchange Infrastructure (XI)Enterprise Portals (EP)eCATTObject Oriented ProgrammingSAP QueryUserexits/BADIsWebDynpro for Java/ABAPTM
Others
What's New?
ABAP Test Cockpit HOTSAP ABAP PragmasUnderstanding SE32 (ABAP TextElement Maintenance)Creating an IDoc File on SAPApplication ServerUnderstanding “Advance withdialog” option of SAP WorkflowSAP Workflow Scenario:Maintenance NotificationApprovalEnhancements to a standardclassWorking with Floating Field inAdobe FormsInserting data from InternalTable into the step “Send Mail”Display GL Account long textusing enhancement frameworkDifferences betweenpolymorphism in JAVA andABAPPassing multiline parametersfrom an ABAP Class event to aWorkflow containerConcept of Reevaluate agentsfor active work items in SAPWorkflowDynamic creation of componentusage in ABAP WebDynproAdobe Forms: Display symbolslike copyright and othersDeactivate Hold functionality inPurchase order (ME21N)Quiz on OOABAPAdd fields in FBL5N using BADIsTutorial on Wide castingDefining a Range in ModulePool ProgramCopy fields from onestructure/table into anotherstructure/tableSide Panel Usage in NWBC
Contribute?
Sample Specs
Working with constructors (Global Class)
By Sravanthi
1. Constructors are special methods that cannot be called using CALL METHOD. Instead, they are calledautomatically by the system to set the starting state of a new object or class.
2. Constructors are methods with a predefined name. To use them, you must declare them explicitly in theclass.
3. There are two types of constructors Instance constructors and Static constructors.
The Instance constructor of a class is the predefined instance method CONSTRUCTOR.
The constructor's signature can have only importing parameters or exceptions.
Instance Constructor is a special instance method can access the Instance Variables and StaticVariables.
This method is used to set the default values in a class.
The Static constructor of a class is the predefined static method CLASS_CONSTRUCTOR.
The constructor's signature cannot have importing parameters or exceptions. The static constructor is as special static method can access the static variables. These are used to set default values for the global attributes irrespective of instances.
Multiple Instance and Static Constructors cannot be used in one class.
Creating the Instance Constructor and Static Constructor using SE24 (Global class)
Step1: Go to SE24 Create Global Class ZCONSTRUCTOR_SALES
Step2: Select the Class and Click on Continue.
Step3: Continue with the default settings
Step4: Go to Methods Create Methods.
9/23/2015 Working with constructors (Global Class)
http://www.saptechnical.com/Tutorials/OOPS/Constructor/Index.htm 2/3
What's Hot?
Web Dynpro for ABAP Tutorials
Join the Mailing List
Enter name and email address below :
Name:
Email:
Subscribe Unsubscribe
GO
Step5: Constructor Method can be created 2 ways.
1) Go to Menu Edit Create Constructor
2) Click on Constructor as shown below
Step6: As soon click on Constructor Constructor Method is automatically defaulted in the Methods.
This method is used o initial the values for the object
Step7: Create another method Select to fetch the data from the VBAK table
Step8: Select the Constructor Method Select the Parameters and Create the Parameter
Step9: The parameter IM_VBELN is used to importing into Constructor Method. Used to initialize the value
Step10: For the Constructor, parameter type is always importing. No other Parameter type can be assigned
9/23/2015 Working with constructors (Global Class)
http://www.saptechnical.com/Tutorials/OOPS/Constructor/Index.htm 3/3
Step11: Go to Type Tab Create Structure ty_vbak and Visibility (Public)
Step12: Click on Direct Type Entry
Step13: To declare the Structure (with required fields) and Table
Click here to continue...
Please send us your feedback/suggestions at [email protected]
Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us
© SAPTechnical.COM. All rights reserved.All product names are trademarks of their respective companies. SAPTechnical.COM is in no way affi l iated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver, and and any other SAP trademarks are registered trademarks of SAP AG in Germany and in several other countries.Every effort is made to ensure content integrity. Use information on this site at your own risk.
Graphic Design by Round the Bend Wizards