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

loading user defined variants for selection screens

Former Member
0 Likes
2,241

hi everybody,

i want to add a feature to my report which automatically loads a variant for a report.just like iw38, where the variant for the main selection-screen is automatically set when you name it like "U_<username>". sadly i couldnt find anything helpful by debugging the report.

is there a certain function module to load specific screen-variants?

thanks,

dsp

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,214

Hi dsp,

There is a table

VARID - Variant directory.

it consists of all the variants according to the user name, date & time.

You can do something like this,

data: it_variant type standard table of varid,

wa_variant type varid.

Initialization.

select * into corresponding fields of table it_variant

from varid

where report = sy-repid

and ename = sy-uname.

sort it_variant descending by edat etime.

delete adjacent duplicates from it_variant comparing ename.

loop at it_variant into wa_variant.

*CLEAR W_VARIANT.

*W_VARIANT = wa_variant.

CALL FUNCTION 'RS_SUPPORT_SELECTIONS'

EXPORTING

report = sy-repid

variant = wa_variant-variant

  • EXCEPTIONS

  • VARIANT_NOT_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.

endloop.

Hope it helps you,

Regards,

Abhijit G. Borkar

2 REPLIES 2
Read only

Former Member
0 Likes
1,214

You can use FM RS_SUPPORT_SELECTIONS

Rob

Read only

Former Member
0 Likes
1,215

Hi dsp,

There is a table

VARID - Variant directory.

it consists of all the variants according to the user name, date & time.

You can do something like this,

data: it_variant type standard table of varid,

wa_variant type varid.

Initialization.

select * into corresponding fields of table it_variant

from varid

where report = sy-repid

and ename = sy-uname.

sort it_variant descending by edat etime.

delete adjacent duplicates from it_variant comparing ename.

loop at it_variant into wa_variant.

*CLEAR W_VARIANT.

*W_VARIANT = wa_variant.

CALL FUNCTION 'RS_SUPPORT_SELECTIONS'

EXPORTING

report = sy-repid

variant = wa_variant-variant

  • EXCEPTIONS

  • VARIANT_NOT_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.

endloop.

Hope it helps you,

Regards,

Abhijit G. Borkar