2016 Mar 10 7:56 AM
Hi all
How to get the sorted column field from alv grid outside from program?
As you can see above, I have a program a and I set a layout variant.
Now I want to read in program b the layout variant from a and all the sorted column.
How can I do that?
Thanks
try FM LVC_VARIANT_SELECT.
call function 'LVC_VARIANT_SELECT'
exporting
i_dialog = ' '
i_user_specific = 'X'
it_default_fieldcat = gt_fields
importing
et_fieldcat = gt_fields
et_sort = gt_sort
tables
it_data = it_items
changing
cs_variant = ls_vari
exceptions
others = 0.
Regards,
Raymond
2016 Mar 10 8:33 AM
Have a look at the function modules that start with LT_VAR* - there might be one there to help.
Rich
2016 Mar 10 8:54 AM
2016 Mar 10 11:36 AM
I've tried with the function module as you mentioned above, but it does not work at all.
2016 Mar 10 12:34 PM
2016 Mar 10 9:11 AM
USE this FM : REUSE_ALV_VARIANT_F4
here just pass program name in structure DISVARIANT
2016 Mar 10 11:54 AM
Hi Anujit ,
variant-report = program A. when you set variant to is_variant it should come.
call method g_alvgrid->set_table_for_first_display
exporting
is_layout = gs_layout
it_toolbar_excluding = gt_exclude
is_variant = variant
i_save = 'A'
changing
it_outtab = gt_obj[]
it_fieldcatalog = gt_fieldcat
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
2016 Mar 14 9:16 AM
Hi Anujit,
Pls try the below .
DATA: rs_variant LIKE disvariant
.
SELECTION-SCREEN BEGIN OF BLOCK block WITH FRAME TITLE text-003.
PARAMETERS: p_vari TYPE slis_vari.
SELECTION-SCREEN END OF BLOCK block.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
rs_variant-report = sy-repid.
rs_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = rs_variant
i_save = 'A'
IMPORTING
es_variant = rs_variant
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
p_vari = rs_variant-variant.
ENDIF.
Regards,
Kabil.G
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |