Red Hat Training

A Red Hat training course is available for Red Hat Fuse

102.10. Example 2: Writing Data to SAP


This example demonstrates a route which creates a FlightTrip business object instance in SAP. The route invokes the FlightTrip BAPI method, BAPI_FLTRIP_CREATE, using a destination endpoint to create the object.

Java DSL for route

The Java DSL for the example route is as follows:

XML DSL for route

And the Spring DSL for the same route is as follows:
    <from uri="direct:createFlightTrip"/>
    <to uri="bean:createFlightTripRequest"/>
    <to uri="sap:destination:nplDest:BAPI_FLTRIP_GETLIST?transacted=true"/>
    <to uri="bean:returnFlightTripResponse"/>

Transaction support

Note that the URL for the SAP endpoint has the transacted option set to true. As discussed in Section 102.7, “Transaction Support”, when this option is enabled the endpoint ensures that an SAP transaction session has been initiated before invoking the RFC call. Because this endpoint’s RFC creates new data in SAP, this options is necessary to make the route's changes permanent in SAP.

Populating request parameters

The createFlightTripRequest and returnFlightTripResponse beans are responsible for populating request parameters into the SAP request and extracting response parameters from the SAP response respectively following the same sequence of operations as demonstrated in the previous example.