cancel
Showing results for 
Search instead for 
Did you mean: 

How to create field symbol in Se24.

amruthaakp1
Explorer
680

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.

View Entire Topic
p244500
Active Contributor
0 Kudos

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.