cancel
Showing results for 
Search instead for 
Did you mean: 

How to create field symbol in Se24.

amruthaakp1
Explorer
679

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

Sandra_Rossi
Active Contributor

Global field symbols are not possible in class pools. Only local field symbols are allowed.

gabmarian
Active Contributor

Sorry, but this question hardly make any sense. Do you have a local class in a program and you want to convert it to a global class? Create a global class and simply copy-paste the code in source code view.

What does this have to do with field-symbols?

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.