Application Development 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: 

How to know a function is called via RFC

Clemenss
Active Contributor
0 Kudos

Hi all,

how can I detect in a function module if it is called via RFC?

Obviously SY-BATCH is not set in our case.

Regards,

Clemens

Edited by: Clemens Li on Jul 9, 2009 10:57 AM

Edited by: Clemens Li on Jul 9, 2009 10:57 AM

11 REPLIES 11

Former Member
0 Kudos

Hi,

Try using sy-uname.

It would be either blank or contain any arbitrary value.

Hope this helps.

Regards,

Manish

Edited by: Manish Bisht on Jul 9, 2009 11:25 AM

Former Member
0 Kudos

Hi,

The Function Module type will be remote enabled..Go to the properties of the Function Module.. The processing type will be REMOTE ENABLED..

Hope this is what you wanted to know..

GauthamV
Active Contributor
0 Kudos

Use this FM.

SYSTEM_CALLSTACK

You can also try SY-ONCOM.

Uli_42
Participant
0 Kudos

Hy Clemens,

i don't know if there is an integrated solution, but why not add the Sending system as an optional parameter to the function (if i is an User-Function).

Uli

saumya_govil
Active Contributor
0 Kudos

Hi Clemens,

Try checking the value of SY-UNAME. It should have some RFC user name in case of RFC call.

Regards,

Saumya

Former Member

former_member186734
Active Participant
0 Kudos

Try this:

GET PARAMETER ID 'GUI_IS_ON' FIELD has_gui.

0 Kudos

Please don't wake up deads

naimesh_patel
Active Contributor
0 Kudos

I have noticed several different options to achieve this:

SY-CPORG = 'SAPMSSY1'.

or

SY-CALLD = ' '.

This is should be checked very first in the FM. If the FM is called from the program without RFC, it would be 'X'.

or

SY-ONCOM = 'S' . Documentation says you should only consider checking this field against value P.

Regards,

Naimesh Patel

0 Kudos

I know this is a pretty old discussion, but here are some more ways of doing the check. I stumbled on this discussion while trying to figure this out for myself and hope it will be useful for someone else.

  1. Function GUI_IS_AVAILABLE. This function also sets the Parameter ID 'GUI_IS_ON' that mentions in this chain. This function is under active development at the time of this writing and has changes specific to the 7.42 kernel mentioned in it.
  2. Functions RFC_CF_IS_GUI_ON and RFC_CF_IS_GUI_ON, which are in-turn called by the GUI_IS_AVAILABLE function, but gets down to the calling the system function.
  3. If you are brave enough, you can use the system function directly call 'RFCControl' id 'CODE' field '?'. If the subrc returns 0, then the GUI is available.
  4. Class CL_RFC - I have not tested this, but it looks promising.

Clemenss
Active Contributor
0 Kudos

OK, it's like 50 ways to leave your lover.