Skip to Content

Personas 3.0 SP 4 - Get user name in JavaScript.

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 23, 2017 at 10:23 PM

    session.info.user will give you the current user name.

    Add comment
    10|10000 characters needed characters exceeded