‎2009 May 15 3:59 PM
Hi all @SAPforums,
I used to call remotely a custom function, in a report, from many backends:
CALL FUNCTION ZFOO destination mydestwhere 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
‎2009 May 15 4:41 PM
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
‎2009 May 15 4:13 PM
Not possible, I think. You'll have to use a parameter.
Edited by: Matt on May 15, 2009 5:13 PM
‎2009 May 15 4:27 PM
‎2009 May 15 4:31 PM
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.
‎2009 May 15 4:41 PM
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
‎2009 May 15 4:44 PM
Hello Wolfgang,
sorry for the stupid question... what does "destination" stands for?
Thanks for the help
‎2009 May 15 5:04 PM
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
‎2009 May 15 5:15 PM
>
> 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
‎2009 May 15 5:25 PM
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
‎2009 May 18 9:13 AM
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= infoif 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
‎2009 May 18 9:20 AM
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
‎2009 May 18 9:29 AM
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.
‎2009 May 18 9:38 AM
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
‎2009 May 18 10:02 AM
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
‎2009 May 18 10:49 AM
> 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