0% found this document useful (0 votes)
51 views

Instance Constructors Can Have Import Parameters. - SAPTech

Instance constructors can have import parameters to which values are passed during object creation using the CREATE OBJECT statement. This allows the constructor to initialize the object. The example shows a class with a constructor that imports a date parameter, and an object of that class is created and the constructor displays the passed date value.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Instance Constructors Can Have Import Parameters. - SAPTech

Instance constructors can have import parameters to which values are passed during object creation using the CREATE OBJECT statement. This allows the constructor to initialize the object. The example shows a class with a constructor that imports a date parameter, and an object of that class is created and the constructor displays the passed date value.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

4/13/23, 12:33 PM Instance constructors can have import parameters.

| SAPTech

Instance constructors can have import parameters.


 Values to them are passed at the time of CREATE OBJECT
statement to create object from the class containing the
constructor.

REPORT ZINSTA_CONST_OOPS.
class lcl_inst DEFINITION.
  PUBLIC SECTION.
  METHODS constructor IMPORTING today TYPE d.
ENDCLASS.
*&------------------------------------------------------------
---------*
*&       Class (Implementation)  lcl_inst
*&------------------------------------------------------------
---------*
*        Text
*-------------------------------------------------------------
---------*
CLASS lcl_inst IMPLEMENTATION.
METHOD constructor.
  write : / 'Today Is: ', today DD/MM/YYYY.
ENDMETHOD.
ENDCLASS.               "lcl_inst

START-OF-SELECTION.
DATA: obj1 TYPE REF TO lcl_inst.
CREATE OBJECT obj1 EXPORTING today = sy-datum.

Output : Today Is:  19.03.2017


Facebook Page [https://www.facebook.com/mySAPTech/]

Posted 19th March 2017 by Blogger

0 Add a comment

https://mysapnuts.blogspot.com/2017/03/instance-constructors-can-have-import.html?view=sidebar 1/2
4/13/23, 12:33 PM Instance constructors can have import parameters. | SAPTech

To leave a comment, click the button below to sign in with


Google.

SIGN IN WITH GOOGLE

https://mysapnuts.blogspot.com/2017/03/instance-constructors-can-have-import.html?view=sidebar 2/2

You might also like