Application Development and Automation 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: 
Read only

Layout Issue In ALV Grid

Former Member
0 Likes
4,377

Dear All,

I have made an editable ALV andafter entreing data and successful update it will show another ALV.

The issue is that user has saved different Layouts for the 2 ALV's and made it user specific. But again when the report is executed then the 2 saved layouts are not coming.

The respective layout should come for the 2 ALVs.

Thanks & Regards,

Bharti Jain

Dear All,

I have made an editable ALV andafter entreing data and successful update it will show another ALV.

The issue is that user has saved different Layouts for the 2 ALV's and made it user specific. But again when the report is executed then the 2 saved layouts are not coming.

The respective layout should come for the 2 ALVs.

Thanks & Regards,

Bharti Jain

7 REPLIES 7
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,575

After creating a user specific layout through ALV layout management , mark it as default there itself ( Green Tick mark enabled against the layout ).

Now while calling the ALV pass DEFAULT = 'X'.

Hope this helps.

Read only

Former Member
0 Likes
2,575

Thanks For Prompt Reply,

I have set 1 Layout for first alv as user specific and for second ALV amother layout with user specific and default specific.

For Second ALV it is working fine. For first it is not showing the saved ALV. Now similar to 2nd if I make the Layout as default and user specific for 1st then it is not working. it is showing the layout of second.

I have made default = 'X' in FM.

Regards,

Bharti Jain

Read only

0 Likes
2,575

Now i got your problem. This wiki will solve your problem [Create unique handle for ALV layout (variant)|http://wiki.sdn.sap.com/wiki/display/Snippets/CreateuniquehandleforALVlayout%28variant%29] ...Thanks to Clemens

Read only

former_member226225
Contributor
0 Likes
2,575

Hi, let us try with the following code,

type-pools SLIS.

data : lv_vbeln type vbak-vbeln.

select-options : so_vbeln for lv_vbeln.

initialization.

so_vbeln-low = '4970'.

so_vbeln-high = '4975'.

append so_vbeln.

types : begin of ty_vbak,

vbeln type vbak-vbeln,

erdat type vbak-erdat,

erzet type vbak-erzet,

ernam type vbak-ernam,

end of ty_vbak.

data : lt_vbak type standard table of ty_vbak,

ls_vbak type ty_vbak.

data : ls_variant like DISVARIANT.

data : ls_layo type SLIS_LAYOUT_ALV.

data : lt_fcat type SLIS_T_FIELDCAT_alv.

start-of-selection.

perform getvbak.

if sy-subrc eq 0.

perform displayvbak.

endif.

FORM GETVBAK .

select vbeln erdat erzet ernam from vbak

into table lt_vbak

where vbeln in so_vbeln.

ENDFORM. " GETVBAK

FORM DISPLAYVBAK .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = sy-repid

I_STRUCTURE_NAME = 'ZMYVBAk'

IS_LAYOUT = ls_layo

IT_FIELDCAT = lt_fcat[]

I_SAVE = 'X'

IS_VARIANT = ls_variant

TABLES

T_OUTTAB = lt_vbak[].

ENDFORM. " DISPLAYVBAK

After execution select the fields which you want to hide and after that goto SETTINGS menu -->Layout --->save it

it will ask the save variant and name .

After that goto layout management and select the variant which you created and execute the alv program

then you can observe the fields will hide .

Thanks & Regards,

Raghunadh . K

Read only

Former Member
0 Likes
2,575

I have little bit idea of OO ALV. Can we have another method of doing it.

Regards,

Bharti Jain

Read only

0 Likes
2,575

In ALV function module there is a parameter IS_VARIANT. It has a parameter called handle , pass 'ALV1' for first and 'ALV2' for second and try. The function will provide you the details within the report REUSE_ALV_VARIANT_DEFAULT_GET. Please read the documentation of parameter IS_VARIANT

Read only

0 Likes
2,575

hi,

in DISVARIANT structure we have a field LOG_GROUP .

Maintain LOG_GROUP for each list

like

1st list

LOG_GROUP = 'LIS1'.

2nd list

LOG_GROUP = 'LIS2'.