Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Whenever we display the data in the form of ALV report, we need to provide field
catalog information; otherwise the report execution leads to ABORT error. In case
of ALV reporting using classes, we can generate field catalog in 2 ways.
2. Manually
For this, we need to identify the function codes of the ALV toolbar buttons and
prepare an internal table with those function codes and pass the internal table as
a value to the parameter “IT_TOOLBAR_EXCLUDING” of the method
“SET_TABLE_FOR_FIRST_DISPLAY” of the class ‘CL_GUI_ALV_GRID’. All the ALV
toolbar buttons function codes exist in the form of constant public attributes with
the naming standard ‘MC_FC…’ of the class ‘CL_GUI_ALV_GRID’.
Note: For excluding entire ALV toolbar in the Report, set the field ‘NO_TOOLBAR’
to ‘X’ as part of Layout.
For displaying the entire ALV column as pushbutton, set the field ‘STYLE’ as part of
field catalog. All the styles exist in the form of constant attributes with the
naming standard ‘MC_STYL’ as part of the class ‘CL_GUI_ALV_GRID’.
Procedure:
Step1:
Take an additional column in the final internal table which is of table type
“LVC_T_STYL”.
Step 2:
Before displaying the final data in the ALV grid, loop the final internal table and
set the button style (MC_STYLE_BUTTON) to ALV cells based on the condition.
As part of layout generation, set the field “stylefname” whose value is name of
the additional field which holds the style.
For coloring the entire ALV column, set the field ‘EMPHASIZE’ to a color coding as
part of field catalog.
Procedure:
Step1:
Take an additional column in the final internal table which is of type char4.
Step 2:
Before displaying the final data in the ALV grid, loop the final internal table and
set the color coding for the additional field based on the condition.
As part of layout generation, set the field “info_fname” whose value is name
of the additional field which holds the row color coding.
Procedure:
Step1:
Step 2:
Before displaying the final data in the ALV grid, loop the final internal table and
set the color coding for the additional field based on the condition.
For this, we need to prepare work area of type ‘LVC_S_SCOL’ and append the
same to the additional field and update the internal table.
As part of layout generation, set the field “ctab_fname” whose value is name
of the additional field which holds the cell color coding.
- These traffic lights by default are displayed as First column of the ALV
report.
- Traffic light codes are 3 types (1-Red, 2-Yellow, 3-Green) and also we can
refer to the corresponding constant values in the ICON type-group.
Procedure:
Step 1:
Take an additional column in the final internal table which is of type character
of “One”.
Step 2:
Before displaying the final data in the ALV GRID, loop the internal table and set
the traffic light code for an additional column based on a condition.
Step 3:
As part of layout, set the field “EXCP_FNAME”, the value of the field should be
“Name of the additional column” containing traffic light code.
Each “PANE” should be associated with a container to hold an object. The object
can be ALV Grid, Image and Tree.
Step 1:
In SMW0, choose the radio button ‘binary data for webrfc applications’, click on
‘FIND’ (appl.toolbar) provide package name(any package), object name (any
name, unique id) description(…), click on execute click on ‘create’ button
(appl.toolbar),provide object name (ZBT), description(…), click on ‘import button’
(status bar of dialog box)
Step 2:
This function module takes an image object id as input and returns the “URL” of
picture which is of type “cndp_url”.
Note:
We can add the nodes to the tree control by using the instance method
“add_nodes” of the class “cl_gui_simple_tree”.
Procedure:
Step 1:
Take an additional column in the final internal table, this additional column
needs to be displayed as dropdown.
Step 2:
Step 3:
Prepare an internal table of type ‘LVC_T_DROP’ with drop down handle and
dropdown values and pass this internal table as a parameter to the method
‘SET_DROP_DOWN_TABLE’ of the class ‘CL_GUI_ALV_GRID’.
3. Raised by SAP itself depending on user actions (from. The std. methods)
Note:
1. To Display ALV column values as link, we need to set the field ‘HOTSPOT’ as
part of field catalog for that particular field.
2. ‘HOTSPOT_CLICK’ is the instance event of the class ‘CL_GUI_ALV_GRID’
which is triggered by SAP whenever the user clicks on ALV Cell value in the
runtime.
5. As part of interactive ALV reporting using classes, when the user interacts
and navigates from one screen to another screen, we need to refresh the
grid with the corresponding internal table data using the method
‘REFRESH_TABLE_DISPLAY’ of the class ‘CL_GUI_ALV_GRID’.
Note:
1. To enable multiple selection of rows on ALV grid, we need to set the field
‘SEL_MODE’ TO ‘A’ as part of layout
2. To identify the selected rows on the ALV grid, we need to use the instance
method ‘GET_SELECTED_ROWS’ of the class ‘CL_GUI_ALV_GRID’. This
method returns the internal tables containing the indexes of selected rows.
Procedure:
1. For the ALV column to be editable, set the field edit to ‘X’ As part of field
catalog,
2. Handle the event ‘DATA_CHANGED’ of the class ‘CL_GUI_ALV_GRID’. This
event is not triggered by default as it is a system event, it requires explicit
registration and it is done by calling the instance method
‘REGISTER_EDIT_EVENT’ of the class ‘CL_GUI_ALV_GRID’. This method
takes event id as a mandatory input parameter. These event ids exist in the
form of constant attributes of the grid class and we can use any of the
following attribute event ids.
a) Mc_evt_modified Allows only single cell editing, in this case the event
‘DATA_CHANGED’ is triggered when the user shifts the focus from the
first modified cell or when the user presses enter key in the first
modified cell.
b) Mc_evt_enter -> Allows multi cell editing, in this case the event is
triggered when the user presses enter key in the last modified cell.
3. As part of the event handler method, we need to import the event
parameter ‘ER_DATA_CHANGED’ and using this event parameter (object)
access the instance attribute (internal table) ‘MT_MODIFIED_CELLS’ which
keeps track about the information of the modified cells which includes
row_id and modified value. Based on this, update the grid internal table as
well as corresponding database table.