Start of Content Area

Procedure documentation 10: Checking a Result (Switch)  Locate the document in its SAP Library structure

Use

If the airline executed the booking successfully, the confirmation message contains the B indicator for Booked. To determine whether all the flights in the whole flight trip could be booked, the number of successful bookings and the number of sent bookings are compared. The successful bookings are also collected and put in a list. The booking confirmation for the whole flight trip is created from this list later.

To do so, insert a step of type Switch. Define a branch for the switch. This branch will be executed if the confirmation received contains the B indicator. In this branch you define two container operations: one increases the counter for the successful bookings. The seconds adds the confirmation message to a list. Define corresponding container elements for the counter and the list. 

If a confirmation is received that does not contain the B indicator, the Otherwise branch is executed. This branch is created automatically. Since unsuccessful bookings are not to be processed further by the integration process, no further steps are required in this branch.

Procedure

Defining a Container Element

...

       1.      Define the container element for the counter for the successful bookings as follows:

       Name: ConfCount

       Category: XSD Simple Type

       Type: xsd:integer

       Container: shows Process

       2.      Define a multiline container element for the list of successful bookings as follows:

       Name: ConfirmedList

       Category: Abstract Interface

       Type: FlightBookingOrderConfirmation_Abstract

       Select Multiline.

       Container: shows Process

Inserting a Switch

       3.      Insert a switch (This graphic is explained in the accompanying text) after the ReceiveConfirmation receive step.

       4.      In the properties area, enter CheckResult as the step name.

Defining a Container Operation for the Counter

       5.      Insert a container operation (This graphic is explained in the accompanying text) in Branch 1 of the switch.

       6.      To increase the counter by 1 after each successful confirmation received, define the container operation as follows (to define a container operation for a counter, see also: 8: Defining Counters (Container Operation)sapurl_link_0001_0001_0006).

       Step name: IncrementSuccessCounter

       Target: ConfCount

       Operation: Assign

       Expression: ConfCount

       Operator: +

       Expression: ’1’

Defining a Container Operation for Adding to the List

       7.      Insert a second container operation after the first container operation to add a confirmation to the list of positive confirmations.

       8.      Define the container operation as follows:

       Step name: StoreConfirmation

       Target: ConfirmedList (Interface)

       Operation: Append

       Expression: AirlineResponse (Interface)

Defining a Condition

       9.      Click the switch icon (This graphic is explained in the accompanying text).

   10.      To make the integration process easy to understand, enter BookingSuccess in the Outcome Name field.

This outcome name is displayed in the graphical process definition. 

   11.      Double-click the Condition field.

This displays the condition editor.

To insert the required container elements and operators in the condition, use either drag and drop, or press CTRL + SPACE to display a list of possible values.

   12.      Define an alias for the XPath entry for the booking status:

                            a.      Define the alias name in the Condition Variables screen area:

       Name: BookingStatus

       Category: Simple Type

       Type: xsd:string

                            b.      In the Binding screen area, enter the XPath for the BookingStatus alias.

       To display the expression editor, double-click the Value input field.

       Choose Container Element and in the XPath screen area navigate to the BookingStatus field.

   13.      Insert the BookingStatus alias as the first operand in the condition.

   14.      Insert = (equals sign) in the condition.

   15.      Enter the comparison value.

Since the comparison value is a constant, you can enter it directly in the condition in speech marks: “B“

To make the condition easier to read, you can also define an alias for the constant:

                            a.      Define the alias name in the Condition Variables screen area:

       Name: Booked

       Category: Simple Type

       Type: xsd:string

                            b.      In the Binding screen area, define the value of the constants:

                                                  i.       To display the expression editor, double-click the Value input field.

                                                ii.       Choose Constant and define the constant as follows:

Value: B

Type: xsd:string

                            c.      Enter the alias name Booked as the second operand for the condition.

   16.      Choose Apply.

The following condition is now displayed in the switch properties:

       If you have entered the constant directly: BookingStatus=“B“

       If you have defined the alias name: BookingStatus=Booked

This corresponds to the following XPath:

AirlineResponse./p:FlightBookingOrderConfirmation/BookingStatus = B

More information:

Switch

Container Operation

Defining the Data for a Process in Containers

Defining Conditions

XSD Data Types

 

End of Content Area