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

SET PARAMETER ID

Former Member
0 Likes
791

Hello Friends ,

I am trying to use the parameter id in my dialog programing . Whenever the user enters the wrong building name it should subsitute from the user's own data .

The screen field is zbuilding-key. If user enter the wrong key it should substitute from user profile and not allow user to change .I have created a Parameter Id zkey in the TPARA TABLE. Please advise . A code snippet will be helpful .

Note:I looked at some programs and found the following code but didnt know how it had been coded.In the code below before or after in the whole program there is not set or get parid . How does the code below work ?

SELECT SINGLE parva

INTO usr05-parva

FROM usr05

WHERE parid = 'BMW' AND

bname = sy-uname.

IF sy-subrc = 0.

IF usr05-parva NE zplant-werks.

zplant-werks = usr05-parva.

MESSAGE e113.

EXIT.

ENDIF.

ENDIF.

Thanks & Regards,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
713

Hi

That code reads the user parameter BMW, it's the same thing if you write:

GET PARAMETER ID 'BMW' FIELD _WERKS.
IF SY-SUBRC = 0.
   IF _WERKS <> ZPLANT-WERKS.
     MESSAGE E.....
   ENDIF.
ENDIF.

Max

4 REPLIES 4
Read only

Former Member
0 Likes
714

Hi

That code reads the user parameter BMW, it's the same thing if you write:

GET PARAMETER ID 'BMW' FIELD _WERKS.
IF SY-SUBRC = 0.
   IF _WERKS <> ZPLANT-WERKS.
     MESSAGE E.....
   ENDIF.
ENDIF.

Max

Read only

0 Likes
713

Thanks Max . But I need to also check the user name . sy-uname . How do I include that in the condition ?

Thanks ,

Hari

Read only

0 Likes
713

HI Hari,

In your User Profile (Su3 transaction), you have to maintain a value for the parameter id.

then use get parameter statement.

Read only

0 Likes
713

Hi

IF you use GET PARAMETER you don't need to use the user ID, the system automatically retunrs the value of the current user (SY-UNAME).

Max