Skip to Content
Author's profile photo Former Member

ALV list output exception column

Hi Experts,

i was working on an report and i had to use the Exception function of the ALV list output. After reasearching i didn’t find an proper document that summarizes the Exception groups and the exception funktion of ALV list ouputs. So i created one that i want to share with you.

Exception Column in ALV Lists

Exception Groups

In the context of the ALV list output there are several cell graphics that can be displayed by using the so called Exceptions. These Exceptions are sorted into several groups. For an output of an Exception column you have to define an output column of the type CHAR. This columns normally holds a single value. In the following tables you can see which value has to be set for the several exception groups for each row/node of the output. Also you have to set the exception column on the ALV object by calling the method SET_EXCEPTION that needs the column name of the output structure and the exception group..

/wp-content/uploads/2015/02/groupsoverview_650964.jpg


Exc. group 1: LIGHTS

/wp-content/uploads/2015/02/grup1_650957.jpg

Exc. group 2: LED

/wp-content/uploads/2015/02/group2_650958.jpg


Exc. group 3: STATUS

/wp-content/uploads/2015/02/group3_650959.jpg


Exc. group 4: TREND

/wp-content/uploads/2015/02/group4_650998.jpg

Exc. group 5: MESSAGE

/wp-content/uploads/2015/02/group5_650961.jpg


Exc. group 6: ALERT/ WARNING/ HINT

/wp-content/uploads/2015/02/group6_650962.jpg


Exc. group 7: FAILURE/ INCOMPLETE/ CHECKED

/wp-content/uploads/2015/02/group7_650963.jpg

Notes

Affected are the following column classes:CL_SALV_COLUMNS_LIST

Example

REPORT ZERO_ZUCKER.

TYPES: BEGIN OF TY_TEST.

         INCLUDE TYPE MARA.

TYPES: EXCEPTION TYPE C,

END OF TY_TEST.

DATA: LT_MARA   TYPE STANDARD TABLE OF TY_TEST,

       LS_MARA   TYPE TY_TEST,

       LV_STRING TYPE LVC_VALUE.

DATA: LR_SALV_TREE TYPE REF TO CL_SALV_TREE,

       LR_COLUMNS   TYPE REF TO CL_SALV_COLUMNS_TREE,

       LR_NODES     TYPE REF TO CL_SALV_NODES,

       LR_NODE      TYPE REF TO CL_SALV_NODE,

       LV_KEY       TYPE SALV_DE_NODE_KEY.

START-OF-SELECTION.

   TRY.

       CALL METHOD CL_SALV_TREE=>FACTORY

         IMPORTING

           R_SALV_TREE = LR_SALV_TREE

         CHANGING

           T_TABLE     = LT_MARA.

     CATCH CX_SALV_ERROR .

   ENDTRY.

   SELECT * UP TO 10 ROWS INTO CORRESPONDING FIELDS OF TABLE LT_MARA FROM MARA.

   LR_NODES = LR_SALV_TREE->GET_NODES( ).

   LOOP AT LT_MARA INTO LS_MARA.

     CASE LS_MARAMSTAE.

       WHEN 4. “normales Material

         LS_MARAEXCEPTION = 3.

       WHEN 5. “Sondermaterial

         LS_MARAEXCEPTION = 2.

       WHEN 7. “Auslaufendes Material

         LS_MARAEXCEPTION = 1.

     ENDCASE.

     move LS_MARAMATNR TO LV_STRING.

     LR_NODE = LR_NODES->ADD_NODE( RELATED_NODE   = LV_KEY

                                   RELATIONSHIP   = CL_GUI_COLUMN_TREE=>RELAT_FIRST_CHILD

                                   TEXT           = LV_STRING ).

     LR_NODE->SET_DATA_ROW( ls_mara ).

   ENDLOOP.

   TRY.

       LR_COLUMNS = LR_SALV_TREE->GET_COLUMNS( ).

       LR_COLUMNS->SET_EXCEPTION_COLUMN( VALUE = ‘EXCEPTIONS’ GROUP = 1 ).

     CATCH CX_SALV_NOT_FOUND.

   ENDTRY.

   LR_SALV_TREE->DISPLAY( ).

Futher Informations:

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Klaus Babl
      Klaus Babl

      Hi Tobias,

      please check your Exc. group 4. The icon texts may be wrongly assigned.

      Regards,

      Klaus

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Klaus,

      thank you for you hint! The table should now be assigned corrrectly.

      Kind regards

      Tobias