Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Refer class attributes defination inside program.

Former Member
0 Likes
390

Hi,

I am bit confused about accessing or referring class attributes definition in program..

for example.

below is my first class in that i have declared table type and internal table.

PUBLIC
  FINAL
  CREATE PUBLIC .
  PUBLIC SECTION.

    TYPES : BEGIN OF LTY_BOM_LIST,
              EQUNR TYPE C LENGTH 18,
              STLNR TYPE C LENGTH 8,
              EQKTX TYPE C LENGTH 40,
              IWERK TYPE C LENGTH 4,
              SWERK TYPE C LENGTH 4,
            END OF LTY_BOM_LIST.
    DATA :  LT_BOM_LIST TYPE STANDARD TABLE OF LTY_BOM_LIST.

In program suppose i need to declare another internal table with same type which is declared in class.

Any suggestion?

-Amit

1 ACCEPTED SOLUTION
Read only

Hvshal4u
Active Participant
0 Likes
361

Hi You use the below code  if y:

DATA : itab TYPE TABLE OF <class_name>=><type_name>


e.g.

CLASS lcl_test DEFINITION.

   PUBLIC SECTION.

     TYPES : BEGIN OF ty_lcl,

               matnr TYPE matnr,

             END OF ty_lcl.

     DATA : it_mara TYPE TABLE OF ty_lcl.

ENDCLASS.

START-OF-SELECTION.

DATA : itab TYPE TABLE OF lcl_test=>ty_lcl. " declaration

Thanks & Regards-

Vishal

1 REPLY 1
Read only

Hvshal4u
Active Participant
0 Likes
362

Hi You use the below code  if y:

DATA : itab TYPE TABLE OF <class_name>=><type_name>


e.g.

CLASS lcl_test DEFINITION.

   PUBLIC SECTION.

     TYPES : BEGIN OF ty_lcl,

               matnr TYPE matnr,

             END OF ty_lcl.

     DATA : it_mara TYPE TABLE OF ty_lcl.

ENDCLASS.

START-OF-SELECTION.

DATA : itab TYPE TABLE OF lcl_test=>ty_lcl. " declaration

Thanks & Regards-

Vishal