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

Former Member
0 Likes
1,587

Hello friends,

In my selection screen,

I want to populate a default value based on the field SY-SYSID.

select-options : s_kunnr FOR vbak-kunnr,

s_erdat FOR vbrk-erdat.

Parameter : ID like N.

In the selection screen i want to populate a default value for the parameter - ID, based on SY-SYSID,

ANy help on this will be appericiated,

Shejal Shetty.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,551

In initialization section.

initialization.

if sy-sysid = <val>.

id = val1.

else.

id = val2.

endif.

15 REPLIES 15
Read only

Former Member
0 Likes
1,551

Hi ,

Check for the condition of SY-SYSID and store it another variable say p_sysid.

Read only

Former Member
0 Likes
1,552

In initialization section.

initialization.

if sy-sysid = <val>.

id = val1.

else.

id = val2.

endif.

Read only

0 Likes
1,551

Thanks for the reply,

However i want this value to be populated in the selection screen when i excute the program by default.

I dont understand how the INITIALIZATION action will be performed before the selection screen is displayed.

Shejal Shetty.

Read only

0 Likes
1,551

The initialization block processes before the selection screen is displayed.

Read only

0 Likes
1,551

This works:

initialization.
  concatenate '/usr/sap/xfr/' sy-sysid '/.....' into p_file.

Rob

Read only

0 Likes
1,551

Hello,

I have tried this piece of code but comes with an error message.

DATA : id1(8) type n.

Parameter : ID like n default id1.

INITIALIZATION.

if sy-sysid = 'PRD'.

id1 = '00034665'.

else.

id1 = '00034678'.

endif.

Is this piece of code is right,

Thanks for all the help,

Shejal Shetty.

Read only

0 Likes
1,551

Change

Parameter : ID like n default id1.

to

Parameter : ID1(8) type n.

Read only

0 Likes
1,551

wrong:

try this way:

DATA : id1(8) type n.

Parameter : ID(8) type n.

INITIALIZATION.

if sy-sysid = 'PRD'.

id = '00034665'.

else.

id = '00034678'.

endif.

Read only

0 Likes
1,551

DATA : id1(8) type n.

Parameter : ID like id1 default id1.

INITIALIZATION.

if sy-sysid = 'PRD'.

ID = '00034665'. Change ID1 to ID(Parameter)

else.

ID = '00034678'.

endif.

Read only

0 Likes
1,551

Hi Shejal,

This is the correct way:

Parameter : ID1(8).

INITIALIZATION.

if sy-sysid = 'PRD'.

id1 = '00034665'.

else.

id1 = '00034678'.

endif.

Regards,

Vivek

Read only

0 Likes
1,551

Do you mean:

DATA : id1(8) TYPE n.

PARAMETER : id LIKE id1.

INITIALIZATION.

  IF sy-sysid = 'FIS'.
    id = '00034665'.
  ELSE.
    id = '00034678'.
  ENDIF.

Rob

Read only

0 Likes
1,551

Thanks Vivek,

Got it in the method you specified.

Thanks all again for all the help.

Shejal Shetty.

Read only

Former Member
0 Likes
1,551

Hi Shejal,

Please try this.

PARAMETER: P_ID LIKE SY-SYSID DEFAULT SY-SYSID.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,551

Hi ,

you can assign default value either at

initialization event or at selection-screen output.

first initialization-selection-screen output->

at selection-screen event s fired.

initialization.

id = sy-sysid.

or

at selection-screen output

id = sy-sysid.

Regards

Amole

Read only

Former Member
0 Likes
1,551

Hi,

Please try this.

PARAMETER : P_ID TYPE NUM08.
                                                                     
INITIALIZATION.
  IF SY-SYSID = 'PRD'.
    P_ID = '00034665'.
  ELSE.
    P_ID = '00034678'.
  ENDIF.