RFC call
hi all
During the RFC call (R/3 - R/3) appears login-dialog where I have to enter user name, password to remote system. Is it possible to make this enter with the aid of any function (not manual)?
Thanks
You can specify various parameters and whether the logon should be silent or not.
However, if any of the parameters are missing then the login dialog will be displayed.
'***************************************************************************
'*
'* Function: Logon_To_SAP as Object
'*
'* Purpose: Logs onto an SAP system using the provided criteria and returns
'* a connection object to the caller
'*
'* Entry: System name to log on to as string
'* Client of system as string
'* User name as string
'* Password as String
'*
'* Global setting - g_specify_system - allows users to specify the logon system
'*
'* Exit: SAP Connection object
'* If g_specify_system is true,
'* g_specify_system set to false after successful login
'* g_system and g_client set to respective values
'*
'* Calls:
'*
'***************************************************************************
'*
Function Logon_To_Sap(System As String, Client As String, User As String, Password As String) As Object
Dim Sap As Object
'*
Call Push_Status("Connecting to SAP. Please Wait")
Set Sap = CreateObject("SAP.Functions")
'*
'* If specify System is set, allow the user to specify the logon system
'*
If Not g_specify_system Then
Sap.Connection.ApplicationServer = System
Sap.Connection.Client = Client
End If
Sap.Connection.SystemNumber = "00"
Sap.Connection.User = User
Sap.Connection.Password = Password
Sap.Connection.Language = "E"
'*
'* The 'True' argument forces a silent logon. Changing this
'* to false will display the logon dialogs.
'*
If Sap.Connection.Logon(0, Not g_specify_system) = False Then
Set Sap = Nothing
Else
g_specify_system = False
g_system = Sap.Connection.ApplicationServer
g_Client = Sap.Connection.Client
End If
Call Pop_Status
Set Logon_To_Sap = Sap
End Function
By changing the value for the first parameter in Sap.Connection.Logon to True, no dialogs will be displayed.
R
_________________
Regards
R
Abap KC
SFMDR
Thanks for quick answer but I need something else...
The matter is I call remote function from ABAP-report (not from external system). So I need ABAP-function which I can integrate to my ABAP-report in order to log in automatically.
thanks
Apologies for not reading your q fully - it's monday morning......
Have a quick look at this:
CALL FUNCTION
Variant 4
CALL FUNCTION func DESTINATION dest.
Additions
1. The same as with CALL FUNCTION func
2. ... EXCEPTIONS syst_except = rc MESSAGE mess
Effect
Executes the function module externally as a Remote Function Call ( RFC ); dest can be a literal or a variable.
Depending on the specified destination, the function module is executed in another R/3 or R/2 System. Externally callable function modules must be flagged as such in the function library (of the target system).
Since each destination defines its own program context, further calls to the same or different function modules with the same destination can access the local memory (global data) of these function modules.
You can maintain existing destinations by selecting Tools -> Administration -> Administration -> Network -> RFC .
All the logon data is stored there.
Regards
R
_________________
Regards
R
Abap KC
SFMDR
Yes, now you came closer and almost understood my trouble
I wanna give a more precise definition:
There is a part of my code (asynchronous RFC):
call function 'RFC_READ_TABLE'
destination 'QV1 CLIENT 100'
starting new task 'TMP1'
performing up1 on end of task
exporting
query_table = 'ZFP_C_3341'
tables
fields = it_fields
data = it_data
exceptions
communication_failure = 1 message msg_text
system_failure = 2 message msg_text.
and at the time of my report execution appears logon-dialog... maybe it happens because of incorrect destination data (tranzaction SM59)?
That's why I want to get to know if any SAP function exists which log on other R/3 system (remote logon).
p.s. I feel ill at ease to bother you but nobody among my colleagues can gime a worthwhile advice...
SM59 is the correct transaction to use for this. I would check the logon data and use the Test Connection button to check that the data is all set up.
Because the CALL FUNCTION command handles the logon implicitely you won't find a function to do this for you (I've had a quick olook around and none springs to the fore).
I would do it the other way round and include your report in a function module which can be called via RFC.
Your report should be submitted with the 'EXPORTING LIST TO MEMORY' and 'AND RETURN' clauses.
You can then use function modules 'LIST_FROM_MEMORY' and 'LIST_TO_ASCI' to retrieve the data if required.
Regards
R
_________________
Regards
R
Abap KC
SFMDR
Hi ,
If I understand ur problem correctly
Try with TRusted Systems in SM59 On the remote system define ur system as trusted system.
Regards
venkat
If u r executing ur FM on same machine do not mention any destination
like
call function 'RFC_READ_TABLE'
* destination 'QV1 CLIENT 100'
starting new task 'TMP1'
hmm .... only problem is that anybody with SM59 gets access to the target system