OOPS ABAP- USER DEFINED TYPES IN CLASS



      USER-DEFINED TYPES IN THE CLASSES

STEPS

        Create a class using Tcode se24  ZCL_METHOD1
        Click on  types tab.
        Define as Ty_mara.

 

 

Save and Activate it.

 
 




       Save and activate, test it.

                   USING THE METHOD IN THE PROGRAM

        DATA: WA_MARA TYPE ZCL_METHOD1 =>TY_MARA
                                                 ""B’coz TY_MARA is a static member.

        DATA: OBJ1 TYPE REF TO ZCL_METHOD1
        Create object OBJ1.

        Parameters: P_MATNR TYPE MARA – MATNR

        CALL METHOD OBJ1 GET_MAT_DET
        Exporting
                IM _MATNR  = P_MATNR
        Importing
                 EX_MARA  =  WA_MARA.

        WRITE:/ WA_MARA – MATNR, WA_MARA – MBRSH, WA_MARA – MTART.
        Save, Activate & Test it .