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

ALV Layout Variant Issue

Former Member
0 Likes
2,875

Hi Gurus,

In my ALV report there are two Layout variants.

a) Default Layout - /DEFAULT created by someone else earlier.

b) User specific - created and saved by me (name CS Layout)

I am using this function module

 alv_variant-report = sy-repid.
  alv_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      i_save     = 'U'
    CHANGING
      cs_variant = xalv_variant
    EXCEPTIONS
      not_found  = 2.
  IF sy-subrc = 0.
    p_vari = xalv_variant-variant.
  ENDIF.

PROBLEM: Even though I am passing user specific information to this FM, but it is returning me the Default layout, but

I want the user specific layout(CS Layout) which I created and saved.

Please help !

Hi Gurus,

In my ALV report there are two Layout variants.

a) Default Layout - /DEFAULT created by someone else earlier.

b) User specific - created and saved by me (name CS Layout)

I am using this function module

 alv_variant-report = sy-repid.
  alv_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      i_save     = 'U'
    CHANGING
      cs_variant = xalv_variant
    EXCEPTIONS
      not_found  = 2.
  IF sy-subrc = 0.
    p_vari = xalv_variant-variant.
  ENDIF.

PROBLEM: Even though I am passing user specific information to this FM, but it is returning me the Default layout, but

I want the user specific layout(CS Layout) which I created and saved.

Please help !

19 REPLIES 19
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,205

In selection screen output set the default variant using REUSE_ALV_VARIANT_DEFAULT_GET

Provide value request help using REUSE_ALV_VARIANT_F4

Set the display variant before calling ALV display using REUSE_ALV_VARIANT_SELECT

Read only

0 Likes
2,205

Can you please explain in more detail ?

Thanks

Read only

0 Likes
2,205

You have to set it using REUSE_ALV_VARIANT_SELECT

Read only

0 Likes
2,205

Can you please show me how to set it !

Read only

0 Likes
2,205

Im sorry i didnt get your question clearly before

Can you check it with 'A' and see whether it returns all the layouts.

Read only

0 Likes
2,205

It was initially 'A' only.

Not working with 'A' also.

Read only

0 Likes
2,205

The source code inside FM is


 case i_save.
    when 'A' or 'U'.------------>'A' or 'U'
      l_user_specific = 'X'.
    when 'X' or space.
      l_user_specific = space.
    when others.
      message e533(0k) with i_save raising wrong_input.
  endcase.

Its the same whether you pass U or A

Regards,

Lakshman.

Read only

0 Likes
2,205

Ignore my reply..

Edited by: Pawan Kesari on Dec 31, 2009 4:13 PM

Read only

0 Likes
2,205

Understood lakshman

Then what should I pass now ?

Please help

Read only

0 Likes
2,205

Hi Chandan,


alv_variant-report = sy-repid.
  alv_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      i_save     = 'U'
    CHANGING
      cs_variant = xalv_variant
    EXCEPTIONS
      not_found  = 2.
  IF sy-subrc = 0.
    p_vari = xalv_variant-variant---------->What does this variable contain.
  ENDIF.

You are not populating any value to the variable xalv_variant,again you are passing it again to p_vari.

Check this link once.

[REUSE_ALV_GRID_DISPLAY - layout variant|;

Have a look at rich's reply

Regards,

Lakshman.

Read only

0 Likes
2,205

That FM will return LAYOUT.....

P_vari will contain the Layout and Layout text along with report name.

That is the issue, the FM is returning DEFAULT layout and not the one I created.

Read only

Former Member
0 Likes
2,205

Hi Chandan,

Do not pass the program name using sy-repid. Hard code the value of the program and then pass.

The problem here is sy-repid changes once it enters into the function module.

Go through this standard program once BCALV_GRID_09

Regards,

Lakshman.

Edited by: Lakshman N on Dec 31, 2009 11:07 AM

Read only

0 Likes
2,205

sy-repid is okay. I checked . It is not changing.

I guess the issue is somewhere else.

Please help

Edited by: chandan sinha on Dec 31, 2009 11:10 AM

Read only

0 Likes
2,205

You are populating the variable alv_variant and passing xalv_varaint to the FM.

Is it correct?

Regards,

Lakshman

Read only

0 Likes
2,205

Yes lakshman....

Read only

Former Member
0 Likes
2,205

Hi Chandan ,

When you created the user specific variant , did you set it the default varaint for the user . if not please set it as the default varaint for the user and check if it works fine.

Regards,

Arun

Read only

0 Likes
2,205

Hi Arun

Can u please tel me how to set it ?

example !

Thanks

Read only

0 Likes
2,205

Hi Chandan ,

If i remember it correctly , when you create the varaint , in the screen where you enter the varaint name and other details there is a check box ,to set the varaint as default ,please check if this is correct or not.

Regards,

Arun

Read only

Former Member
0 Likes
2,205

I have awarded points to Lakshman.

Issue solved.

Reason: Need to SAVE layouts with DEFAULT SETTINGS. Only then the FM will return user specific layout variants.

Anyways thanks a lot to all you folks.