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: 

Determine if called as RFC

Former Member
0 Kudos

Anyone know of a way that I can programmatically determine within a function module if it has been called as an RFC or not ?

Have looked at SY variables but doesn't seem to be one.

TIA

5 REPLIES 5

Former Member
0 Kudos

Hi,

If the function module exists in table TFDIR with mode set as Remote(fmode field = R) ,then it can be called as an RFC.

Hope this helps.

Thanks.

Mark points if helpful.

Former Member
0 Kudos

Hi Philip,

If any FM is called as an RFC it needs a Destination (remote Client).

So if your FM is a RFC only, then you provide the destination detail which you already know. Otherwise its a normal one.

Hope this helps you to some extent.

Manish

former_member404244
Active Contributor
0 Kudos

Hi Philip,

first in the attributes of a function module u can see,whther the function module is RFC enabled or NORMAL.if the radio button is checked for RFC then its a RFC FM.Also the RFC FM needs the destination .

for example..

CALL FUNCTION <FUNCTION MODULE NAME> DESTINATION 'DESTINATION NAME'.

If it is called like this ,then it is AN RFC enabled FM.

Hoping ithelps u.

Regards,

Nagaraj

0 Kudos

Thanks for your replies so far but maybe I need to rephrase the question.

I understand that in the attributes of a function mod. you can set it as rfc or normal. Though if it is flagged as rfc it can actually be called normally as well.

I want to be able to write some abap code within my function module that will tell me whether it has been called as a RFC or as a normal call.

Thanks again

0 Kudos

Simple option is keep a export parameter System_id as optional . While calling the FM pass the SY-SYSID to it. Inside the FM check

if system_id = sy-sysid.

*Then it is not called with any RFC destination

Else.

*Then sy-sysid will return the destination system so

system_id will not be equal to sy-sysid.

Regards,

Prakash.