08-03-2009 3:17 PM
Hi,
with cl_gui_alv_grid i have created table in a dynpro. In layout structure SEL_MODE is 'A' gefilled.When i choose more than 1 rows, eg. i want to choose 1st and 4th row, but in the fact i must choose from 1 to 4 rows, i had to get 4 rows.
How to solve this problem?
thanks
08-03-2009 3:23 PM
08-03-2009 3:21 PM
08-03-2009 3:23 PM
08-03-2009 3:33 PM
Thanks for your replies.
i would like to explain my question. I I have to select several rows in an ALV. I'm using cl_gui_alv_grid class to construct the ALV.
The layout table is filled in this way:
g_layout-zebra = 'X'.
g_layout-cwidth_opt = 'X'.
g_layout-sel_mode = 'D'.
I have the problem that I can only select several rows using Ctrl key, and I need to do this just selecting the rows with the mouse.
Thank you.
08-03-2009 3:41 PM
Hi,
Try passing:-
SEL_MODE = 'A'.Hope this helps you.
Regards,
Tarun
08-03-2009 3:42 PM
08-03-2009 3:45 PM
Hi,
Use this for layout information:-
wa_layout-stylefname = 'CELLTAB'.
wa_layout-sel_mode = 'A'.
Regards,
Tarun
08-03-2009 3:52 PM
thanks, but i does not work too. i want to choose rows randomly more than 1 rows. How to do it?
Edited by: gang qin on Aug 3, 2009 4:55 PM
08-03-2009 3:57 PM
Hi,
I guess you are working in that ALV with the box append with each row.
Using that box you can select using CTRL button only.
If you wish to select multiple rows then proceed with a checkbox.
Keep a checkbox as a field in your internal table and use it as a selected/deselected indicator.
And pass the same code in my previous reply for layout information.
Hope this solves your problem.
Regards,
Tarun
08-03-2009 4:07 PM
08-03-2009 4:16 PM
Hi,
Refer:
TYPES : BEGIN OF t_final,
chk TYPE char01, "Check
"other field to be displayed
celltab TYPE lvc_t_styl, "Table to edit
END OF t_final.
Create an internal table of this type. Now CHK will act as the select/deselect indicator.
Create the field catalog for field CHK as:-
ls_fcat-fieldname = 'CHK'.
ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.
Now use this checkbox to select/deselect records.
You can also refer this technique using the ALV FM.
Hope this helps you.
Regards,
Tarun
08-03-2009 4:47 PM
Thanks,
but i use method set_table_for_first_display, this structure for display is already created. That means it does not be changed.
08-03-2009 5:09 PM
Hi,
You would need to add one more field in your internal table (which you are currently using) for the indicator, which will be used to identify whether a record is selected or deselected.
The link which i provided was just for reference. You need follow the same approach to add a checkbox to display in alv.
It was done using the FM.
All you need to do is to add those two more fields at the end of all fields in internal table and create field catalog for field CHK, rest code will work.
Now when you select a record in ALV, then the field CHK will have X for that record, and blank for others.
Use method to refresh the ALV display:-
refresh_table_displayLet me know if you have some doubts.
Thanks & Regards,
Tarun
08-03-2009 5:14 PM
hi, i have created 1 field in my structrure for display with SE11. and data type is c(1). but in dynpro how can i let this field shown as checkbox .
08-03-2009 5:19 PM
Hi,
Add details for that field while creating the field catalog:-
Refer:-
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-edit = 'X'.
ls_fcat-fieldname = 'CHK'.
ls_fcat-checkbox = 'X'.
ls_fcat-coltext = ''.
ls_fcat-col_pos = 1.
ls_fcat-outputlen = 3.
APPEND ls_fcat TO pt_fcat. "<<--- pass this pt_fcat in the method
CLEAR ls_fcat.
For layout use:-
v_layout-stylefname = 'CELLTAB'.
v_layout-sel_mode = 'A'.
Hope this helps you.
Regards,
Tarun
08-03-2009 5:27 PM
it cause an error. i do not know where it is?
lc_wa_fcat-tabname = 'IT_FINAL'.
lc_wa_fcat-edit = 'X'.
lc_wa_fcat-fieldname = 'CHK'.
lc_wa_fcat-checkbox = 'X'.
lc_wa_fcat-coltext = ''.
lc_wa_fcat-col_pos = 1.
lc_wa_fcat-outputlen = 3.
APPEND lc_wa_fcat TO lc_tb_fcat. "<<--- pass this pt_fcat in the method
CLEAR lc_wa_fcat.
if gl_rd_grid is not bound.
create object gl_rd_grid
EXPORTING
i_parent = gl_rd_cont.
setcolor?
lc_wa_layout-info_fname = 'LINECOLOR'.
lc_wa_layout-grid_title = space.
ls_layout-no_toolbar = 'X'.
lc_wa_layout-CWIDTH_OPT = 'X'.
lc_wa_layout-edit = 'X'.
lc_wa_layout-no_rowmove = 'X'.
lc_wa_layout-no_rowins = 'X'.
*
lc_wa_layout-stylefname = 'CELLTAB'.
lc_wa_layout-ctab_fname = 'COLORTAB'.
lc_wa_layout-zebra = 'X'.
lc_wa_layout-sel_mode = 'A'.
clear lc_wa_variant.
lc_wa_variant-report = sy-cprog.
lc_wa_variant-handle = '0001'.
call method gl_rd_grid->set_table_for_first_display
EXPORTING
is_layout = lc_wa_layout
is_variant = lc_wa_variant
i_save = 'A'
i_default = 'X'
it_toolbar_excluding = lc_tb_excl
CHANGING
it_outtab = gl_tb_output_1000
it_fieldcatalog = lc_tb_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
08-03-2009 7:32 PM
Can you please tell me what is the error you get?
Regards,
Tarun
08-03-2009 4:22 PM
In the field catalog, while you are passing the FIELDNAME, make sure, u r passing the correct field name of ur itab. and also pass SELMODE = 'A'.
This will solve.
Thanks
Kiran