Академический Документы
Профессиональный Документы
Культура Документы
Checkbox Functionality :- The checkbox functionality has been replaced by selection buttons in front of
each row (field SEL_MODE of the layout structure set to A or D; when using the editable ALV Grid
Control, these selection buttons are always visible). Class methods like
GET_SELECTED_ROWS work only for this new functionality and not for checkboxex. Thus,
checkboxes should not be used for line selection but for a column as an additional or for an already
existing attribute.
NOTE:- we can get the function code from the attribute list of CL_GUI_GRID_DISPLAY class. All the
constants in attributes list with associated type UI_FUNC can be used.
Q How to allowed user to save and change layout of report? Or Purpose of is_variant
parameter in set_table_for_first_display method.
Ans:- Following steps:-
1. Define a structure of type disvariant i.e. W_VARIANT TYPE DISVARIANT.
2. Pass the program name to report parameter of it i.e. W_VARIANT-REPORT = SY-REPID.
3. Pass this structure to method set_table_for_first_display i.e.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
is_variant = w_variant
I_save = 'A'
2
4. If we want to allow the use to save his layout variant, the value for i_save parameter should be A.
Otherwise, he can only choose and change layout temporarily.
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change flight' TO ls_toolbar-quickinfo.
MOVE 'Change' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
*This code is for giving space in between two icons
* CLEAR ls_toolbar.
* MOVE c_separator TO ls_toolbar-butn_type..
* APPEND ls_toolbar TO e_object->mt_toolbar.
* CLEAR ls_toolbar.
* MOVE 'SAVE' TO ls_toolbar-function.
* MOVE icon_display_text TO ls_toolbar-icon.
* MOVE 'Display flight' TO ls_toolbar-quickinfo.
* MOVE 'Display' TO ls_toolbar-text.
* MOVE ' ' TO ls_toolbar-disabled.
* APPEND ls_toolbar TO e_object->mt_toolbar.
4. To handle the click of above defined button, we need to handle function code (CHANGE as in
above case) in event handler method for user_command event of cl_gui_alv_grid. User_command
has importing parameter e_ucomm which returns the function code of button pressed. Using this we
can code as follow:
3
METHOD handle_user_command.
* HANDLE OWN FUNCTIONS IN THE TOOLBAR
CASE e_ucomm.
WHEN 'CHANGE'.
PERFORM change_flight.
ENDCASE.
ENDMETHOD. "handle_user_command
Q Where the data captured data is stored in ALV Interactive Reports using user command?
Ans: We need pass a value to user command parameter i.e.
SELFIELD will store the contents of selected line. This is in case of simple ALV. In oops ALV, we use event
DOUBLE_CLICK. It return a E_ROW, E_COLUMN , ES_ROW_NO.
Step 2:- Call method 'get_frontend_fieldcatalog' of class cl_gui_alv_grid and populate the field catalog
using the parameter 'et_fieldcatalog' . This parameter will give you the field catalog of the current
displayed screen.
Step 3:- Now loop at the field catalog and make the required changes.
Step 4:- Call the method 'set_table_for_first_display' and pass the field catalog.
5
wa_style-fieldname = 'SALARY'.
wa_style-style = cl_gui_alv_grid=>mc_style_button.
gs_layout-STYLEFNAME = 'CELL_STYLE'.
Q Can we display output using alv gird object without created custom container class object?
Ans:- Yes we can display alv without custom container object as follow.
ENDTRY.