ALV Using Factory Methods using OOABAP

Developing ALV reports using object oriented factory methods, example ALV report using factory methods

+ -

ALV Factory Methods:

After ALV with Function Modules, Object Oriented Concepts with custom container (CL_GUI_ALV_GRID), SAP introduces one more ALV programming model with Object Oriented concepts, the main purpose of this ALV model is to reduce developer time and at the same time providing maximum possible user specific functionality by using object oriented methodologies.

Follow below steps to develop a simple ALV

Step1: Data decelerations for required internal tables and work areas, get data from data base.

REPORT ZSAPN_ALV_MARA_FACTARY.
DATA : IT_MARA TYPE TABLE OF MARA,
       WA_MARA TYPE MARA.
DATA : LR_ALV TYPE REF TO CL_SALV_TABLE.
SELECT * FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS.

Step2: Call static method FACTORY of class CL_SALV_TABLE, to get table instance with data.

*  TRY.
CALL METHOD CL_SALV_TABLE=>FACTORY "get SALV factory instance
*    EXPORTING
*      LIST_DISPLAY   = IF_SALV_C_BOOL_SAP=>FALSE
*      R_CONTAINER    =
*      CONTAINER_NAME =
  IMPORTING
    R_SALV_TABLE = LR_ALV
  CHANGING
    T_TABLE      = IT_MARA.
*   CATCH CX_SALV_MSG .
*  ENDTRY.

Step3: Call method 'Display' to display ALV.

LR_ALV->DISPLAY( ). "display grid

Learner Questions


No Questions by learners, be first one to ask ..!!

    Please Sign in to ask a question

    Was this lesson helpful to you? Yes No 51 People out of 57 think this lesson helpful


    Lesson Navigation

    Developing ALV using OOABAP ← Previous Lesson
    Next Chapter →