Application Development and Automation 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: 
Read only

Detect RFC call

Former Member
0 Likes
1,773

Hello,

I developed one RFC function module. It can be called within an ABAP program or by an external program with RFC.

How can I detect if the function module is running in RFC mode ?

7 REPLIES 7
Read only

Former Member
0 Likes
1,122

Hi Chris,

I know what you mean...

please try this out:

When called inside SAP the system fields sy-cprog should be filled with the report name, otherwise it should be empty or have same default value for outcomming calls.

Try it out, I am not sure if this helps, but let me know.

Regards,

Marcelo Moreira

Read only

Former Member
0 Likes
1,122

You could always just add an extra paramater to its interface (of type flag) that you set if it is called from the external program.

If you want to record what data is passed to the FM from your external program investigate the use of FBGENDAT which will capture the data passed to your FM and store it in the test data directory for the FM in SE37.

Gareth.

Read only

0 Likes
1,122

Hi Gareth,

I can't figure out how to use FBGENDAT, can you give more information.

Thanks.

Read only

0 Likes
1,122

Hi Chris,

I'm going from memory so apologies if this isn't completely accurate!

Essentially, all you need to do is add a line of code to the start of your FM like so (example from standard BAPI):-

* generate data record
fbgenmac 'BAPI_SALESORDER_CREATEFROMDAT2'.

You also need to set a parameter against your user profile so go System->User Profile->Own Data and add a parameter called "FBGENDAT" and give it a value of X I think. (Of course, you may need to do this against the RFC user that your external program is using to access SAP.)

Then you can actually activate or deactivate the recording using program FBGENDAT which is relatively self explanatory.

I "think" that is all - let me know if it doesn't all work and I'll try to remember the rest!

Gareth.

Read only

0 Likes
1,122

Ok,

Seems clear to me,

Thanks a lot, I should give it a try.

Read only

Former Member
0 Likes
1,122

hi

type in the FM name in se37

enter into the function module

go to attribute tab

if Remote FM attribute is checked then the function module is running in RFC mode

regards

ravish

<b>plz dont forget to reward points if useful</b>

Read only

0 Likes
1,122

No.

That just means the fm is RFC enabled. I imagine that if the original poster has managed to call his FM from an external program he's already figured this out!

Gareth.