Adapter for SAP 10.1 | webMethods Adapter for SAP Documentation | webMethods Adapter for SAP Installation and User’s Guide Documentation | Routing Messages Through Adapter for SAP | Sending an RFC from an SAP System to Adapter for SAP | The SBCHEADER Table | Example of Using an SBCHEADER Table
 
Example of Using an SBCHEADER Table
To test a function module with the function builder, write a wrapper module. The wrapper module calls your RFC function module.
Note:
The SBCHEADER table cannot be added in the function builder directly and must not be part of the function interface of the module you want to call remotely.
For example, you want to invoke a function module called Z_DEMO_COPY. It echoes the input of type CHAR255 received in the INPUT parameter to the OUTPUT parameter. In the wrapper module Z_WRAPPER_DEMO_COPY, you would define an additional input parameter named DESTINATION and a table named SBCHEADER.
A wrapper for Z_DEMO_COPY could look like this:
FUNCTION Z_WRAPPER_DEMO_COPY.
*"------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(INPUT) TYPE CHAR255 OPTIONAL
*" VALUE(DESTINATION) TYPE CHAR32
*" EXPORTING
*" VALUE(OUTPUT) TYPE CHAR255
*" TABLES
*" SBCHEADER STRUCTURE SBCCALLENV
*"------------------------------------------------------------------
data:
msg TYPE CHAR1024.
CALL FUNCTION 'Z_DEMO_COPY' DESTINATION destination
EXPORTING
input = input
IMPORTING
output = output
TABLES
sbcheader = sbcheader
EXCEPTIONS
no_input_given = 1
communication_failure = 2 message msg
system_failure = 3 message msg
OTHERS = 4.
CASE sy-subrc.
WHEN 1.
output = 'Exception received: NO_INPUT_GIVEN' .
WHEN 2.
concatenate 'COMMUNICATION_FAILURE received:' msg into output separated
by space.
WHEN 3.
concatenate 'SYSTEM_FAILURE received:' msg into output separated
by space.
WHEN 4.
output = 'Exception received: OTHERS'.
ENDCASE.
IF sy-subrc <> 0.
WRITE output.
ENDIF.
ENDFUNCTION.
The following example illustrates how to route the Z_DEMO_COPY function module to Adapter for SAP and invoke a routing notification to route the message. When testing the function module from the SAP Gui, provide the following input values:
INPUT
Hello ...!
DESTINATION
ISCER
SBCHEADER
sender
CERCLNT800
receiver
DELL
The SAP system routes the RFC to the specified RFC-Destination ISCER (which corresponds to the name of the RFC listener). In Adapter for SAP, the routing listener invokes the routing notification that corresponds to the sender CERCLNT800, receiver DELL, and message type Z_DEMO_COPY. To determine how Adapter for SAP routes Z_DEMO_COPY function module, you would need to inspect the corresponding routing notification that the routing listener invokes.
The following example illustrates how to route the Z_DEMO_COPY function module to Adapter for SAP and directly invoking an outbound transport. When testing the function module from the SAP GUI, provide the following input values:
INPUT
Hello ...!
DESTINATION
ISCER
SBCHEADER
transport
RFC
serverName
CERCLNT750
In this case, the SAP system routes the RFC to the specified RFC-Destination ISCER. In Adapter for SAP, the header table gets interpreted directly to determine how to route the RFC. Adapter for SAP routes the message to the SAP system known as CERCLNT750 on Adapter for SAP using transport RFC. Note that CERCLNT750 must correspond to the connection alias of an RFC connection that is configured in Adapter for SAP.