Saturday, 19 August 2017

Use of ALV Field Catalog to calculate TOTAL of a particular field and setting the the total text by the layout property

 This post shows how to calculate the total of a field by using the field catalog property and setting the total text by the layout property.

REPORT  ZAVI_FEVER2.

TYPE-POOLSSLIS.

DATAIT_SPFLI TYPE TABLE OF SPFLI,
      WA_SPFLI TYPE SPFLI.
DATAIT_FCAT TYPE  SLIS_T_FIELDCAT_ALV,
      WA_FCAT TYPE  SLIS_FIELDCAT_ALV.

DATAWA_LAYOUT TYPE SLIS_LAYOUT_ALV.
SELECT FROM SPFLI INTO TABLE IT_SPFLI .



  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
   EXPORTING
     I_PROGRAM_NAME               'SY-REPID'
*     I_INTERNAL_TABNAME           =
     I_STRUCTURE_NAME             'SPFLI'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
*     I_INCLNAME                   =
*     I_BYPASSING_BUFFER           =
*     I_BUFFER_ACTIVE              =
    CHANGING
      ct_fieldcat                  IT_FCAT
   EXCEPTIONS
     INCONSISTENT_INTERFACE       1
     PROGRAM_ERROR                2
     OTHERS                       3
            .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.


LOOP AT IT_FCAT INTO WA_FCAT.
  IF WA_FCAT-FIELDNAME 'DISTANCE'.
    WA_FCAT-DO_SUM 'X'.
    MODIFY IT_FCAT FROM WA_FCAT TRANSPORTING DO_SUM.
    ENDIF.
    ENDLOOP.

    WA_LAYOUT-TOTALS_TEXT 'TOTAL'.

 CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
*    I_INTERFACE_CHECK              = ' '
*    I_BYPASSING_BUFFER             =
*    I_BUFFER_ACTIVE                = ' '
    I_CALLBACK_PROGRAM             'SY-REPID'
*    I_CALLBACK_PF_STATUS_SET       = ' '
*    I_CALLBACK_USER_COMMAND        = ' '
    I_STRUCTURE_NAME               'SPFLI'
    IS_LAYOUT                      WA_LAYOUT
    IT_FIELDCAT                    IT_FCAT
*    IT_EXCLUDING                   =
*    IT_SPECIAL_GROUPS              =
*    IT_SORT                        =
*    IT_FILTER                      =
*    IS_SEL_HIDE                    =
*    I_DEFAULT                      = 'X'
*    I_SAVE                         = ' '
*    IS_VARIANT                     =
*    IT_EVENTS                      =
*    IT_EVENT_EXIT                  =
*    IS_PRINT                       =
*    IS_REPREP_ID                   =
*    I_SCREEN_START_COLUMN          = 0
*    I_SCREEN_START_LINE            = 0
*    I_SCREEN_END_COLUMN            = 0
*    I_SCREEN_END_LINE              = 0
*    IR_SALV_LIST_ADAPTER           =
*    IT_EXCEPT_QINFO                =
*    I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
*  IMPORTING
*    E_EXIT_CAUSED_BY_CALLER        =
*    ES_EXIT_CAUSED_BY_USER         =
   TABLES
     t_outtab                       IT_SPFLI
  EXCEPTIONS
    PROGRAM_ERROR                  1
    OTHERS                         2
           .
 IF sy-subrc <> 0.
* Implement suitable error handling here
 ENDIF.

Use of ALV LAYOUT- Displaying multiple ALV output by setting the layout property

This post shows how to displayed more than one list alv ( not blocked alv) in one program output by setting the ALV layout property.

REPORT  ZAVI_FEVER1.

TYPE-POOLSSLIS.
TYPESBEGIN OF ST_MAKT,
       MATNR TYPE MATNR,
       SPRAS  TYPE SPRAS,
       MAKTX  TYPE MAKTX,
       END OF ST_MAKT.

DATAIT_MAKT TYPE STANDARD TABLE OF ST_MAKT,
      WA_MAKT TYPE ST_MAKT.

TYPESBEGIN OF ST_FINAL,
        CHECK(1),
        MATNR TYPE MATNR,
        SPRAS  TYPE SPRAS,
        MAKTX  TYPE MAKTX,
        END OF ST_FINAL.

DATAIT_FINAL TYPE STANDARD TABLE OF ST_FINAL,
      WA_FINAL TYPE ST_FINAL.

DATAIT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FCAT TYPE SLIS_FIELDCAT_ALV.

DATAWA_LAYOUT TYPE SLIS_LAYOUT_ALV.


START-OF-SELECTION.

       SELECT MATNR
              SPRAS
              MAKTX
              FROM MAKT INTO TABLE IT_MAKT WHERE SPRAS 'SY-LANGU'.

       IF SY-SUBRC 0.
         SORT IT_MAKT BY MATNR.
       ENDIF.

END-OF-SELECTION.

       LOOP AT IT_MAKT INTO WA_MAKT.
         WA_FINAL-MATNR WA_MAKT-MATNR.
         WA_FINAL-SPRAS WA_MAKT-SPRAS.
         WA_FINAL-MAKTX WA_MAKT-MAKTX.
         APPEND WA_FINAL TO IT_FINAL.
         CLEARWA_FINAL,WA_MAKT.
         ENDLOOP.


WA_LAYOUT-list_append 'X'.
WA_LAYOUT-f2code '&ETA'.
WA_FCAT-COL_POS '1'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'CHECK'.
WA_FCAT-CHECKBOX 'X'.
WA_FCAT-EDIT 'X'.
WA_FCAT-SELTEXT_M 'CHECKBOX'.
WA_FCAT-INPUT 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

*WA_LAYOUT-LIGHTS_FIELDNAME = 'LIGHT'.
WA_layout-window_titlebar 'ZAVI_TITLE CHANGE USING PROGRAM'.
WA_FCAT-COL_POS '2'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'MATNR'.
WA_FCAT-INPUT 'X'.
WA_FCAT-SELTEXT_M 'MATERIAL NUMBER'.
WA_LAYOUT-ZEBRA 'X'.
*WA_LAYOUT-NO_COLHEAD = 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_LAYOUT-DETAIL_POPUP 'X'.
WA_FCAT-COL_POS '3'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'SPRAS'.
WA_FCAT-INPUT 'X'.
WA_FCAT-SELTEXT_M 'LANGUAGE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS '4'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'MAKTX'.

WA_FCAT-SELTEXT_M 'MTERIAL DESCRIPTION'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
   I_CALLBACK_PROGRAM             'SY-REPID'
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
*   I_STRUCTURE_NAME               =
   IS_LAYOUT                      WA_LAYOUT
   IT_FIELDCAT                    IT_FCAT
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
  TABLES
    t_outtab                       IT_FINAL
 EXCEPTIONS
   PROGRAM_ERROR                  1
   OTHERS                         2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
   I_CALLBACK_PROGRAM             'SY-REPID'
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
*   I_STRUCTURE_NAME               =
   IS_LAYOUT                      WA_LAYOUT
   IT_FIELDCAT                    IT_FCAT
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
  TABLES
    t_outtab                       IT_FINAL
 EXCEPTIONS
   PROGRAM_ERROR                  1
   OTHERS                         2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

Use of ALV LAYOUT- Setting the program title using alv layout property

This post shows how to set the program title by the alv layout property set.

REPORT  ZAVI_FEVER1.

TYPE-POOLSSLIS.
TYPESBEGIN OF ST_MAKT,
       MATNR TYPE MATNR,
       SPRAS  TYPE SPRAS,
       MAKTX  TYPE MAKTX,
       END OF ST_MAKT.

DATAIT_MAKT TYPE STANDARD TABLE OF ST_MAKT,
      WA_MAKT TYPE ST_MAKT.

TYPESBEGIN OF ST_FINAL,
        CHECK(1),
        MATNR TYPE MATNR,
        SPRAS  TYPE SPRAS,
        MAKTX  TYPE MAKTX,
        END OF ST_FINAL.

DATAIT_FINAL TYPE STANDARD TABLE OF ST_FINAL,
      WA_FINAL TYPE ST_FINAL.

DATAIT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FCAT TYPE SLIS_FIELDCAT_ALV.

DATAWA_LAYOUT TYPE SLIS_LAYOUT_ALV.



START-OF-SELECTION.

       SELECT MATNR
              SPRAS
              MAKTX
              FROM MAKT INTO TABLE IT_MAKT WHERE SPRAS 'SY-LANGU'.

       IF SY-SUBRC 0.
         SORT IT_MAKT BY MATNR.
       ENDIF.

END-OF-SELECTION.

       LOOP AT IT_MAKT INTO WA_MAKT.
         WA_FINAL-MATNR WA_MAKT-MATNR.
         WA_FINAL-SPRAS WA_MAKT-SPRAS.
         WA_FINAL-MAKTX WA_MAKT-MAKTX.
         APPEND WA_FINAL TO IT_FINAL.
         CLEARWA_FINAL,WA_MAKT.
         ENDLOOP.


WA_LAYOUT-f2code '&ETA'.
WA_FCAT-COL_POS '1'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'CHECK'.
WA_FCAT-CHECKBOX 'X'.
WA_FCAT-EDIT 'X'.
WA_FCAT-SELTEXT_M 'CHECKBOX'.
WA_FCAT-INPUT 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

*WA_LAYOUT-LIGHTS_FIELDNAME = 'LIGHT'.
WA_layout-window_titlebar 'ZAVI_TITLE CHANGE USING PROGRAM'.
WA_FCAT-COL_POS '2'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'MATNR'.
WA_FCAT-INPUT 'X'.
WA_FCAT-SELTEXT_M 'MATERIAL NUMBER'.
WA_LAYOUT-ZEBRA 'X'.
*WA_LAYOUT-NO_COLHEAD = 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_LAYOUT-DETAIL_POPUP 'X'.
WA_FCAT-COL_POS '3'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'SPRAS'.
WA_FCAT-INPUT 'X'.
WA_FCAT-SELTEXT_M 'LANGUAGE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS '4'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'MAKTX'.

WA_FCAT-SELTEXT_M 'MTERIAL DESCRIPTION'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
   I_CALLBACK_PROGRAM             'SY-REPID'
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
*   I_STRUCTURE_NAME               =
   IS_LAYOUT                      WA_LAYOUT
   IT_FIELDCAT                    IT_FCAT
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
  TABLES
    t_outtab                       IT_FINAL
 EXCEPTIONS
   PROGRAM_ERROR                  1
   OTHERS                         2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

Use of ALV LAYOUT- Displaying detailed information in a pop up screen

t is quite possible in list alv to display the detailed information not in a different screen but in a pop up screen by setting the layout property.


Code Snippet: The detailed information appears in a new popup window.

REPORT  ZAVI_FEVER1.

TYPE-POOLSSLIS.
TYPESBEGIN OF ST_MAKT,
       MATNR TYPE MATNR,
       SPRAS  TYPE SPRAS,
       MAKTX  TYPE MAKTX,
       END OF ST_MAKT.

DATAIT_MAKT TYPE STANDARD TABLE OF ST_MAKT,
      WA_MAKT TYPE ST_MAKT.

TYPESBEGIN OF ST_FINAL,
        LIGHT(1),
        CHECK(1),
        MATNR TYPE MATNR,
        SPRAS  TYPE SPRAS,
        MAKTX  TYPE MAKTX,
        END OF ST_FINAL.

DATAIT_FINAL TYPE STANDARD TABLE OF ST_FINAL,
      WA_FINAL TYPE ST_FINAL.

DATAIT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FCAT TYPE SLIS_FIELDCAT_ALV.

DATAWA_LAYOUT TYPE SLIS_LAYOUT_ALV.


START-OF-SELECTION.

       SELECT MATNR
              SPRAS
              MAKTX
              FROM MAKT INTO TABLE IT_MAKT WHERE SPRAS 'SY-LANGU'.

       IF SY-SUBRC 0.
         SORT IT_MAKT BY MATNR.
       ENDIF.

END-OF-SELECTION.

       LOOP AT IT_MAKT INTO WA_MAKT.
         WA_FINAL-MATNR WA_MAKT-MATNR.
         WA_FINAL-SPRAS WA_MAKT-SPRAS.
         WA_FINAL-MAKTX WA_MAKT-MAKTX.
         APPEND WA_FINAL TO IT_FINAL.
         CLEARWA_FINAL,WA_MAKT.
         ENDLOOP.


WA_FCAT-COL_POS '1'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'CHECK'.
WA_FCAT-CHECKBOX 'X'.
WA_FCAT-EDIT 'X'.
WA_FCAT-SELTEXT_M 'CHECKBOX'.
WA_FCAT-INPUT 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

*WA_LAYOUT-LIGHTS_FIELDNAME = 'LIGHT'.
WA_FCAT-COL_POS '2'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'MATNR'.
WA_FCAT-INPUT 'X'.
WA_FCAT-SELTEXT_M 'MATERIAL NUMBER'.
WA_LAYOUT-ZEBRA 'X'.
*WA_LAYOUT-NO_COLHEAD = 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_LAYOUT-DETAIL_POPUP 'X'.
WA_FCAT-COL_POS '3'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'SPRAS'.
WA_FCAT-INPUT 'X'.
WA_FCAT-SELTEXT_M 'LANGUAGE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS '4'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'MAKTX'.

WA_FCAT-SELTEXT_M 'MTERIAL DESCRIPTION'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
   I_CALLBACK_PROGRAM             'SY-REPID'
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
*   I_STRUCTURE_NAME               =
   IS_LAYOUT                      WA_LAYOUT
   IT_FIELDCAT                    IT_FCAT
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
  TABLES
    t_outtab                       IT_FINAL
 EXCEPTIONS
   PROGRAM_ERROR                  1
   OTHERS                         2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

Use of ALV LAYOUT- Displaying Traffic Light



This post shows how to display traffic light by setting the layout property.


REPORT  ZAVI_FEVER1.

TYPE-POOLSSLIS.
TYPESBEGIN OF ST_MAKT,
       MATNR TYPE MATNR,
       SPRAS  TYPE SPRAS,
       MAKTX  TYPE MAKTX,
       END OF ST_MAKT.

DATAIT_MAKT TYPE STANDARD TABLE OF ST_MAKT,
      WA_MAKT TYPE ST_MAKT.

TYPESBEGIN OF ST_FINAL,
        LIGHT(1),
        CHECK(1),
        MATNR TYPE MATNR,
        SPRAS  TYPE SPRAS,
        MAKTX  TYPE MAKTX,
        END OF ST_FINAL.

DATAIT_FINAL TYPE STANDARD TABLE OF ST_FINAL,
      WA_FINAL TYPE ST_FINAL.

DATAIT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FCAT TYPE SLIS_FIELDCAT_ALV.

DATAWA_LAYOUT TYPE SLIS_LAYOUT_ALV.



START-OF-SELECTION.

       SELECT MATNR
              SPRAS
              MAKTX
              FROM MAKT INTO TABLE IT_MAKT WHERE SPRAS 'SY-LANGU'.

       IF SY-SUBRC 0.
         SORT IT_MAKT BY MATNR.
       ENDIF.

END-OF-SELECTION.

       LOOP AT IT_MAKT INTO WA_MAKT.
         WA_FINAL-MATNR WA_MAKT-MATNR.
         WA_FINAL-SPRAS WA_MAKT-SPRAS.
         WA_FINAL-MAKTX WA_MAKT-MAKTX.
         APPEND WA_FINAL TO IT_FINAL.
         CLEARWA_FINAL,WA_MAKT.
         ENDLOOP.


         LOOP AT IT_FINAL INTO WA_FINAL.
           IF SY-TABIX < 5.
WA_FINAL-light 1.
ELSEIF sy-tabix > AND sy-tabix LE 15.
WA_FINAL-light 2
ELSE.
WA_FINAL-light 3
ENDIF.
MODIFY IT_FINAL FROM WA_FINAL TRANSPORTING light.
ENDLOOP.


IF R1 'X'.

WA_FCAT-COL_POS '1'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'CHECK'.
WA_FCAT-CHECKBOX 'X'.
WA_FCAT-EDIT 'X'.
WA_FCAT-SELTEXT_M 'CHECKBOX'.
WA_FCAT-INPUT 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_LAYOUT-LIGHTS_FIELDNAME 'LIGHT'.
WA_FCAT-COL_POS '2'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'MATNR'.
WA_FCAT-INPUT 'X'.
WA_FCAT-SELTEXT_M 'MATERIAL NUMBER'.
WA_LAYOUT-ZEBRA 'X'.
*WA_LAYOUT-NO_COLHEAD = 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS '3'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'SPRAS'.
WA_FCAT-INPUT 'X'.
WA_FCAT-SELTEXT_M 'LANGUAGE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS '4'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'MAKTX'.

WA_FCAT-SELTEXT_M 'MTERIAL DESCRIPTION'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
   I_CALLBACK_PROGRAM             'SY-REPID'
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
*   I_STRUCTURE_NAME               =
   IS_LAYOUT                      WA_LAYOUT
   IT_FIELDCAT                    IT_FCAT
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
  TABLES
    t_outtab                       IT_FINAL
 EXCEPTIONS
   PROGRAM_ERROR                  1
   OTHERS                         2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

Use of ALV LAYOUT- Hiding column header text

REPORT  ZAVI_FEVER1.

TYPE-POOLSSLIS.
TYPESBEGIN OF ST_MAKT,
       MATNR TYPE MATNR,
       SPRAS  TYPE SPRAS,
       MAKTX  TYPE MAKTX,
       END OF ST_MAKT.

DATAIT_MAKT TYPE STANDARD TABLE OF ST_MAKT,
      WA_MAKT TYPE ST_MAKT.

TYPESBEGIN OF ST_FINAL,
       CHECK(1),
        MATNR TYPE MATNR,
        SPRAS  TYPE SPRAS,
        MAKTX  TYPE MAKTX,
        END OF ST_FINAL.

DATAIT_FINAL TYPE STANDARD TABLE OF ST_FINAL,
      WA_FINAL TYPE ST_FINAL.

DATAIT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FCAT TYPE SLIS_FIELDCAT_ALV.

DATAWA_LAYOUT TYPE SLIS_LAYOUT_ALV.

START-OF-SELECTION.

       SELECT MATNR
              SPRAS
              MAKTX
              FROM MAKT INTO TABLE IT_MAKT WHERE SPRAS 'SY-LANGU'.

       IF SY-SUBRC 0.
         SORT IT_MAKT BY MATNR.
       ENDIF.
END-OF-SELECTION.
       LOOP AT IT_MAKT INTO WA_MAKT.
         WA_FINAL-MATNR WA_MAKT-MATNR.
         WA_FINAL-SPRAS WA_MAKT-SPRAS.
         WA_FINAL-MAKTX WA_MAKT-MAKTX.
         APPEND WA_FINAL TO IT_FINAL.
         CLEARWA_FINAL,WA_MAKT.
         ENDLOOP.

IF R1 'X'.

WA_FCAT-COL_POS '1'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'CHECK'.
WA_FCAT-CHECKBOX 'X'.
WA_FCAT-EDIT 'X'.
WA_FCAT-SELTEXT_M 'CHECKBOX'.
WA_FCAT-INPUT 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS '2'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'MATNR'.
WA_FCAT-INPUT 'X'.
WA_FCAT-SELTEXT_M 'MATERIAL NUMBER'.
WA_LAYOUT-ZEBRA 'X'.
WA_LAYOUT-NO_COLHEAD 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS '3'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'SPRAS'.
WA_FCAT-INPUT 'X'.
WA_FCAT-SELTEXT_M 'LANGUAGE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS '4'.
WA_FCAT-TABNAME 'IT_FINAL'.
WA_FCAT-FIELDNAME 'MAKTX'.

WA_FCAT-SELTEXT_M 'MTERIAL DESCRIPTION'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
   I_CALLBACK_PROGRAM             'SY-REPID'
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
*   I_STRUCTURE_NAME               =
   IS_LAYOUT                      WA_LAYOUT
   IT_FIELDCAT                    IT_FCAT
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
  TABLES
    t_outtab                       IT_FINAL
 EXCEPTIONS
   PROGRAM_ERROR                  1
   OTHERS                         2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.