on 01-23-2017 6:15 PM
Hi,
I'm creating a flavor for IW21, and I need to load the user's name into a Reported By field using JavaScript.
I've searched for an answer in numerous posts, and I keep seeing a reference to SY-UNAME. However, this appears to be a system variable available for ABAP, but not JavaScript.
I would also like to be able to use the user name for a remote function call to BAPI_USER_GET_DETAIL, but the examples I've found, like the one below, use a hard-coded user name and don't explain how to get that dynamically.
var rfc = session.createRFC("BAPI_USER_GET_DETAIL");
rfc.setParameter("USERNAME", "PRIYADARSHIS");
rfc.requestResults(JSON.stringify(["ADDRESS", "RETURN"]));
rfc.send();
Can someone provide a JavaScript example on how I can get the user name?
Thank you very much for your help!
session.info.user will give you the current user name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
babowden: You could use session.info.user in an onLoad script to populate the field you want.
If this is a backend field, then
session.findById("wnd[0]/usr/ctxtSOMETHING-REPORTEDBY").text = session.info.user;
Or for a custom field you added in your flavor:session.findById("wnd[0]/usr/txtPersonas_17024162180208").text = session.info.user;
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.