Skip to end of metadata
Go to start of metadata

 

Summary

This program gives you the list of methods,attributes & events of a class. Class cl_oo_object is used for the main logic in retreiving the details. This class can be used to get the details other than attributes,methods and events.

 Author(s): 

Name: Kesavadas Thekkillath

Company: Atos

 

Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
TYPE-POOLS:ABAP.
*----------------------------------------------------------------------*
*       CLASS lcl_ut DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS LCL_UT DEFINITION.
  PUBLIC SECTION.
    DATA:I_ATTRIB TYPE SEO_ATTRIBUTES,
         I_EVENTS TYPE SEO_EVENTS,
         I_METHODS TYPE SEO_METHODS,
         WF_OBJ TYPE REF TO CL_OO_OBJECT,
         WF_ALV TYPE REF TO CL_SALV_TABLE,
         WF_ROOT TYPE REF TO CX_ROOT.
    METHODS:GET_DETAILS.
    METHODS:DISPLAY.
  PRIVATE SECTION.
    METHODS:GET_ATTRIBUTES CHANGING PT_ATTR TYPE SEO_ATTRIBUTES .
    METHODS:GET_EVENTS CHANGING PT_EVE TYPE SEO_EVENTS.
    METHODS:GET_METHODS CHANGING PT_MET TYPE SEO_METHODS.
    METHODS:SET_PF_STATUS CHANGING  PC_ALV TYPE REF TO CL_SALV_TABLE.
    METHODS:SET_DISP_SETTING CHANGING PC_ALV TYPE REF TO CL_SALV_TABLE.
    METHODS:SET_COLUMNS CHANGING PC_ALV TYPE REF TO CL_SALV_TABLE.
ENDCLASS.                    "lcl_ut DEFINITION
DATA:WF_OBJR TYPE REF TO LCL_UT.
PARAMETERS:PA_CLASS TYPE VSEOCLASS-CLSNAME.
SELECTION-SCREEN SKIP 1.
PARAMETERS:P_ATT RADIOBUTTON GROUP A,
           P_EVE RADIOBUTTON GROUP A,
           P_MET RADIOBUTTON GROUP A.

CREATE OBJECT WF_OBJR.
WF_OBJR->GET_DETAILS( ).
WF_OBJR->DISPLAY( ).
*----------------------------------------------------------------------*
*       CLASS lcl_ut IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS LCL_UT IMPLEMENTATION.
  METHOD DISPLAY.
    FIELD-SYMBOLS:<FS_TAB> TYPE ANY TABLE.
    IF P_ATT = ABAP_TRUE.
      ASSIGN I_ATTRIB TO <FS_TAB>.
    ENDIF.
    IF P_EVE = ABAP_TRUE.
      ASSIGN I_EVENTS TO <FS_TAB>.
    ENDIF.
    IF P_MET = ABAP_TRUE.
      ASSIGN I_METHODS TO <FS_TAB>.
    ENDIF.
    TRY.
        CL_SALV_TABLE=>FACTORY( IMPORTING R_SALV_TABLE = WF_ALV
                                CHANGING  T_TABLE      = <FS_TAB> ).
      CATCH CX_SALV_MSG INTO WF_ROOT.
        PERFORM RAISE_MESSAGE USING WF_ROOT.
    ENDTRY.
    CALL METHOD SET_PF_STATUS
      CHANGING
        PC_ALV = WF_ALV.
    CALL METHOD SET_COLUMNS
      CHANGING
        PC_ALV = WF_ALV.
    CALL METHOD SET_DISP_SETTING
      CHANGING
        PC_ALV = WF_ALV.
    WF_ALV->DISPLAY( ).
  ENDMETHOD.                    "display
  METHOD GET_DETAILS.
    TRY.
        CALL METHOD CL_OO_OBJECT=>GET_INSTANCE
          EXPORTING
            CLSNAME = PA_CLASS
          RECEIVING
            RESULT  = WF_OBJ.
      CATCH CX_CLASS_NOT_EXISTENT INTO WF_ROOT.
        PERFORM RAISE_MESSAGE USING WF_ROOT.
    ENDTRY.
    IF P_ATT = ABAP_TRUE.
      CALL METHOD GET_ATTRIBUTES
        CHANGING
          PT_ATTR = I_ATTRIB.
    ENDIF.
    IF P_EVE = ABAP_TRUE.
      CALL METHOD GET_EVENTS
        CHANGING
          PT_EVE = I_EVENTS.
    ENDIF.
    IF P_MET = ABAP_TRUE.
      CALL METHOD GET_METHODS
        CHANGING
          PT_MET = I_METHODS.
    ENDIF.
  ENDMETHOD.                    "get_details
  METHOD GET_ATTRIBUTES.
    CALL METHOD WF_OBJ->GET_ATTRIBUTES
      EXPORTING
        PUBLIC_ATTRIBUTES_ONLY    = SEOX_FALSE
        INSTANCE_ATTRIBUTES_ONLY  = SEOX_FALSE
        REFERENCE_ATTRIBUTES_ONLY = SEOX_FALSE
      RECEIVING
        RESULT                    = PT_ATTR.
  ENDMETHOD.                    "get_attributes
  METHOD GET_EVENTS.
    CALL METHOD WF_OBJ->GET_EVENTS
      EXPORTING
        PUBLIC_EVENTS_ONLY   = SEOX_FALSE
        INSTANCE_EVENTS_ONLY = SEOX_FALSE
      RECEIVING
        RESULT               = PT_EVE.
  ENDMETHOD.                    "get_events
  METHOD GET_METHODS.
    CALL METHOD WF_OBJ->GET_METHODS
      EXPORTING
        PUBLIC_METHODS_ONLY   = SEOX_FALSE
        INSTANCE_METHODS_ONLY = SEOX_FALSE
      RECEIVING
        RESULT                = PT_MET.
  ENDMETHOD.                    "get_methods
  METHOD SET_PF_STATUS.
    DATA: LF_FUNCTIONS TYPE REF TO CL_SALV_FUNCTIONS_LIST.
    LF_FUNCTIONS = PC_ALV->GET_FUNCTIONS( ).
    LF_FUNCTIONS->SET_ALL( ABAP_TRUE ).
  ENDMETHOD.                    "set_pf_status
  METHOD SET_COLUMNS.
    DATA: LF_COLS TYPE REF TO CL_SALV_COLUMNS.
    DATA: LF_COLUMN TYPE REF TO CL_SALV_COLUMN.
    LF_COLS = PC_ALV->GET_COLUMNS( ).
    LF_COLS->SET_OPTIMIZE( ABAP_TRUE ).
  ENDMETHOD.                    "set_columns
  METHOD SET_DISP_SETTING.
    DATA: LF_DISPLAY TYPE REF TO CL_SALV_DISPLAY_SETTINGS.
    LF_DISPLAY = PC_ALV->GET_DISPLAY_SETTINGS( ).
    LF_DISPLAY->SET_STRIPED_PATTERN( ABAP_TRUE ).
  ENDMETHOD.  "set_columns
ENDCLASS.                    "lcl_ut IMPLEMENTATION
*&---------------------------------------------------------------------*
*&      Form  RAISE_MESSAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_WF_ROOT  text
*----------------------------------------------------------------------*
FORM RAISE_MESSAGE  USING    PU_ROOT TYPE REF TO CX_ROOT.
  CALL FUNCTION 'RSAN_MDL_EXCEPTION_TO_SYMSG'
    EXPORTING
      IR_EXCEPTION = PU_ROOT
      I_MSGTY      = 'E'.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDFORM.                    " RAISE_MESSAGE