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

Selection screen fields

Former Member
0 Likes
1,204

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

10 REPLIES 10
Read only

Former Member
0 Likes
1,172

Hi

in Selection screen use DEFAULT and pass the value....

Eg:

SELECT-OPTIONS: s_matnr FOR mara-matnr DEFAULT 'X'.

Regards

Smitha

Read only

0 Likes
1,172

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

Read only

0 Likes
1,172

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

Read only

0 Likes
1,172

HI varun,

Thanks for the Reply but how do i pass the variant..?

can u gimm'e a sample code..?

Thanks,

Neel

Read only

Former Member
0 Likes
1,172

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

Read only

0 Likes
1,172

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.

Read only

0 Likes
1,172

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

Read only

0 Likes
1,172

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

Read only

0 Likes
1,172

Neel Iyer,

You got the problem resolved? Let me know

Thanks,

Babu Kilari

Read only

Former Member
0 Likes
1,172

hey you can use this

https://wiki.sdn.sap.com/wiki/display/Snippets/setdefaultvarient+inreports

hope it helps

cheers

s.janagar