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

Remote call function and destination

matteo_montalto
Contributor
0 Likes
1,939

Hi all @SAPforums,

I used to call remotely a custom function, in a report, from many backends:

CALL FUNCTION ZFOO destination mydest

where mydest is a string containing the name of an RFC destination.

My question is: is there a way, on the destination machine, to get the name/id of the "caller" ?

The question arises from this task: I have to use the caller ID in a WHERE clause of a SELECT statement I have to write in ZFOO. I can - of course - pass the caller ID by adding a new parameter to the function, but this would make necessary a change on the CALL FUNCTION in every backend (quite expensive task, in terms of time). So if it's possible, from the callee, to get the name of the caller, I could just modify the function leaving the calls in every backend as they are.

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,785

Hello Matteo,

not quite sure, but if you use inside your called rfc the sequence

call function 'RFC_SYSTEM_INFO' destination 'BACK'

....

you should get the info. But i can't test it here, bcause there's only one dev-system.

Regards Wolfgang

14 REPLIES 14
Read only

matt
Active Contributor
0 Likes
1,785

Not possible, I think. You'll have to use a parameter.

Edited by: Matt on May 15, 2009 5:13 PM

Read only

Former Member
0 Likes
1,785

not sure, any system variable helps in this regard?

thanq

Read only

0 Likes
1,785

Hi all and thanks for your help,

I already tried, as SAP ABAPer told, to check for any syst variable but without success.... I can't find any /visible and clear/ value that can give me the way to rebuild the callee ID.

Read only

Former Member
0 Likes
1,786

Hello Matteo,

not quite sure, but if you use inside your called rfc the sequence

call function 'RFC_SYSTEM_INFO' destination 'BACK'

....

you should get the info. But i can't test it here, bcause there's only one dev-system.

Regards Wolfgang

Read only

0 Likes
1,785

Hello Wolfgang,

sorry for the stupid question... what does "destination" stands for?

Thanks for the help

Read only

0 Likes
1,785

Hello Matteo,

you call your custom function CALL FUNCTION ZFOO destination mydest ...

Inside the called function - in your case inside ZFOO - the destination 'BACK' points to the caller.

The RFC_SYSTEM_INFO function should give you the information about the caller in the structure RFCSI_EXPORT.

Regards Wolfgang

Read only

0 Likes
1,785

>

> Hello Wolfgang,

> sorry for the stupid question... what does "destination" stands for?

> Thanks for the help

Hi ,

they are two types of RFC calling is ther..

1......

CALL FUNCTION "function0module-name' DESTINATION "DEST"

--that means you are picking data from another r/3 sytem using detination from 'DEST'..

2....

CALL FUNCTION "function0module-name' IN BACKGROUND TASK DESTINATION "DEST"

--that means you are sending data to another r/3 sytem or any other sytem XI or and EDI

using detination from 'DEST'..

for 1 and 2..

--go to t-code SM59 and see the DEST what type of connection is and what system it is connected..

Regards,

Prabhudas

Read only

0 Likes
1,785

Hi Prabhu,

mine one was a "semantic" question, I was wondering about the meaning of that call Wolgang suggested me. Anyway, seems his solution to be useful; cannot test it right now, I'll check asap and eventually close the thread. Thanks to you all

Read only

0 Likes
1,785

Hello Wolfgang,

please forgive me if I'm wrong... the problem in that call is that I should know who 'BACK' is... Am I wrong?

And that's the clue, since the ZFOO function can be called remotely by a wide range of backends, so that the identification of the 'caller' should be done dynamically.

Also; I've got some syntactical problem.... the call function in ZFOO should be:

call 'RFC_SYSTEM_INFO' destination 'mycallerdestination??'  importing  rfcsi_export= info

if this seems good I'm not that confident this is what I was looking for; my task is to "know" who the caller is, so 'mycallerdestination' isn't a priori known.

Thanks for any hint you will give me

Read only

0 Likes
1,785

Your destination is 'BACK' and nothing else. This is dynamically calling the destination where the initial call came from, so just what you want here. Good idea by Wolfgang.

Thomas

P.S. works only for synchronous RFC

http://help.sap.com/saphelp_nw04/helpdata/en/80/09680289c751429ab3b07ad2a61c10/frameset.htm

Read only

0 Likes
1,785

Yes mate, gotcha! The idea from Wolfgang was brilliant... there's another clue related to this task, I hope some can give me a good hint, think it's a matter of some std table....

Briefly:

call function 'RFC_SYSTEM_INFO' destination 'BACK'
   IMPORTING
     rfcsi_export = info.

Here I can read that info-RFCSYSID contains a 3-letter identifier of the 'caller' system (say, 'ABC'). What I should retrieve is the logical system's name, which is a bit different as it should be in the following form:

ABCCLNT100

as a sort of concatenation between the ID, clnt and the mandt for the system. I said SHOULD, because this is not a fixed role... but I guess that these info should be stored somewhere in a table.

Is there any known table which could contain the relation systemID - logical system?

Thanks in advance.

Read only

0 Likes
1,785

I assume it is the field T000-LOGSYS. As you can see in table T000, this is linked to the client, not to the system. Now you would need to know which client called you...not sure how this could work without altering the parameter interface, sorry.

Thomas

Read only

0 Likes
1,785

Dear Thomas, thanks for your help,

as I supposed, I was partially wrong describing the actual value of the logsys field in BBP_PDHGP (on the SRM machine, on which ZFOO runs): the logsys value is tipically something like UB01ABC100, where:

UB01 is a company code

ABC is the sys ID

100 represents the mandt.

I guess if there's a table containing these infos, but in case it doesn't exist... is there a way to try a SELECT on a remote table (say, execute a SELECT statement in SRM applied to a backend table)? This could be a solution...

EDIT: the system field I'm looking for is the one in HRV5500OT table, field "BACKEND". Dunno anyway how to bind a logical sys ID (3 digits) to this LOGSYS value.

Edited by: Matteo Montalto on May 18, 2009 11:16 AM

Read only

0 Likes
1,785

> is there a way to try a SELECT on a remote table (say, execute a SELECT statement in SRM applied to a backend table)?

Function module RFC_READ_TABLE. Good luck

Thomas