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

Problem with setting default variant

Former Member
0 Likes
1,563

Can any one tell me how to set a variant as default on the selection screen.

I created a variant and on the parameter for the selection screen i wrote:

PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT default '/DEFAULT'.

but this is not working.

I want default variant to turn on the selection screen.

Please help.

Thanks,

Amit

9 REPLIES 9
Read only

suresh_datti
Active Contributor
0 Likes
1,285

Did you pass the parameter value to the ALV? ie something like..

data rec_variant        type disvariant.

  rec_variant-report = sy-repid.                            
  rec_variant-variant = p_vari.   

  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      is_variant                  = rec_variant             
      -----
      ---

~Suresh

Read only

0 Likes
1,285

I have problem with the selection screen initialization. The default parameter value is not appearing on the screen.

Read only

0 Likes
1,285

Hi

- Try to pass it in INITIALIZATION event by MOVE statament:

MOVE '/DEFAULT' TO P_VARI.

or try this code:

INITIALIZATION.

GX_VARIANT-REPORT = SY-REPID.

GX_VARIANT-USERNAME = SY-UNAME.

CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'

EXPORTING

I_SAVE = 'A'

CHANGING

CS_VARIANT = GX_VARIANT

EXCEPTIONS

WRONG_INPUT = 1

NOT_FOUND = 2

PROGRAM_ERROR = 3

OTHERS = 4.

IF SY-SUBRC = 0.

P_VARI = GX_VARIANT-VARIANT.

ELSE.

CLEAR GX_VARIANT.

ENDIF.

Read only

Former Member
0 Likes
1,285

Hi,

I tried the same code..This is working fine for me..

PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT default '/DEFAULT'.

Do you have any initialization event that clears the parameter P_VARI..Check..

Thanks,

Naren

Read only

Former Member
0 Likes
1,285

Hi,

try at at selection-screen output event.

Regards

Amole

Read only

Former Member
0 Likes
1,285

Amit,

Try the below logic:

REPORT ysadn.

PARAMETERS: p_anlage TYPE anlage.

INITIALIZATION.

DATA: i_valutab TYPE rsparams OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'RS_VARIANT_CONTENTS'

EXPORTING

report = sy-repid

variant = 'SAMPLE'

TABLES

valutab = i_valutab

EXCEPTIONS

variant_non_existent = 1

variant_obsolete = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

READ TABLE i_valutab WITH KEY selname = 'P_ANLAGE'.

IF sy-subrc = 0.

p_anlage = i_valutab-low.

ENDIF.

Regards,

Prakash.

Read only

Former Member
0 Likes
1,285

Hi

First save the layout once you execute the program and name it as '/DEFAULT'. When you save the layout it will ask you layout name and click the check box default setting.

Next time when you execute the program the default layout varaint will display on the selection screen.

Nataraju

Read only

Former Member
0 Likes
1,285

At the INITIALIZATION event, execuyte FM RS_SUPPORT_SELECTIONS.

Rob

Read only

Former Member
0 Likes
1,285

Hi,

try at at selection-screen output event.

write the move statement in the at selection-screen output event

i hope it will work.

All The Best

Priyanka

Do reward Points