on 2019 Jul 26 2:56 PM
I want to change a local class to global class. So i need to create a field symbol in global, so please help me how can I achieve this.
Hi,
Convert local class in program to global class
create a field symbol
REPORT z_cl_test .
*---------------------------------------------------------------------*
* CLASS lcl_cl1 DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_cl1 DEFINITION.
PUBLIC SECTION.
DATA cref TYPE REF TO data.
METHODS : constructor IMPORTING i_type TYPE char20,
me1 IMPORTING value TYPE i.
ENDCLASS. "lcl_cl1 DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_cl1 IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_cl1 IMPLEMENTATION.
METHOD constructor.
CREATE DATA cref TYPE (i_type).
ENDMETHOD. "constructor
METHOD me1.
FIELD-SYMBOLS <fs> TYPE any.
ASSIGN cref->* TO <fs>.
WRITE: 'Value is ' ,value.
ASSIGN value TO <fs>.
WRITE: 'Field symbol is ', <fs>.
ENDMETHOD. "me1
ENDCLASS. "lcl_cl1 IMPLEMENTATION
START-OF-SELECTION.
DATA ref_class TYPE REF TO lcl_cl1.
CREATE OBJECT ref_class
EXPORTING
i_type = 'I'.
CALL METHOD ref_class->me1
EXPORTING
value = 3.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.