cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a rfc function module with a dynamic field

Former Member
0 Kudos

Hi,

I wish to call a function module from an external system, namely

HR_GETEMPLOYEEDATA_FROMUSER and i wish to default the

user name field to the user currently logged in to SAP i.e. sy-uname.

Is there a way to pass the value in to the fm so that the call

runs with the value of username = sy-uname.

i.e. what should ??? be in the following call from the remote system :

CALL FUNCTION 'HR_GETEMPLOYEEDATA_FROMUSER'

EXPORTING

username = ???

....

Hope you can help! Many thanks in advance!

Samir

Accepted Solutions (0)

Answers (2)

Answers (2)

juan_suros
Contributor
0 Kudos

You cannot send a token like "&sy-uname&" in a RFC parameter, but this information is available to your external program in the attributes of the Connection object it uses to communicate with SAP.

In DCOM, the Session object has the method "GetConnectionAttribute()" that can give you the login name you are using to connect to SAP. The java & .NET connections must have something similar.

Your code can find thus find the login name of your connection, even if the connection object is passed to it as a parameter from some other process.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Regards,

Rich Heilman

Message was edited by: Rich Heilman