‎2008 Mar 17 12:56 PM
Hi friends,
i have a simple requirement, when i run VKM1 - Sd Blocked documents for a particular credit control area it gives some data.
when i go to choose button, i have 6 layouts to see the report. Out of this for one i have added a new column(from the existing fields only). Now i want to make this as the default layout whenever a user(any user) runs this report.
Thanks in Advance
Sadhu Kishore
‎2008 Mar 17 1:00 PM
hi when you are calling alv,
there will be one option to pass the varient.
take a work area are similar to that varient and
set the layout name there and pass to alv, it will always display the layout which you want .
‎2008 Mar 17 1:02 PM
Hi,
check the follwing code. U can change layout and save it as default.
Display Variant
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-t45.
PARAMETERS: p_vari LIKE disvariant-variant.
SELECTION-SCREEN END OF BLOCK b5.
INITIALIZATION.
gf_repid = sy-repid.
gf_save = 'A'.
PERFORM variant_init.
Get default variant
gwa_variant1 = gwa_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = gf_save
CHANGING
cs_variant = gwa_variant1
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = gwa_variant1-variant.
ENDIF.
Process on value request
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM f4_for_variant.
PAI
PERFORM pai_of_selection_screen.
&----
*& Form variant_init
&----
To set report name
----
FORM variant_init .
CLEAR gwa_variant.
gwa_variant-report = gf_repid.
ENDFORM. " variant_init
&----
*& Form f4_for_variant
&----
F4 help for variant
----
FORM f4_for_variant .
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gwa_variant
i_save = gf_save
IMPORTING
e_exit = gf_exit
es_variant = gwa_variant1
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF gf_exit = space.
p_vari = gwa_variant1-variant.
ENDIF.
ENDIF.
ENDFORM. " f4_for_variant
&----
*& Form pai_of_selection_screen
&----
Checking for variant existence
----
FORM pai_of_selection_screen .
IF NOT p_vari IS INITIAL.
MOVE gwa_variant TO gwa_variant1.
MOVE p_vari TO gwa_variant1-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = gf_save
CHANGING
cs_variant = gwa_variant1.
gwa_variant = gwa_variant1.
ELSE.
PERFORM variant_init.
ENDIF.
ENDFORM. " pai_of_selection_screen
gf_repid = sy-repid.
To get list detail,
IF p_list IS NOT INITIAL.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' "#EC *
EXPORTING
i_callback_program = gf_repid
is_layout = gwa_layout
it_fieldcat = gt_catalog
it_sort = gt_sort
it_events = gt_events
i_save = gf_save
is_variant = gwa_variant
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = gt_line
EXCEPTIONS
program_error = 1
OTHERS = 2.
Reward if helpful.
Regards,
Ramya
‎2008 Mar 17 1:03 PM
ALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = grid_layout
is_variant = s_variant
i_save = 'A'
CHANGING
it_outtab = t_output
it_fieldcatalog = t_datfld.
in s_varient pass the required layout name.
‎2008 Mar 26 6:17 PM
Hi friends,
thanks for the responses. To meet my requirement no programming effort was required, i could do it just by selecting choose > the required layout. Then go to menu select > settings > Layout > Administration > select the required layout > save it to make it defaulted always.
Thanks
Sadhu Kishore
‎2008 Mar 26 6:57 PM
hi ,
you can do by using the different varients ...if u choose a variant1 it had 3 fields and it u use the varient2 it had 5 fields then u r getting different layouts ...
regards,
venkat
‎2008 Mar 26 7:19 PM
sorry venkat... thats not my requirement. as i explained, thats how i could meet my requirement and its done now.
thanks to all