08-22-2007 9:54 AM
Hello Experts,
The users of my report wants to have a save layout option in my ALV but I am having a
problem on how to show/enable it. I am using OO ALV and container in my program. I tried adding
the I_SAVE = 'X' in the exporting parameter but it does not work. Below is the code where I call
the ALV display:
* Display initial window
CALL METHOD grid1->set_table_for_first_display
EXPORTING
* i_structure_name = ''
is_layout = gs_layout
i_save = 'X'
CHANGING
it_outtab = gt_output
it_fieldcatalog = gt_fieldcat.
Am I lacking some parameters to be passed? Hope you can help me guys. Thank you and take care!
08-22-2007 9:59 AM
Hi,
You need to pass another parameter - IS_VARIANT
here pass theprogram name to DISVARIANT-REPORT .
you can turn the I_SAVE = 'X'.
In OO ALV untill and unless you specify the prog name here , the ALV grid wont know where does the variant point to .
hope it helps.
08-22-2007 9:59 AM
Hi,
You need to pass another parameter - IS_VARIANT
here pass theprogram name to DISVARIANT-REPORT .
you can turn the I_SAVE = 'X'.
In OO ALV untill and unless you specify the prog name here , the ALV grid wont know where does the variant point to .
hope it helps.
08-22-2007 10:00 AM
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_VARIANT = LS_VARIANT "added by me
I_SAVE = 'A'
I_DEFAULT = 'X'
is_layout = gs_layout
IS_PRINT = wa_print
IT_SPECIAL_GROUPS = it_sp_group[]
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
CHANGING
IT_OUTTAB = GT_LST[]
IT_FIELDCATALOG = GT_FIELDCATALOG
IT_SORT = it_sort[]
.
reward if useful
08-22-2007 10:02 AM
Hello,
Please have a look.
Declaration.
----------------
<b>gst_layout TYPE lvc_s_layo.</b>
Layout settings
*----
<b> gst_layout-zebra ='X'.
gst_layout-cwidth_opt = 'X'.</b>
Calling the method set_table_for_first_display
*----
CALL METHOD cust_alv->set_table_for_first_display
EXPORTING
is_layout = gst_layout
CHANGING
it_outtab = gt_list
it_fieldcatalog = gt_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Reward if helpful,
Regards,
LIJO
08-22-2007 10:02 AM
Hi,
You will have to use the parameter 'is_variant'. This is of type <i>disvariant</i>. .
Look at the code below
<b>* For parameter IS_VARIANT
l_layout TYPE disvariant.
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'</b>
Thanks..
Preetham S
08-22-2007 10:11 AM
Hi Viraylab,
<b> No need of using any FM</b>.SAP has proved option........for this problem.
I too faced with the same situation.I prepared a document and sent to client on
" How to set the option to save layouts ?" .
Give your mail id I will send you the document.OK.
My mail id is "raghavender.vadakattu@yash.com".
<b>
Reward all helpful answers</b>
Regards,
V.Raghavender.
08-22-2007 10:14 AM
Hello,
You are discussing about
Layout settings inside ALV
Or
Layout Variant?
regards,
LIJO.
08-22-2007 10:33 AM
Like this -
data : l_vari type DISVARIANT
l_vari-report = 'ZTEST1' "Your prog name
Display initial window
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = ''
is_layout = gs_layout
i_save = 'X'
IS_VARIANT = l_vari
CHANGING
it_outtab = gt_output
it_fieldcatalog = gt_fieldcat.