Application Development and Automation Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
5,671

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..


Exc. group 1: LIGHTS

Exc. group 2: LED


Exc. group 3: STATUS


Exc. group 4: TREND

Exc. group 5: MESSAGE


Exc. group 6: ALERT/ WARNING/ HINT


Exc. group 7: FAILURE/ INCOMPLETE/ CHECKED

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_MARA-MSTAE.

       WHEN 4. "normales Material

         LS_MARA-EXCEPTION = 3.

       WHEN 5. "Sondermaterial

         LS_MARA-EXCEPTION = 2.

       WHEN 7. "Auslaufendes Material

         LS_MARA-EXCEPTION = 1.

     ENDCASE.

     move LS_MARA-MATNR 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:

2 Comments
Labels in this area