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

Parameter with condition

former_member254358
Participant
0 Likes
1,155

Hi,

first of all I'm sorry because probably this question has been answered in other threads but I don't find this.

I have this :

parameters: pidi like T002-spras obligatory default '1'.

but I would like to put a default value depending on sy-uname. If possible it would be something like this:

parameters: pidi like T002-spras obligatory if sy-uname eq 'usr1' default '1' elseif sy-uname eq 'usr2' default 'EN'.

Thanks in advantage.

Regards.

7 REPLIES 7
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,110

Read documentation of INITIALIZATION statement.

Regards,

Raymond

Read only

0 Likes
1,110

Thanks,

it's clear.

Read only

0 Likes
1,110

But why a hard coded list of users, when usually we use language USR01-LANGU (default) or SY-LANGU (logon) ?

Regards,

Raymond

Read only

0 Likes
1,110

It could be another option.

But in my case, this abap code is for shipments and because most of the shipments are now for China it's necessary that the default language would be in Chinese.

Thansk Raymond.

Read only

Former Member
0 Likes
1,110

Hi,

Sample Code:

parameters pidi like T002-spras  obligatory.

INITIALIZATION.
if sy-uname = 'usr1'."username1
pidi = 'DE'.
elseif sy-uname = 'usr2'."username2
pidi = 'EN'.
endif.


Regards,

Pallavi

Read only

0 Likes
1,110

And if sy-uname is not in that list?

PARAMETERS: pidi type sylangu obligatory default sy-langu.

Rob

Read only

0 Likes
1,110

Hi,

Of course in the else condition one may assign as:

else.

pidi  = sy-spras." Or whatever language is required
endif.


Regards,

Pallavi