‎2007 Feb 26 3:41 PM
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,
‎2007 Feb 26 3:52 PM
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
‎2007 Feb 26 3:52 PM
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
‎2007 Feb 26 4:01 PM
Thanks Max . But I need to also check the user name . sy-uname . How do I include that in the condition ?
Thanks ,
Hari
‎2007 Feb 26 4:05 PM
HI Hari,
In your User Profile (Su3 transaction), you have to maintain a value for the parameter id.
then use get parameter statement.
‎2007 Feb 26 4:06 PM
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