Multiple Selection on Matchcode in ALV Grid
I need to implement a Matchcode with multiple selection on a Field in an ALV Grid. On F4 in this specific Field the specific matchcode muss be enable with multiple selection. And after multiple selection by the user, the result muss be concatenate and insert to this field.
Any suggestions or code?
Thanks and Best Regards
Franck
Check the program: BCALV_TEST_GRID_F4_HELP.
IN the code, search foor the fm: F4IF_FIELD_VALUE_REQUEST.
You should pass the parameter MULTIPLE_CHOICE = 'X' for multiple choice in the F4 pop up.
Once you get the returned table, you can concatenate the result and put it it the target field.
Regards,
Ravi
Similar Messages
-
Multiple selection in DISPLAY only ALV GRID
Hi,
I would like to make the rows of the ALV Grid Display only at the same time I would like to make multiple selection possible.
Multiple selection is possible by giving EDIT = 'X' at the layout level. But then if we give EDIT = ' ' at the fieldcatalogue level or no_input = 'X' at the layout level it is still in Editable mode. Kindly help me.
ThanksHi,
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.
ALV Grid Control with column and row selection
Selecting and Deselecting Rows
Use
Depending on where the ALV grid control is used, there are various methods for selecting and deselecting cells and rows:
If no pushbuttons are displayed on the left edge of the list:
You can only select one row at a time.
You can select multiple rows.
If pushbuttons are displayed on the left edge of the list:
You can select several rows or individual cells.
You can select several rows as well as several cells or individual cells.
Procedure
If no pushbuttons are displayed on the left edge of the list, you select a row by clicking an entry in the row.
If pushbuttons are displayed on the left edge of the list, you select a row by clicking the pushbutton on the relevant row.
In this case, you select the relevant cell by selecting the entry in the row.
In both cases:
To select several rows, press the Shift button and choose the cells as described above.
Adjacent rows:
Select a row, choose Shift or Control, and select the desired rows,
or
Choose Shift, and select the first and the last of the desired rows,
or
Select a row, keep the mouse button pressed, and pass over the desired rows.
Rows that are not adjacent:
Select a row, choose Control, and select the desired rows.
All rows:
You can only select all rows at once if pushbuttons are displayed on the left side of your list. To select all rows, choose .
To deselect individual rows, press the Ctrl button and click the relevant row.
Result
The selected cells have an orange background. The position of your cursor is indicated with a yellow background. -
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 to apply List box for multiple selection of rows in ALV report ?
Hi Exprots,
1: How to apply List box for multiple selection of rows in ALV report ?
Thanking you.
Subashhi,
check the below program.
REPORT zalv_dropdowns.
*Type pools declarations for ALV
TYPE-POOLS : slis.
*data declarations for ALV container,ALV grid, Fieldcatalogues & layout
DATA: g_grid TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
gt_fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo.*INTERNAL TABLE AND WA DECLARATIONS FOR t517 A table
DATA: gt_outtab TYPE STANDARD TABLE OF t517a INITIAL SIZE 0,
wa_outtab TYPE t517a.
START-OF-SELECTION.*Call to ALV
CALL SCREEN 600.*On this statement double click it takes you to the screen painter SE51.
*Create a Custom container and name it CCONT and OK code as OK_CODE.
*Save check and Activate the screen painter.
*Now a normal screen with number 600 is created which holds the ALV grid.
PBO of the actual screen , Here we can give a title and customized menus
Here we also call the subroutine for ALV output.
MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
PERFORM alv_output.
ENDMODULE. "pbo OUTPUT
MODULE PAI INPUT *
MODULE pai INPUT.
ENDMODULE. "pai INPUT
*& Form BUILD_FIELDCAT
FORM build_fieldcat.
DATA ls_fcat TYPE lvc_s_fcat.
*Build the field catalogue
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'T517A'
CHANGING
ct_fieldcat = gt_fieldcat.
To assign dropdown in the fieldcataogue
LOOP AT gt_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'SLART'.
*is the first list box
ls_fcat-drdn_hndl = '1'.
ls_fcat-outputlen = 15.
MODIFY gt_fieldcat FROM ls_fcat.
is the second list box
WHEN 'ABART'.
ls_fcat-drdn_hndl = '2'.
ls_fcat-outputlen = 15.
MODIFY gt_fieldcat FROM ls_fcat.
ENDCASE.
ENDLOOP.
ENDFORM. "build_fieldcat
*& Form ALV_OUTPUT
FORM alv_output .*Create object for container
CREATE OBJECT g_custom_container
EXPORTING container_name = 'CCONT'.
*create object for grid
CREATE OBJECT g_grid
EXPORTING i_parent = g_custom_container.
Build fieldcat and set column
*Assign a handle for the dropdown listbox.
PERFORM build_fieldcat.
*Build layout
PERFORM build_layout.
Define a drop down table.
PERFORM dropdown_table.
*fetch values from the T517A table
SELECT * FROM t517a INTO TABLE gt_outtab.
*Display ALV output
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = gt_outtab.ENDFORM. "ALV_OUTPUT
*& Form dropdown_table
text
--> p1 text
<-- p2 text
FORM dropdown_table.*Declarations for drop down lists in ALV.
DATA: lt_dropdown TYPE lvc_t_drop,
ls_dropdown TYPE lvc_s_drop.
First SLART listbox (handle '1').
ls_dropdown-handle = '1'.
ls_dropdown-value = '01 Primary school'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '1'.
ls_dropdown-value = '02 Lower Secondary'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '1'.
ls_dropdown-value = '03 Upper Secondary'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '04 Professional School'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '05 College'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '06 University'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '09 Other Establishment'.
APPEND ls_dropdown TO lt_dropdown.* Second ABART listbox (handle '2'). ls_dropdown-handle = '2'.
ls_dropdown-value = '10 Primary School certificate'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '2'.
ls_dropdown-value = '20 Lower secondary/Junior high'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '30 High school diploma(B-levels)'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '2'.
ls_dropdown-value = '31 Vocational'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '32 Matriculation'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '40 Specialist vocational certificate'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '50 College degree Level1'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '51 College degree Level2'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '52 Masters degree'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '60 Univ Degree level1'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '61 Bachelors degree'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '62 Masters degree'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '63 Licenciate'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '64 Doctors Degree Ph.D'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '89 None'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '90 Unknown'.
APPEND ls_dropdown TO lt_dropdown.*method to display the dropdown in ALV
CALL METHOD g_grid->set_drop_down_table
EXPORTING
it_drop_down = lt_dropdown.ENDFORM. " dropdown_table
*& Form build_layout
text
*layout for ALV output
FORM build_layout . gs_layout-cwidth_opt = 'X'.
gs_layout-grid_title = 'ALV DROPDOWN LISTS'.
gs_layout-no_toolbar = 'X'.ENDFORM. " build_layout
endform.
Edited by: S.r.v.r.Kumar on Jun 1, 2009 2:48 PM -
Multiple Lines in a Single ALV Grid Cell
Is there any way to Display Multiple Lines in a Single ALV Grid Cell.
This can be accomplished by Sorting the First 3 fields and Make it Looks like below displayed format.
But My problem is while downloading also it should be Displayed in the same format.
All inputs are highly appreciated.there was a post similar to this some days back... search it..
any ways...
what u can do is...
arrange ur final internal table so that it will look like same line...
like...lets say ur internal table is :
A1 B1 C1 D1 123
A1 B1 C2 D2 123
A1 B2 C1 D1 123
A1 B2 C2 D2 123
and u can rearrange ur table to be like
A1 B1 C1 D1 123
C2 D2 123
A1 B2 C1 D1 123
C2 D2 123
what i mean to say is dont pass the fields if they are same in the previous line... try it out..
and then pass it two ur ALV.
it will look like they are in one line
Edited by: soumya prakash mishra on Jun 17, 2009 1:31 PM -
Change Layout in Selection Screen for OO ALV-Grid
Hello everyone,
I got a problem regarding layouts for objectoriented ALV Grid. I want to make it possible that user can take the layout for ALV he wants to on the selection screen. So far thats no problem and it works. But there are some little problems which I do not know how to fix them. But first the facts:
(1) I got my parameter for layout
PARAMETER: p_vari TYPE disvariant-variant.
(2) I fill my global layout structure in initialization
INITIALIZATION.
* Variante vorbelegen
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
* Layout holen
CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = gs_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc = 0.
p_vari = gs_variant-variant.
ENDIF.
(3) I got my handling for F4-value help on variant parameter
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
CALL FUNCTION 'LVC_VARIANT_F4'
EXPORTING
is_variant = gs_variant
i_save = 'A'
IMPORTING
es_variant = gs_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE text-m01 TYPE 'S'.
ELSE.
p_vari = gs_variant-variant.
ENDIF.
(4) I give back my parameters content into the variant structure at start of selection
START-OF-SELECTION.
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
gs_variant-variant = p_vari.
This works all fine but I got some problems when using default variants/layouts. For example I got a default variant only for me. When starting the selection screen it works fine that the default layout was written. It is displayed automatically in the variant parameter. But I want that if i I empty the content (blank it out) from my variant parameter, that report should start with "normal" layout how it was written in the report and NOT with default layout.
When I clear the gs_variant it works like I want it, but then the alv layout button looks like (without functions for layout), because I do not have the reference to my report.
So what to do? :-)
Regards
MichaelWow that was fast, works great, thanks :-)
I did not use this parameter in set table method but now I fill it dynamically.
Ok next problem, one step harder ;-)
Now I have one selection screen for one ALV-Grid, but four radio buttons which control with which data the ALV gets filled (four different fieldcats, data tables and so on). Each Grid got an own HANDLE so that the layouts can be separated in four categories.
Now I want that by changing the radio button the individual standard layout for the chosen alv grid is getting filled.
This works fine when using it in selection screen output.
AT SELECTION-SCREEN OUTPUT.
CLEAR gs_variant.
* Layout-Handles individuell für Klausel-Radiobuttons setzen
IF p_py IS NOT INITIAL.
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
gs_variant-handle = 'KLPY'.
ELSEIF p_rh IS NOT INITIAL.
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
gs_variant-handle = 'KLRH'.
ELSEIF p_aj IS NOT INITIAL.
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
gs_variant-handle = 'KLAJ'.
ELSEIF p_sr IS NOT INITIAL.
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
gs_variant-handle = 'KLSR'.
ENDIF.
* Layout holen
CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = gs_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc = 0.
p_vari = gs_variant-variant.
ELSE.
CLEAR p_vari.
ENDIF.
But unfortunately selection screen output is getting passed by EACH changing in the selection screen. This means when I try to clear the default layout in my parameter field, it gets refilled automatically with default layout. If I do a condition around the filling (only if not initial) the default value filling does not work fine in every case, e.g. when clearing the parameters field and then change the radiobutton -> then it does not get filled automatically. -
How can I get the selected rows from two ALV grids at the same time?
I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
How can I select the rows, then click on just one button, and process the marked entries from both grids?
Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
Thanks.Hello Tamas ,
If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
is it possible to have a check box in each grid & get the selected lines in PAI of the screen ?
regards
prabhu -
ABAPer's ,
Does anyone can guide me to select single row only in ALV grid , without OO.Hello,
I did not get u.
But check the below code it may help u.
tables: mara.
TYPE-POOLS: SLIS.
data:repid like sy-repid.
data: itb type mara occurs 0 with header line,
IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV WITH HEADER LINE,
IT_LAYOUT TYPE SLIS_LAYOUT_ALV,
ITB1 TYPE MAKT OCCURS 0 WITH HEADER LINE.
selection-screen begin of block b.
parameters: p_matnr type matnr.
selection-screen end of block b.
select * from mara into table itb where matnr = p_matnr.
SELECT * FROM MAKT INTO TABLE ITB1 WHERE MATNR = P_MATNR.
repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'HANDLE_USER_COMMAND'
I_STRUCTURE_NAME = 'MARA'
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itb
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM HANDLE_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE
SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
CLEAR IT_FIELDCAT[].
IF RS_SELFIELD-FIELDNAME = 'MATNR'.
READ TABLE ITB1 INDEX RS_SELFIELD-TABINDEX.
WRITE: / ITB1-MAKTX.
ENDIF.
ENDCASE.
ENDFORM. "HANDLE_USER_COMMAND
Regards -
How to disable multiple select option in OO ALV.?
I want to display an ALV with the multiple select button disabled.I want the "select" button at the start of each row but the "select all/deselect all" button at the right hand top corner of the display be
disabled.
Please help me out.Hi
You can add a new column to your internal table for the selection field.
After registering the required events, for eg:
METHOD alv_set_events.
DATA: lr_events TYPE REF TO cl_salv_events_table.
lr_events = mcn_alv->get_event( ).
*- Register the event Double click
SET HANDLER me->mt_on_double_click FOR lr_events.
*- Register the event User command
SET HANDLER me->mt_on_user_command FOR lr_events.
ENDMETHOD.
you can process the selected records and mark them as "Processed" by setting a color to the record.
DATA: BEGIN OF lw_farb , " Farbstruktur für ALV
farb1(1) VALUE 'C',
farb2(1),
farb3(1) VALUE '0'.
DATA: END OF lw_farb.
DATA: lf_col_bearbeiten TYPE i VALUE 5.
lw_farb-farb2 = lf_col.
ef_col = lw_farb.
Regards
Raj -
Printing Selection-Screen while printing ALV Grid output display
Hi,
I have a requirement wherein I want to print the Selection Screen also while printing the output in simple ALV grid Display.
Currently when I print the ALV output report, only the header and the Body of the ALV is getting printed. But the requirement is that I also want to print Selection screen along with this.
If anyone has faced a similar situation, plz let me know what needs to be done in order to print the selection screen also while printing the ALV report output.
Rgds,
NitinHi,
You can use given function module to print your
selection screen
RS_REFRESH_FROM_SELECTOPTIONS
>This will get Current contents of selection screen
RS_LIST_SELECTION_TABLE
>This will Generates list according to values in selection table(RSPARAMS)
Sample
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = p_repid
TABLES
selection_table = it_int_tab
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3.
IF sy-subrc EQ 0.
WRITE:1 'Selection Criteria'(i19),
/1 sy-uline(18),
/1 'Variant Name'(i21),
23 sy-slset.
*-- This function module lists the Selection Screen contents
CALL FUNCTION 'RS_LIST_SELECTION_TABLE'
EXPORTING
report = p_repid
seltext = 'X'
newpage = space
TABLES
sel_tab = it_int_tab
EXCEPTIONS
sel_tab_empty = 1
OTHERS = 2.
Mark all helpful answers -
Reset lead selection after refresh in alv grid
Hi experts,
I've a problem with holding the lead selection in an alv grid table view in web dynpro.
After changing an attribute the lead selection in the view gets lost, but is hold in the referenced context node.
Is there a way to change the lead selection in alv by code?
I've found the method "set_index()" in class CL_SALV_WD_TABLE_LEAD_SELECT, can I use that?
Thanks a lot,
KaiHi Kai,
I faced a similar problem earlier.
Request you to elaborate about the "attribute" you are changing.
I was also facing a similar issue.
It will be gr8 if I can help you.
Please see the below thread for some reference.
[Not able to select a row in ALV|Not able to select a row in ALV?;
I hope it helps.
Regards,
Sumit Oberoi -
How to get selected records from an ALV Grid in some other internal table
I am using a standard SAP program (RFKKMA02) in a Z program. Now i want to select some rows in ALV and after doing some modification, i want to store those records in some other internal table. I am not using OO concept.
Thanks in advance.u create first internal table of structur of fields that u want to copy and then move taht values to internal table
-
Can I have multiple hotspots on the same ALV grid?
Hi,
I have a simple ALV grid report with a hotspot. I can't seem to find any examples or information on whether I can have 2 hotspots on the same ALV grid line.
Is this possible and is there an example somewhere that I can look at?
Thanks for your help!
AndyCheck the code below
METHODS:set_hotspot_ebeln CHANGING pc_alv TYPE REF TO cl_salv_table
pc_report TYPE REF TO lcl_report.
*--Event Handlers for alv
METHODS:on_link_click FOR EVENT link_click OF cl_salv_events_table
IMPORTING row column .
METHOD set_hotspot_ebeln.
DATA: lf_cols_tab TYPE REF TO cl_salv_columns_table,
lf_col_tab TYPE REF TO cl_salv_column_table.
DATA: lf_events TYPE REF TO cl_salv_events_table.
lf_cols_tab = pc_alv->get_columns( ).
TRY.
lf_col_tab ?= lf_cols_tab->get_column( 'VGBEL' ).
CATCH cx_salv_not_found.
ENDTRY.
TRY.
CALL METHOD lf_col_tab->set_cell_type
EXPORTING
value = if_salv_c_cell_type=>hotspot. "5-stands for hot spot
CATCH cx_salv_data_error .
ENDTRY.
TRY.
lf_col_tab ?= lf_cols_tab->get_column( 'VBELN' ).
CATCH cx_salv_not_found.
ENDTRY.
TRY.
CALL METHOD lf_col_tab->set_cell_type
EXPORTING
value = if_salv_c_cell_type=>hotspot. "5-stands for hot spot
CATCH cx_salv_data_error .
ENDTRY.
lf_events = pc_alv->get_event( ).
*--Set event handler for click on cell
SET HANDLER lf_report->on_link_click FOR lf_events.
ENDMETHOD. "set_hotspot_ebeln
METHOD on_link_click.
DATA:la_put TYPE type_put.
READ TABLE lf_report->i_put INTO la_put INDEX row.
CHECK sy-subrc = 0.
if column = 'VGBEL'.
SET PARAMETER ID 'BES' FIELD la_put-vgbel.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
elseif column = 'VBELN'
"<----
endif.
ENDMETHOD. "on_link_click -
Get Row Data from a selected Row in an ALV Grid
Hello,
I create a Custom Control from an intern table. When i do a double click on a row, i call another dynpro. The data of the marked line should be written into an internal table.
How i implement this?
I tried things like:
Call method alv_list->GET_SELECTED_ROWS_BASE
or
Call method alv_list->GET_SELECTED_ROWSHi Sebastian,
For a double click event we need to register the double click event which goes the following way.
data: lref_alv type ref to cl_gui_alv_grid.
* after initializing ALV
SET HANDLER gref_application->handle_alv_dblclik FOR lref_alv.
Now this double click event needs to be handled in the local class.
eg:
CLASS lcl_application DEFINITION.
PUBLIC SECTION.
METHODS:
* Method to handle double click on ALV grid.............................
handle_alv_dblclik
FOR EVENT double_click
OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no.
endclass.
CLASS lcl_application IMPLEMENTATION.
* Method: HANDLE_ALV_DBLCLICK *
* Text: Event triggers when ALV grid is double clicked *
* -->e_row *
* -->e_column *
* -->es_row_no, *
METHOD handle_alv_dblclik.
data: lv_value(40) TYPE c.
* Get the value of the current cell double clicked......................
CALL METHOD gref_alv->get_current_cell
IMPORTING
e_value = lv_value
* here you can insert the values in the internal table
endmethod.
endclass.
hope this helps.
Regards,
Kinshuk -
Selection of rows in ALV grid (class CL_GRID_CATSXT)
Hi all,
The CATS transaction CATS_APPR_LITE is using the class CL_GRID_CATSXT, method GET_SELECTED_ROWS, to retrieve selected rows in the ALV report.
The user/manager selects these rows to approve the work hours registered by his subordinates. He can only select and approve those rows that have been fully expanded, meaning he cannot select and approve total lines. (If he tries to do so, nothing happens).
I have created a layout that shows only total lines per employee. Using this layout the manager should be able to select the total line for a particular employee and press the "Approve" button. In this way, I need to get a hold of the rows contained in the total line, meaning I need the row numbers of the actual rows which have been added up in the total line.
Does anyone know how to do this...? As mentioned earlier, the CATS_APPR_LITE transaction is using class CL_GRID_CATSXT, method GET_SELECTED_ROWS.
All helpful answers will be rewarded!
Best regards,
MVI guess method GET_SELECTED_ROWS returns the total lines when they are selected ?
if so, you just have to do a LOOP on your internal table having same key fields as selected total line
Maybe you are looking for
-
Can I archive photos from my iPad2 to an external hard drive?
I need to archive an ever growing photo album direct to an external hard drive - is it possible - how can I do it without connecting to my iMac?
-
Unable to access localhost from network
I can not access main page from other computers of the network. the ip of main computer is http://192.168.1.8:5050/examples/servlets/index.htmlwhen i put in connection specs of my browser then i can see it but unable to interact with database as mess
-
Call for sessions is open on: http://www.brainshare.com/ Kim - 5/2/2014 8:42:14 AM
-
As a basic exercise, I was working on this function: void PrintIntrospectionInfo () // function definition for section 4 // code for printing "introspection info" NSString *s1 = [NSString stringWithString: @"Assignment"]; NSString *s2 = [NSString str
-
instead of coming onto the site and allowing me to navigate, the Firefox site automatically updated and did a lon (more than 30 minutes) check on whether plugins were compatible. I cannot use your site if this is going to happen, as I cannot afford t