Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

ALV list output exception column

$
0
0

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

groupsoverview.jpg


Exc. group 1: LIGHTS

grup1.jpg

 

Exc. group 2: LED

group2.jpg


Exc. group 3: STATUS

group3.jpg


Exc. group 4: TREND

group4.jpg

 

Exc. group 5: MESSAGE

group5.jpg


Exc. group 6: ALERT/ WARNING/ HINT

group6.jpg


Exc. group 7: FAILURE/ INCOMPLETE/ CHECKED

group7.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_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:


Viewing all articles
Browse latest Browse all 935

Trending Articles