Hiding default alv grid toolbar
Hi.
is there any way to hide the standard toolbar of an alv grid (cl_gui_alv_grid)
Thanks.
Hi,
The code i previously pasted is to hide only some icons in tool bar.
If you want to hide the entire tool bar
Declare for the layout which you will use in grid display,
DATA: g_r_layo TYPE lvc_s_layo, "Layout structure
then use
<b>g_r_layo-no_toolbar = 'X'.</b>
then toolbar will not display.
Then pass this to the method
CALL METHOD g_r_grid->set_table_for_first_display
EXPORTING
i_buffer_active = 'X'
is_variant = g_r_variant
i_save = 'X'
i_default = 'X'
<b> is_layout = g_r_layo</b>
CHANGING
it_outtab = <it_disptab>
it_fieldcatalog = g_t_fieldcat.
Hope this will solve your problem.
<b>Reward if helpful.</b>
Similar Messages
-
Anything other than buttons on ALV Grid toolbar?
Does anyone know if anything other than buttons can be placed on a ALV Grid toolbar, eg. a piece of text or an input field? The filter button for data selection may be too cumbersome/slow for a call centre operator; I want to have a display field with a dropdown identifying a data field and an input field to accept a value on which to select.
may be you can do some thing like this..instead of having a input field on the toolbar. have an input field above the ALV grid(this is applicable only when you are using Object Oriented ALV).
| input field : ________________ |
|__________________________________|
| ALV GRID OUTPUT |
|__________________________________|
you can have a button along with input field also. enter the value in it, and press enter . in the enter handling fetch all the data. and display in the ALV grid.
in the screen fiest create input field, and button, then place the custom control. on the custom control you place the grid. -
Multiple selection of e_ucomm in ALV Grid toolbar
Dear SAP friends,
I have created HR report.
On the selection screen the User enters some initial data and ALV Grid get displayed.
In event Handle_toolbar the program adds a custom button to standard ALV grid toolbar named "ABSENCE/ATTENDANCE".
In event handle_menu_button the program adds functions to this button.
Then in event handle_user_command depending on the function selected "e_ucomm" the program repopulates the ALV Grid.
METHOD handle_toolbar.
* Append a separator to standard toolbar
CLEAR gs_toolbar.
gs_toolbar-butn_type = 3.
APPEND gs_toolbar TO e_object->mt_toolbar.
CLEAR gs_toolbar.
gs_toolbar-function = 'ABSENCE/ATTENDANCE'.
gs_toolbar-icon = icon_position_hr.
gs_toolbar-quickinfo = 'Absence/Attendance Type'.
gs_toolbar-butn_type = 2. " 2-Menu type, 0-single button type
gs_toolbar-disabled = space.
APPEND gs_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
METHOD handle_menu_button.
* Handle own menubuttons
IF e_ucomm = 'ABSENCE/ATTENDANCE'.
LOOP AT it_aa INTO it_aa_ln.
MOVE it_aa_ln-type TO w-fcode.
CONCATENATE it_aa_ln-type '=' it_aa_ln-text
INTO w-text
SEPARATED BY SPACE.
CALL METHOD e_object->add_function
EXPORTING
fcode = w-fcode
text = w-text.
ENDLOOP.
ENDIF.
ENDMETHOD. "handle_menu_button
METHOD handle_user_command.
MOVE e_ucomm TO w-abstype.
PERFORM abs_att USING w-abstype.
ENDMETHOD. "handle_user_command
Is there a way to select more than one line or e_ucomm in other words at a time?
I would like to give my user a choice of let's say one report with three types of absences at a time rather than three reports with one type each.
Thanks,
TatyanaThe whole point of a toolbar button is to do a specific function.
What I would actually do here is in your menu button add another option say "User Choice" and when this is clicked throw up another screen say another ALV grid where the user can choose the various combinations or do it via a POPUP. A second grid IMO would be the best way to do it as the user can select easily specific rows.
You can either display the 2nd grid in a 2nd custom container on your main screen where you are showing the ALV grid or pass control to a new screen / program. Using a 2nd container is better as you still will have your instance of the original grid available.
Cheers
Jimbo -
How can I trigger a USER_COMMAND for alv grid "toolbar" ???
Hi,
i have the standard ALV Grid "toolbar" and if i click to the Button "&LOCAL©_ROW" than i want try to make a Refresh to my ALV Table in the Event "afteruser_command"_!!!!
Here is the implementation of my Event *"afteruser_command":*_
METHOD on_after_user_command.
........DATA: ls_stable TYPE lvc_s_stbl.
.....CASE e_ucomm.
.....WHEN '&LOCAL©_ROW'.
........MESSAGE 'LOCAL_COPY_ROW' TYPE 'S' DISPLAY LIKE 'E'.
........ls_stable-row = 'X'.
........ls_stable-col = 'X'.
........CALL METHOD gr_grid_d0100->refresh_table_display
..............EXPORTING
.......................is_stable = ls_stable
..............EXCEPTIONS
.......................finished = 1
.......................OTHERS = 2.
......ENDCASE.
ENDMETHOD.
But it doesnt work.
Is there another function code for the Copy Button????
Thanks
ErsinHello Ersin,
the events "after_user_command", "before_user_command" and "user_command" will not be fired when selecting this command!
In my opinion, there is no solution, to fire these events, using this alv-function!
But there is a trick:
1. Register on the event "toolbar" with an own method:
toolbar_own for event toolbar of cl_gui_alv_grid
importing e_object
e_interactive,
In this method change the function code of "&LOCAL©_ROW", but don´t change the row of the entry, because the button should appear on the same place in the toolbar:
field-symbols: <ls_toolbar> type stb_button.
read table e_object->mt_toolbar with key function = '&LOCAL©_ROW'
assigning <ls_toolbar>.
if sy-subrc = 0.
<ls_toolbar>-function = 'COPYROW_OWN'.
endif.
2. Register on the event "user_command" ( I think, that´s clear ):
user_cmd_own for event user_command
of cl_gui_alv_grid
importing e_ucomm,
( don´t forget the set handler-commands for both events:
set handler po_alv_own->user_cmd_own for po_alv_own.
set handler po_alv_own->toolbar_own for po_alv_own. )
3. Now you can react in the method "user_command" on your own function code:
case e_ucomm.
when 'COPYROW_OWN'.
perform copy_row using me
changing gt_bis_cf_out.
Sample code for copying the current line:
FORM COPY_ROW using po_alv_own type ref to gcl_alv_own
changing pt_table_alv type gt_table_alv_t.
data: l_index type i,
ls_table_alv type gs_table_alvt_t.
call method po_alv_own->get_current_cell
importing
e_row = l_index.
* e_value =
* e_col =
* es_row_id =
* es_col_id =
* es_row_no =
"read the current line:
read table pt_table_alv index l_index
into ls_table_alv_out.
"some changes for the new row:
clear: ls_table_alv-style,
ls_table_alv-tabix.
"insert the new line:
add 1 to l_index.
insert ls_table_alv into pt_table_alv index l_index.
po_alv_own->refresh( ).
ENDFORM. " COPY_ROW
In this manner the events "after_user_command", "before_user_command" are fired, too!
For information: My problem was, that the ALV-function copied the style-information too, so in the new line, some fields are not editable. At least his field must be cleared!
Best regard
Thomas Scheuermann -
ALV grid toolbar - standard download to excel error
Hi Experts,
In my ALV grid report, when i click on the standard ALV toolbar to download the output to excel file, the data gets downloaded fine execpt for one field called serial number. It is of size 18 chars.
The last number on this field is getting truncated when it is downloaded to excel. Only 17 characters is being shown. There is no output lenght specification in the field catalog. The column width optimize property is also not set. Any ideas on what might be the problem?
CheersHi,
Check this link:
Re: Digit missing in the alv export
Hope this helps.
Regards,
Satish Kanteti -
Visibility of ALV grid toolbar functions of the Custom report in ITS screen
Hi all,
I am working on SRM 5.0 with INTERNAL ITS.I have created a custom report and a transaction code for the same.Now in the SRM Web menu,I have provided a link for this report.
The problem I am facing is that in the O/P screen of the report,I have an ALV grid being displayed with 1 custom icon at the end of the std ALV toolbar.Now in the SAPGUI,this icon is displayed correctly at the end of the ALV toolbar but in the Web screen,i can see only few of the functions(visible as buttons in the SRM web screen/IE) in the ALV toolbar and rest of them being displayed under an additional button "MORE".Is there any way i can show the custom icon as a button which is directly visible on the SRM web screen and not under the options MORE?
All inputs will be highly appreciated and rewarded.Hello!
There are several possibilities how to call transaction:
- You can call it as service (that is what you do when you test it from SICF)
- You can call it through service (or alias) WEBGUI (not using service for the specific transaction to call it)
If you are calling it through WEBGUI then parameter ~SINGLETRANSACTION should be added to service (or alias) of WEBGUI. And there should be added also Log Off URL (in SICF). At this case it should navigate back to the URL which is specified in SICF.
Hope this helps!
Best regards,
Rorijs -
Delete row in OO ALV grid toolbar
Hello;
I am using OO ALV grid to display data. On the standard toolbar when delete row button is activated the relevant row is removed from the screen. The program catches this event only when Enter is pressed. Is it possible to catch it as soon as delete row is pressed?
Thx in advance.
AliHi Ali,
You have to handle standard ALV toolbar. Even you can use Custom Toolbar. But you can handle it from Standard toolbar user command. Register events..
Thanks and Regards,
Sampath -
How to add excel download button to ALV grid toolbar?
Hi,
Im generating ALV output through the method "SET_TABLE_FOR_FIRST_DISPLAY".But in the output,I cant see a direct excel download button,just like how it used to come when we use FM "REUSE_ALV_GRID_DISPLAY". Here, the excel download option comes as part of a drop down on top.But is there any way that I can have a separate excel download button which will be more user friendly for the customer?
Thanks,
MaheshCreate your own GUI status and add a push button there. In PAI write code for Excel download for that button.
Regards,
Amit -
ALV Grid: exclude a menu button
Hello,
I have a strange problem here:
I'm excluding several buttons and menu buttons from the default alv grid toolbar. But one the the menu buttons doesn't behave like the others.
cl_gui_alv_grid=>mc_fc_views
and
cl_gui_alv_grid=>mc_mb_view
both remove the menu entries but not the button itself !
Other menu buttons like
cl_gui_alv_grid=>mc_mb_subtot
are removed properly.
Any ideas on this one ?
Best regards,
Patrick BaerThe suggestion i am going to give you is not a nice one, but would work.
i had one alv where i had removed all the standard buttons. and the following is the contents of the exclusion table.
place all of them into the exclusion table and remove one by one from the exclusion table to check out.
append cl_gui_alv_grid=>mc_fc_auf to exl_tab.
append cl_gui_alv_grid=>mc_fc_average to exl_tab.
append cl_gui_alv_grid=>mc_fc_back_classic to exl_tab.
append cl_gui_alv_grid=>mc_fc_call_abc to exl_tab.
append cl_gui_alv_grid=>mc_fc_call_chain to exl_tab.
append cl_gui_alv_grid=>mc_fc_call_crbatch to exl_tab.
append cl_gui_alv_grid=>mc_fc_call_crweb to exl_tab.
append cl_gui_alv_grid=>mc_fc_call_lineitems to exl_tab.
append cl_gui_alv_grid=>mc_fc_call_master_data to exl_tab.
append cl_gui_alv_grid=>mc_fc_call_more to exl_tab.
append cl_gui_alv_grid=>mc_fc_call_report to exl_tab.
append cl_gui_alv_grid=>mc_fc_call_xint to exl_tab.
append cl_gui_alv_grid=>mc_fc_call_xxl to exl_tab.
append cl_gui_alv_grid=>mc_fc_check to exl_tab.
append cl_gui_alv_grid=>mc_fc_col_invisible to exl_tab.
append cl_gui_alv_grid=>mc_fc_col_optimize to exl_tab.
append cl_gui_alv_grid=>mc_fc_current_variant to exl_tab.
append cl_gui_alv_grid=>mc_fc_data_save to exl_tab.
append cl_gui_alv_grid=>mc_fc_delete_filter to exl_tab.
append cl_gui_alv_grid=>mc_fc_deselect_all to exl_tab.
append cl_gui_alv_grid=>mc_fc_detail to exl_tab.
append cl_gui_alv_grid=>mc_fc_excl_all to exl_tab.
append cl_gui_alv_grid=>mc_fc_expcrdata to exl_tab.
append cl_gui_alv_grid=>mc_fc_expcrdesig to exl_tab.
append cl_gui_alv_grid=>mc_fc_expcrtempl to exl_tab.
append cl_gui_alv_grid=>mc_fc_expmdb to exl_tab.
append cl_gui_alv_grid=>mc_fc_extend to exl_tab.
append cl_gui_alv_grid=>mc_fc_f4 to exl_tab.
append cl_gui_alv_grid=>mc_fc_filter to exl_tab.
append cl_gui_alv_grid=>mc_fc_find to exl_tab.
append cl_gui_alv_grid=>mc_fc_fix_columns to exl_tab.
append cl_gui_alv_grid=>mc_fc_graph to exl_tab.
append cl_gui_alv_grid=>mc_fc_help to exl_tab.
append cl_gui_alv_grid=>mc_fc_html to exl_tab.
append cl_gui_alv_grid=>mc_fc_info to exl_tab.
append cl_gui_alv_grid=>mc_fc_load_variant to exl_tab.
append cl_gui_alv_grid=>mc_fc_loc_append_row to exl_tab.
append cl_gui_alv_grid=>mc_fc_loc_copy to exl_tab.
append cl_gui_alv_grid=>mc_fc_loc_copy_row to exl_tab.
append cl_gui_alv_grid=>mc_fc_loc_cut to exl_tab.
append cl_gui_alv_grid=>mc_fc_loc_delete_row to exl_tab.
append cl_gui_alv_grid=>mc_fc_loc_insert_row to exl_tab.
append cl_gui_alv_grid=>mc_fc_loc_move_row to exl_tab.
append cl_gui_alv_grid=>mc_fc_loc_paste to exl_tab.
append cl_gui_alv_grid=>mc_fc_loc_paste_new_row to exl_tab.
append cl_gui_alv_grid=>mc_fc_loc_undo to exl_tab.
append cl_gui_alv_grid=>mc_fc_maintain_variant to exl_tab.
append cl_gui_alv_grid=>mc_fc_maximum to exl_tab.
append cl_gui_alv_grid=>mc_fc_minimum to exl_tab.
append cl_gui_alv_grid=>mc_fc_pc_file to exl_tab.
append cl_gui_alv_grid=>mc_fc_print to exl_tab.
append cl_gui_alv_grid=>mc_fc_print_back to exl_tab.
append cl_gui_alv_grid=>mc_fc_print_prev to exl_tab.
append cl_gui_alv_grid=>mc_fc_refresh to exl_tab.
append cl_gui_alv_grid=>mc_fc_reprep to exl_tab.
append cl_gui_alv_grid=>mc_fc_save_variant to exl_tab.
append cl_gui_alv_grid=>mc_fc_select_all to exl_tab.
append cl_gui_alv_grid=>mc_fc_send to exl_tab.
append cl_gui_alv_grid=>mc_fc_separator to exl_tab.
append cl_gui_alv_grid=>mc_fc_sort to exl_tab.
append cl_gui_alv_grid=>mc_fc_sort_asc to exl_tab.
append cl_gui_alv_grid=>mc_fc_sort_dsc to exl_tab.
append cl_gui_alv_grid=>mc_fc_subtot to exl_tab.
append cl_gui_alv_grid=>mc_fc_sum to exl_tab.
append cl_gui_alv_grid=>mc_fc_to_office to exl_tab.
append cl_gui_alv_grid=>mc_fc_to_rep_tree to exl_tab.
append cl_gui_alv_grid=>mc_fc_unfix_columns to exl_tab.
append cl_gui_alv_grid=>mc_fc_views to exl_tab.
append cl_gui_alv_grid=>mc_fc_view_crystal to exl_tab.
append cl_gui_alv_grid=>mc_fc_view_excel to exl_tab.
append cl_gui_alv_grid=>mc_fc_view_grid to exl_tab.
append cl_gui_alv_grid=>mc_fc_word_processor to exl_tab.
append cl_gui_alv_grid=>mc_lystyle_drag_drop_rows to exl_tab.
append cl_gui_alv_grid=>mc_lystyle_no_delete_rows to exl_tab.
append cl_gui_alv_grid=>mc_lystyle_no_insert_rows to exl_tab.
append cl_gui_alv_grid=>mc_lystyle_no_insert_rows to exl_tab.
append cl_gui_alv_grid=>mc_ly_drag_drop_rows to exl_tab.
append cl_gui_alv_grid=>mc_ly_no_delete_rows to exl_tab.
append cl_gui_alv_grid=>mc_ly_no_insert_rows to exl_tab.
append cl_gui_alv_grid=>mc_mb_export to exl_tab.
append cl_gui_alv_grid=>mc_mb_view to exl_tab.
append cl_gui_alv_grid=>mc_mb_sum to exl_tab.
append cl_gui_alv_grid=>mc_mb_subtot to exl_tab.
append cl_gui_alv_grid=>mc_mb_filter to exl_tab.
append cl_gui_alv_grid=>mc_mb_variant to exl_tab.
append cl_gui_alv_grid=>mc_mb_paste to exl_tab.
append cl_gui_alv_grid=>mc_style4_link to exl_tab.
append cl_gui_alv_grid=>mc_style4_link_no to exl_tab.
append cl_gui_alv_grid=>mc_style_button to exl_tab.
append cl_gui_alv_grid=>mc_style_disabled to exl_tab.
append cl_gui_alv_grid=>mc_style_enabled to exl_tab.
append cl_gui_alv_grid=>mc_style_f4 to exl_tab.
append cl_gui_alv_grid=>mc_style_f4_no to exl_tab.
append cl_gui_alv_grid=>mc_style_no_delete_row to exl_tab.
Regards
Raja -
Exporting ALV Grid output to Excel sheet
Hi All,
How can i export the output displayed using Grid to an Excel sheet. I tried with default option from list->export->excel sheet/local file but i am not getting complete data and the data which i am getting also notin proper format. Please help me in this regard.
Best Regards,
SunilCheck out the ALV grid toolbar for export options.
Regards
Raja -
Problems with ALV GRID In ECC6.0
Hello all,
1.From alv grid when we transfer data to excel file it downloads everything apart from 1 column.
2.when transfering to local file its dumping and error is wa_not_assigned(field symbol <fm04> )
3.when click on the transfer option and select a radiobutton to download to excel file..next time when run the pogram popup not appearing to select the options and the file automatically downloading to excel.
<< Removed >>
Thanks
Edited by: BrightSide on Jun 18, 2009 10:02 PM
Edited by: Rob Burbank on Jun 18, 2009 5:18 PMHi,
Are you creating your own application toolbar or the default ALV application toolbar... -
Hi,
I am totally new to ALV Grids. Could you give a full example of creating a ALV Grid with 2 columns, thinking there is a internal table itab with itab-col1 & itab-col2. Please start from initialising variables and onwards.
Thanks,
KishanHi,
Simple example of how to implement an ALV grid
Note that this example uses table ZSFLIGHT. The table is equivalent to the table SFLIGHT.
Steps:
1. Create an executable program (Report)
2. Create a screen (100) and place a custom container named ALV_CONTAINER on the screen
3. Create a Pushbutton. Give it the text Exit and the functioncode EXIT
REPORT sapmz_hf_alv_grid .
TABLES: zsflight.
G L O B A L I N T E R N A L T A B L E S
DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
g_wa_sflight LIKE sflight.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
Create objects
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
PERFORM load_data_into_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form load_data_into_grid
FORM load_data_into_grid.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
Load data into the grid and display them
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
CHANGING it_outtab = gi_sflight.
ENDFORM. " load_data_into_grid
Allow the user to save and reuse the layout
A button can be shown on the grid toolbar, allowing the user to save and reuse a layout. The button looks like this:
See also example in SAP standard program BCALV_GRID_09.
To do this use the parameters IS_VARIANT and I_SAVE of the set_table_for_first_display method. Note that the IS_VARIANT
parameter must have the structure DISVARIANT.
The I_SAVE "Options for saving layouts" parameter can have the following values:
· U Only user specific layouts can be saved
· X Only global layouts can be saved
· A Both user specific and global layouts can be saved
· Space Layouts can not be saved
Add the following code to the example:
FORM load_data_into_grid.
DATA:
For parameter IS_VARIANT
l_layout TYPE disvariant.
Code..........
Load data into the grid and display them
l_layout-report = sy-repid.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = l_layout
i_save = 'A'
CHANGING it_outtab = gi_
Integrate user defined functions in the grid toolbar
Possibilities:
· Replace existing functions in the toolbar or context men with user defined functions
· Add new functions to the toolbar or context menu
Note that the whole toolbar can be removed using the IT_TOOLBAR_EXCLUDING parameter of the set_table_for_first_display
method.
See also example in SAP standard program BCALV_GRID_05
1) To get access to the icons insert the following statement in the top of the program:
TYPE-POOLS: icon.
2) To allow the declaration of o_event_receiver before the lcl_event_receiver class is defined, declare it as deferred in the start of
the program
To allow the declaration of o_event_receiver before the lcl_event_receiver class is defined, declare it as deferred in the
start of the program
CLASS lcl_event_receiver DEFINITION DEFERRED.
3) Declare reference to the event handler class
DATA:
o_event_receiver TYPE REF TO lcl_event_receiver.
4) Class for event receiver. This class adds the new button to the toolbar and handles the event when the button is pushed
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
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.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
5) In the PBO module, crate object for event handler and set handler
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
6) In the PBO module after the CALL METHOD go_grid->set_table_for_first_display, raise event
toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid
After CALL METHOD go_grid->set_table_for_first_display insert the following statement:
CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
Set the title of the grid
Fill the grid_title field of structure lvc_s_layo.
Note that the structure lvc_s_layo can be used for to customize the grid appearance in many ways.
DATA:
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
Set grid title
gs_layout-grid_title = 'Flights'.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
Customize the appearence of the grid
The structure lvc_s_layo contains fields for setting graphical properties, displaying exceptions, calculating totals and enabling specific
interaction options.
Fill the apporpiate fields of structure lvc_s_layo and insert it as a parameter in the CALL METHOD
go_grid->set_table_for_first_display. See the example under Set the title of the grid.
If you want to change apperance after list output, use the methods get_frontend_layout and set_frontend_layout.
Examples of fields in structure lvc_s_layo:
GRID_TITLE Setting the title of the grid
SEL_MODE. Selection mode, determines how rows can be selected. Can have the following values:
· A Multiple columns, multiple rows with selection buttons.
· B Simple selection, listbox, Single row/column
· C Multiple rows without buttons
· D Multiple rows with buttons and select all ICON
Setting and getting selected rows (Columns) and read line contents
You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows
and set_selected_rows. There are similar methods for columns.
Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected
row(s) to read the information in the rows from the table. In the examples below the grid table is named gi_sflight.
Data declaration:
DATA:
Internal table for indexes of selected rows
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
Example 1: Reading index of selected row(s) and using it to read the grid table
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a valid line'.
EXIT.
ENDIF.
LOOP AT gi_index_rows INTO g_selected_row.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Example 2: Set selected row(s).
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
exporting
it_index_rows = gi_index_rows.
ENDIF.
Make an Exception field ( = Traffic lights)
There can be defined a column in the grid for display of traffic lights. This field is of type Char 1, and can contain the following values:
· 1 Red
· 2 Yellow
· 3 Green
The name of the traffic light field is supplied inh the gs_layout-excp_fname used by method set_table_for_first_display.
Example
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
TYPES: traffic_light TYPE c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
Set the exception field of the table
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-traffic_light = '1'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
ELSE.
g_wa_sflight-traffic_light = '3'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Name of the exception field (Traffic light field)
gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
Color a line
The steps for coloring a line i the grid is much the same as making a traffic light.
To color a line the structure of the table must include a Char 4 field for color properties
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
Loop trough the table to set the color properties of each line. The color properties field is
Char 4 and the characters is set as follows:
Char 1 = C = This is a color property
Char 2 = 6 = Color code (1 - 7)
Char 3 = Intensified on/of = 1 = on
Char 4 = Inverse display = 0 = of
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-line_color = 'C610'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Name of the color field
gs_layout-info_fname = 'LINE_COLOR'.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
Refresh grid display
Use the grid method REFRESH_TABLE_DISPLAY
Example:
CALL METHOD go_grid->refresh_table_display.
Complete code for the ALV grid example
This example shows and ALV grid with flights. After selecting a line a change button can be pushed to display a change screen. After
the changes have been saved, the ALV grid screen is displayed again, and the grid is updated with the changes.
The example shows:
· How to setup the ALV grid
· How to ste focus to the grid
· How to set the title of the grid
· How to allow a user to save and reuse a grid layout (Variant)
· How to customize the ALV grid toolbar
· Refresh the grid
· Set and get row selection and read line contents
· Make and exception field (Traffic light)
· Coloring a line
Steps:
· Create screen 100 with the ALV grid. Remember to include an exit button
· Add a change button to the ALV grid toolbar
· Create screen 200 the Change screen
The screens:
The code:
REPORT sapmz_hf_alv_grid .
Type pool for icons - used in the toolbar
TYPE-POOLS: icon.
TABLES: zsflight.
To allow the declaration of o_event_receiver before the
lcl_event_receiver class is defined, decale it as deferred in the
start of the program
CLASS lcl_event_receiver DEFINITION DEFERRED.
G L O B A L I N T E R N A L T A B L E S
*DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
To include a traffic light and/or color a line the structure of the
table must include fields for the traffic light and/or the color
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for traffic light
TYPES: traffic_light TYPE c.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
Work area for internal table
g_wa_sflight TYPE st_sflight,
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container,
o_event_receiver TYPE REF TO lcl_event_receiver.
DATA:
Work area for screen 200
g_screen200 LIKE zsflight.
Data for storing information about selected rows in the grid
DATA:
Internal table
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
C L A S S E S
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
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.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
PERFORM change_flight.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
DATA:
For parameter IS_VARIANT that is sued to set up options for storing
the grid layout as a variant in method set_table_for_first_display
l_layout TYPE disvariant,
Utillity field
l_lines TYPE i.
After returning from screen 200 the line that was selected before
going to screen 200, should be selected again. The table gi_index_rows
was the output table from the GET_SELECTED_ROWS method in form
CHANGE_FLIGHT
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows.
CALL METHOD cl_gui_cfw=>flush.
REFRESH gi_index_rows.
ENDIF.
Read data and create objects
IF go_custom_container IS INITIAL.
Read data from datbase table
PERFORM get_data.
Create objects for container and ALV grid
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
Create object for event_receiver class
and set handlers
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
Layout (Variant) for ALV grid
l_layout-report = sy-repid. "Layout fo report
Setup the grid layout using a variable of structure lvc_s_layo
Set grid title
gs_layout-grid_title = 'Flights'.
Selection mode - Single row without buttons
(This is the default mode
gs_layout-sel_mode = 'B'.
Name of the exception field (Traffic light field) and the color
field + set the exception and color field of the table
gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
gs_layout-info_fname = 'LINE_COLOR'.
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
Value of traffic light field
g_wa_sflight-traffic_light = '1'.
Value of color field:
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
ELSE.
g_wa_sflight-traffic_light = '3'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
*-- End of grid setup -
Raise event toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid. This is not necessary in this
example as there is only one control on the screen
CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0200 INPUT
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'EXIT200'.
LEAVE TO SCREEN 100.
WHEN'SAVE'.
PERFORM save_changes.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form get_data
FORM get_data.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
ENDFORM. " load_data_into_grid
*& Form change_flight
Reads the contents of the selected row in the grid, ans transfers
the data to screen 200, where it can be changed and saved.
FORM change_flight.
DATA:l_lines TYPE i.
REFRESH gi_index_rows.
CLEAR g_selected_row.
Read index of selected rows
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
Check if any row are selected at all. If not
table gi_index_rows will be empty
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a line'.
EXIT.
ENDIF.
Read indexes of selected rows. In this example only one
row can be selected as we are using gs_layout-sel_mode = 'B',
so it is only ncessary to read the first entry in
table gi_index_rows
LOOP AT gi_index_rows INTO g_selected_row.
IF sy-tabix = 1.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Transfer data from the selected row to screenm 200 and show
screen 200
CLEAR g_screen200.
MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
LEAVE TO SCREEN '200'.
ENDFORM. " change_flight
*& Form save_changes
Changes made in screen 200 are written to the datbase table
zsflight, and to the grid table gi_sflight, and the grid is
updated with method refresh_table_display to display the changes
FORM save_changes.
DATA: l_traffic_light TYPE c.
Update traffic light field
Update database table
MODIFY zsflight FROM g_screen200.
Update grid table , traffic light field and color field.
Note that it is necessary to use structure g_wa_sflight
for the update, as the screen structure does not have a
traffic light field
MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-traffic_light = '1'.
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
clear g_wa_sflight-line_color.
ELSE.
g_wa_sflight-traffic_light = '3'.
clear g_wa_sflight-line_color.
ENDIF.
MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
Refresh grid
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN '100'.
ENDFORM. " save_changes
rgds,
latheesh -
The Visible attribute on alv grid column is not changed after Change Layout
Setup:
I have a program that displays output in an ALV grid (using cl_salv_table).
The ALV grid is displayed within a custom control on a subscreen.
I have 4 subscreens being used on a tabstrip control. So I have 4 ALV grids total (one on each subscreen).
On each ALV grid, I have set the set_layout_change function to true so that the user can hide and unhide columns etc. on each grid via the button on the alv grid toolbar.
I also allow the user to dowload the contents of all 4 grids to excel. To do this I have a custom button that when clicked goes to each ALV grid - gets the column metadata (via cl_salv_columns_table-get() ) and checks the visibility to determine if the column should be downloaded or not (via cl_salv_column-is_visible() ) to excel.
The Problem:
As I said I have 4 grids being displayed via a tab control. Let's say the user is on tab 1 and unhides some columns on the alv grid 1 via the Change Layout... button. And then the user navigates to tab 2. If they click the download button at that point - when the download code is run and it checks the visibility of the columns on alv grid 1 - the changes that were made via the Change Layout... button have not synchronized yet. When I call is_visible() for a column that was unhid it still comes back as false.
The only way I have found to remedy this is to make the user click on a button on the alv grid's toolbar before navigating to a different tab to force the synchronization between the changes made and the backend column metadata. However, this is not the best option and requires training for the user that they have to do this for the download to work correctly.
The Question:
1) why is the Change Layout... button not automatically synchronizing the changes it made to the back end? Is there a way to make it do this?
2) OR, is there a way that I can force the synchronization within the code and not force the user to click a button on the alv grid? If there is a way to force the synchronization - where do I put that code? As far as I can tell, when I switch between tabs - I am unable to catch that action in my PAI events.
Thanks in advance for any help.I was able to resolve this issue with a satisfactory solution.
In my program I had a local class definition to handle the grids' events. When the synchronization wasn't working I only had two events defined: for link_click and added_functions.
I created another definition for event after_salv_function:
on_after_salv_function for event after_salv_function of cl_salv_events importing e_salv_function
There is no code in the method implementation - but adding this event handler now causes a synchronization to occur after the Change Layout is done. -
Custom Function on OO ALV Grid
I am trying to implement ALV_GRID_XT to enhance the ALV Grid toolbar by adding couple of custom funcitons.As per the SAP documentation I have created 2 methods ON_TOOLBAR - one for adding items on toolbar and the other ON_USER_COMMAND - for processing if the user clicks on the custom function.
I am unable to relate the ALV Grid instance onto the method ON_USER_COMMAND . One of the funciton is to calculate the average of column which represents percentage excluding cells with zero values. Once the user selects column(s) and clicks on the Percent button on the ALV grid my piece of code should trigger ON_USER_COMMAND and then display the average percentage on the Totals row.
Method ON_USER_COMMAND has only one parameter E_UCOMM which i am able to get in the method but I am not able to get the instance of the ALV grid so that I can play around with the data in the Grid.
I could have used a local class and then enhanced the ALV toolbar but this requirement is needed for about 20 reports and hence thought of implementing it globally.
Any ideas would be appreciated.Hi there
You need to set the handlers of course and register the events
I'm using also a Z-class using functionality from the ALV Grid
in the application program
data: z_object type ref to zcl_* "my z_class"
* Instantiate your Z class
create object z_object
exporting
z_object = z_object
cfname = 'CCONTAINER1'.
Now in your Constructor for your Z-Class have a variable
say grid1 which is defined as a type ref to cl_gui_alv_grid.
Code the methods you require --. The trick is to instantiate your OWN Z class and within YOUR CLASS instantiate the GRID1 variable as an instance of cl_gui_alv_grid - then you can use methods etc from that class in your own Z class simple via something like this
method CONSTRUCTOR.
create object grid_container1
exporting
container_name = cfname.
create object grid1
exporting
i_parent = grid_container1.
set handler z_object->on_user_command for grid1.
set handler z_object->on_toolbar for grid1.
set handler z_object->handle_data_changed for grid1.
set handler z_object->handle_data_changed_finished for grid1.
set handler z_object->on_dubbelklik for grid1.
set handler z_object->on_hotspot for grid1.
call method grid1->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
endmethod.
method display_grid .
get reference of g_outtab into g_outtab1.
get reference of g_fldcat into g_fldcat1.
struct_grid_lset-edit = i_edit. "To enable editing in ALV
struct_grid_lset-zebra = i_zebra.
struct_grid_lset-cwidth_opt = i_opt.
struct_grid_lset-grid_title = i_gridtitle.
* struct_grid_lset-ctab_fname = 'T_CELLCOLORS'.
* struct_grid_lset-stylefname = 'CELLTAB'.
struct_grid_lset-ctab_fname = style_fname.
struct_grid_lset-stylefname = style_ctab.
* export gt_outtab from gt_outtab to memory id 'gt_outtab'.
call method grid1->set_table_for_first_display
exporting
is_layout = struct_grid_lset
changing
it_outtab = gt_outtab
it_fieldcatalog = it_fldcat.
endmethod.
You need to add the buttons to the toolbar with your ON TOOLBAR method
for example
method on_toolbar .
type-pools icon.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EXCEL' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move icon_xxl to ls_toolbar-icon.
move 'Excel' to ls_toolbar-quickinfo.
move 'EXCEL' to ls_toolbar-text.
append ls_toolbar to e_object->mt_toolbar.
perform toolbar in program (caller) if found
using e_object.
endmethod.
Now the functionality should work in the ON_USER_COMMAND .
Here's my ON_USER_COMMAND method within the class
method ON_USER_COMMAND.
* FOR EVENT before_user_command OF cl_gui_alv_grid
* IMPORTING
* e_ucomm
* sender
* When defined in SE24 you don't need to code the
* FOR EVENT etc as this is already defined as an event handler
case e_ucomm.
when 'EXIT'.
leave program.
when 'EXCEL'.
call method me->download_to_excel.
when 'SAVE'.
when 'PROC'.
call method me->process.
when 'REFR'.
call method me->refresh.
when 'SWITCH'.
call method me->switch.
when 'TEST'.
call method me->get_cell.
endcase.
endmethod.
Add whatever extra functionality you want to the on_user_command so long as you've defined toolbars..
Cheers
jimbo -
Multiple Input Rows In ALV Grid (Editable)
Hi,
I have an editable ALV grid and need to have multiple blank rows ready for input. Something similar to what happens when you click the "New Entries" button in SM30 (Table Maintainance).
There is a local function for appending lines in the ALV grid toolbar but this only allows a single entry.
I have replaced the local function with my own button (same icon etc) and on user_command event, I am appending several blank lines to my output table.
However these lines are not being shown on the screen. I have looked through the layout and field catalog but there is no field to allow blank lines to be shown.
My 2 questions are:
1. Is there some standard way of entering multiple entries in ALV Grid Editable.
2. If not then how to allow blank lines to be shown as ready for input.
Also if someone could suggest a way to do error checking for all entries on the screen especially duplicate entries I will be extremely grateful.
Many Thanks,
PreetHi, Preet!
You can easily do whatever checks you wish. You should declare an event handling method for event DATA_CHANGED and call the ADD_PROTOCOL_ENTRY method of the ER_DATA_CHANGED event parameter (it's an object of the class CL_ALV_CHANGED_DATA_PROTOCOL). You must not forget to set handler for your ALV grid.
For example, this piece of code checks for all changed fields resulting in error message if they are initial. In short, this makes all the fields obligatory.
METHODS: on_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.
SET HANDLER your_object->on_data_changed FOR your_alv_grid.
METHOD on_data_changed.
DATA: s_mod_cell TYPE lvc_s_modi.
LOOP AT er_data_changed->mt_mod_cells INTO s_mod_cell.
IF s_mod_cell-value IS INITIAL.
* issue message 'Make an entry in all required fields'
CALL METHOD er_data_changed->add_protocol_entry
EXPORTING i_msgid = '00'
i_msgno = '055'
i_msgty = 'E'
i_fieldname = s_mod_cell-fieldname
i_row_id = s_mod_cell-row_id.
ENDIF.
ENDMETHOD.
Furthermore, if you make your class inherited from CL_GUI_ALV_GRID you can make use of protected attribute MT_OUTTAB which is a data object referencing your output table. Then you can have:
FIELD-SYMBOLS: <outtab> TYPE STANDARD TABLE.
ASSIGN me->mt_outtab->* TO <outtab>.
* do whatever you want with <outtab>
Hope this helps.
Kind regards,
Igor
P.S. Regarding the blank lines that you need, what's wrong with standard ALV grid buttons "Append row" and "Insert row" which appear whenever the grid is editable (unless you deliberately remove them)? They work just fine with me (just like on SM30). I don't see reason for programatically appending lines to your internal table.
Maybe you are looking for
-
KeepAlive not working with WL 6.1 SP1 in a Sun box.
Hi all, We deployed the same exact application in a linux and in a solaris box (for QA purposes), and noticed that the keepalive configuration is not been respected in the Sun box. If we telnet to our web server, we read the returning headers includi
-
ITunes opens up right after I close it for Windows 8 Enterprise Edition
As stated iTunes opens immediately after I close it. We can step around the "it's a Windows 8 problem" or "why are you using Windows 8", beucase I've had aboslutely no problems with iTunes up untill today and I haven't had any problems with Windows 8
-
ASK THE EXPERTS - WAAS MONITORING AND REPORTING
Welcome to the Cisco Networking Professionals Ask the Expert conversation. This is an opportunity to learn about Cisco Wide Area Application Services monitoring and reporting with Michael Holloway and Joe Merrill. Michael is an escalation support e
-
Flash Player is the new malware !
I had a perfectly functional old Flash 10.0.32 with any security holes covered by my Security.protection When I discovered 36 vulnerabilities I decided to "upgrade", with no assurance that the latest version did not have at least another 100 vulnerab
-
BusinessObject 4.0 API to get SQL statement from webi or crystal report
Hello, Need your help.... could you confirm whether BusinessObjects 4.0 provides any SDK, API or Web Service to get physical SQL statement from the webi or crystal reports file? If so, could you provide name of package, class and method? If I am not