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

ALV Report

Former Member
0 Likes
1,209

In an Alv report i have a selection screen with the name city field so defaultly i should get the city name in the field.so the customer has different branches in india if delhi customer enters in to that report he should see delhi location as default and if hyderabad branch customer enters in to the same report he should get hyderabad as city how can i acheive it.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,183

HI,

Depending on the Userid the Default value of the selection screen field has to be chaged.

Get the user id from SY-USRID and fetch the Loction from USR03 table.

In an Alv report i have a selection screen with the name city field so defaultly i should get the city name in the field.so the customer has different branches in india if delhi customer enters in to that report he should see delhi location as default and if hyderabad branch customer enters in to the same report he should get hyderabad as city how can i acheive it.

7 REPLIES 7
Read only

Former Member
0 Likes
1,183

You can Set default for the selection screen in Initialization Event :

parameters: CITY(30) type c.
INITIALIZATION.
"Sy-uname will give you the use name.
"Use select query and get the city name .Check usr* table to get the city
City = 'DELHI'.

Regards,

Gurpreet

Read only

0 Likes
1,183

In an Alv report i have a selection screen with the name city field so defaultly i should get the city name in the field.so the customer has different branches in india if delhi customer enters in to that report he should see delhi location as default and if hyderabad branch customer enters in to the same report he should get hyderabad as city how can i acheive it.i need to acheive it dynamically rather static

Read only

Former Member
0 Likes
1,183

For defaulting, u can use DEFAULT key word itself.

or user specific varinats, then u can hv LAYOUTs.

to get quick&effective responses, pls. keep ur thread title more meaningful.

thanq

Read only

Former Member
0 Likes
1,184

HI,

Depending on the Userid the Default value of the selection screen field has to be chaged.

Get the user id from SY-USRID and fetch the Loction from USR03 table.

Read only

0 Likes
1,183

In an Alv report i have a selection screen with the name city field so defaultly i should get the city name in the field.so the customer has different branches in india if delhi customer enters in to that report he should see delhi location as default and if hyderabad branch customer enters in to the same report he should get hyderabad as city how can i acheive it.

Could anyone of you please share the valuable inputs on this. If anyone has the sample code to do this, please share.

Read only

0 Likes
1,183

Hi Saeed,

Try the below steps. You should write the below code at INITIALIZATION EVENT only as you want to default the city field.

1. Get the SY-USRID (The user id executing the program)

2. Find out which city this user belongs to (Check out table USR01 / USR03)

3. Assign the city value obtained in step 2 to the city field.

Cheers,

Pritam

Edited by: PRITAM MOHANTY on Mar 24, 2009 1:55 PM

Read only

former_member156446
Active Contributor
0 Likes
1,183

Try this : try using set country as well...

DATA: def TYPE bezei.
PARAMETER: p_land1 TYPE ort01.

INITIALIZATION.

*AT SELECTION-SCREEN OUTPUT.
  SELECT SINGLE bezei
    INTO def
    FROM t005h
    WHERE spras = 'E'
    AND land1 = 'US'  " pass the appropriate fields..
    AND regio = 'OH'
    AND cityc = '0002'.
  IF sy-subrc EQ 0.
    p_land1 = def.
  ENDIF.