Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Question regarding save layout for OO ALV...

aris_hidalgo
Contributor
0 Kudos

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!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

7 REPLIES 7

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hello,

You are discussing about

Layout settings inside ALV

Or

Layout Variant?

regards,

LIJO.

Former Member
0 Kudos

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.