ABAP Keyword Documentation → ABAP − Reference → Data Interfaces and Communication Interfaces → RFC - Remote Function Call → Examples for Remote Function Call
Implicit Logon Data in RFC
This example demonstrates how the logon data of an RFC session is set implicitly.
Other versions:
7.31 | 7.40 | 7.54
Source Code
DATA:
BEGIN OF logon_data,
uname TYPE sy-uname,
mandt TYPE sy-mandt,
logon_langu TYPE sy-langu,
langu TYPE sy-langu,
END OF logon_data.
IF cl_abap_syst=>get_logon_language( ) <> 'E'.
SET LOCALE LANGUAGE 'E'.
ELSE.
SET LOCALE LANGUAGE 'D'.
ENDIF.
logon_data = VALUE #(
uname = sy-uname
mandt = sy-mandt
logon_langu = cl_abap_syst=>get_logon_language( )
langu = cl_abap_syst=>get_language( ) ).
ASSERT logon_data-langu = sy-langu.
DATA(out) = cl_demo_output=>new(
)->next_section( 'Parameters of Caller'
)->write( logon_data ).
CALL FUNCTION 'DEMO_RFM_LOGON_DATA' DESTINATION 'NONE'
IMPORTING
uname = logon_data-uname
mandt = logon_data-mandt
logon_langu = logon_data-logon_langu
langu = logon_data-langu.
out->next_section( 'Parameters of Callee'
)->write( logon_data )->display( ).
Description
A remote-enabled function module DEMO_RFM_LOGON_DATA is called with the destination "NONE" using the RFC interface. The logon data user name, client, and logon language of the corresponding RFC session are provided implicitly. To demonstrate that the logon language of the RFC session is set by the language of the text environment of the caller, this is set before the call with the statement SET LOCALE LANGUAGE to a language different from the logon language of the caller. In the called RFM the language of the text environment of the RFC session is also changed and is then different to the logon language there as well.
If the function module DEMO_RFM_LOGON_DATA is called remotely again, the RFC session is reused with the existing logon data. Changing the language of the text environment again in the caller would have no effect.