‎2010 Jan 18 9:03 PM
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
‎2010 Jan 19 4:56 AM
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
‎2010 Jan 18 10:05 PM
‎2010 Jan 19 4:56 AM
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