‎2009 Apr 25 5:28 AM
Hi friends,
I am having a selection screen .say for eg:
parameters : P-Pernr type smthg,
P_bukrs type smthg,
Select-options : s_werks type smthg..
Now the Requirement is that when user logins to execute the report
the user-specific values or user specific variants should appear.in the selection screen.
say for eg: if user abc logs-in then only his variant shld appear or his default values shld be automatically filled in the selection screen.
Now can dis be done using screen or transction varaints..?
If yes , then How..?
any sort of help wld be appreciated..
Thanks,
Neel
‎2009 Apr 25 5:35 AM
Hi
in Selection screen use DEFAULT and pass the value....
Eg:
SELECT-OPTIONS: s_matnr FOR mara-matnr DEFAULT 'X'.
Regards
Smitha
‎2009 Apr 25 5:39 AM
HI ,
Its ok 2 use the Default keyword , but the value shld be user-specific.. for eg..
if user abc logins then the default value shld be displayed else not.
Thanks,
Neel
‎2009 Apr 25 6:22 AM
Hi,
Yes you can defenetly do this but this will leed to lot of cases, you can do this in INITIALIZAION event of the ABAP events,
check for the user,
when 'us1'
pass the varient.
when 'us2'.
pass the varr.
like this yiou can pass in initialization event.
but will have lot of cases.
Thanks and Regards,
Varun.K
‎2009 Apr 25 6:28 AM
HI varun,
Thanks for the Reply but how do i pass the variant..?
can u gimm'e a sample code..?
Thanks,
Neel
‎2009 Apr 25 6:40 AM
Hi Neel,
In the initialization event you can fetch the variant name for an user from the table VARID....by passing the program name and user name.
Then in the FM /OSP/REPORT_GET_VARIANT_DETAIL pass the program name, variant name and user name....
This will return you the values stored for that variant in an internal table. You can read the values of each field from the internal table and move them correspondingly...
Hope this resolves your query.
Regards,
Nikhil
‎2009 Apr 27 5:08 AM
HI Nikhil,
Thanks for ur reply ..But can u gimm'e a sample code for how to pass the fetched data from
the function module to selection screen..?
Thanks,
Neel.
‎2009 Apr 27 5:35 AM
Hi Neel,
You can try out this code.
parameters : P_Pernr type smthg,
P_bukrs type smthg,
Select-options : s_werks type smthg..
data: t_VALUETAB type /OSP/TT_REP_VAR_NAMEVALUEPAIRS
wa_value type .
At initialization.
select VARIANT
into v_varid
from varid
where REPORT = 'Program_Name'
and AENAME = sy-uname.
CALL FUNCTION '/OSP/REPORT_GET_VARIANT_DETAIL'
EXPORTING
iv_report_name = Program_Name
iv_variant = v_varid
IMPORTING
ET_VALUETAB = t_VALUETAB.
if t_valuetab is not initial.
read table t_valuetab into wa_value
with key selname = 'P_PERNR'.
P_PERNR = wa_value-low.
read table t_valuetab into wa_value
with key selname = 'S_WERKS'.
S_WERK-low = wa_value-low.
S_WERK-high = wa_value-high.
endif.
at start-of-selection.
Regards,
Nikhil
‎2009 Apr 27 5:41 AM
Hi Nkihil Iyear,
Use the table VARID. It will help you out.
Give the report name which you get it from Sy-cprog.
Give the username which you get it from sy-uname.
Get the name of the variant.
And proceed with the FM RS_VARIANT_CONTENTS
‎2009 Apr 27 5:51 AM
Neel Iyer,
You got the problem resolved? Let me know
Thanks,
Babu Kilari
‎2009 Apr 27 5:53 AM
hey you can use this
https://wiki.sdn.sap.com/wiki/display/Snippets/setdefaultvarient+inreports
hope it helps
cheers
s.janagar