• No results found

Configuring the File Adapter for an XML Target File

In document Bit400 en Col34 Fv Part a4 (Page 137-149)

Configuration for a Sequential Target File

Exercise 7: Configuring the File Adapter for an XML Target File

Exercise Objectives

After completing this exercise, you will be able to:

• Configure a scenario that transfers an XI-XML message to the file adapter and writes it to a directory as an XML file

Business Example

Your local PC has a local application with the software component SC_BIT_Travelsoft. This software component has an inbound interface for flight master data and expects the data as an XML file. The application has been assigned the name BS_BIT_TravelAgency_## as a business system.

You want to transfer flight master data from an outbound IDoc interface to the XML structure that is expecting the software component by using SAP Exchange Infrastructure. You want to put an XML file in a directory by using the outbound file adapter.

26-02-2004 © 2004 SAP AG. All rights reserved.

129

Task 1:

Create all the objects that are required for an inbound interface in the Integration Repository. The structure of the interface must correspond to the requirements of an external application.

Hint: This task is the same as task 1 in the exercise ’Configuring an Asynchronous Scenario with Two Different Interfaces and Mapping’. If you have already completed this exercise, check your objects and complete them if necessary.

File Structure for the External Application

Field Name Meaning Type Length; Detail

AirlineID ID of airline Char 3

Connec-tionID

ID of flight connection Char 4

FlightDate Date of flight Char 8; YYYYMMDD FlightPrice Price of the flight in

the currency from the Currency field

Char 12; Decimal symbol= ’.’

Currency Currency ISO code Char 3

Create an interface mapping from the outbound interface

FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01for this inbound interface and perform a structure mapping by using a message mapping.

1. Log on to the Integration Repository. Look at the IDoc type FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01 that is used as the outbound interface. From the soft-ware component XI_Training_XX, choose Imported ObjectsIDocs. Display the imported IDoc type

FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01. Which fields does the segment E1BPSFLREP contain? Which segment fields correspond to the fields required in the inbound interface?

Field Name Segment Field

AirlineID ConnectionID

Continued on next page

BIT400 Lesson: Outbound File Adapter

FlightDate FlightPrice Currency

2. Navigate to the software component SC_BIT400_TravelSoft. The namespace BIT400_## has been created for this exercise. Create a data type DT_BIT400_##, which contains the fields of the inbound interface. Save the data type.

3. Create a message type msgT_BIT400_## in your namespace BIT400_##and reference your data type DT_BIT400_##. Save the message type.

4. Create a message interface I_msgIF_BIT400_##. The interface is an asynchronous inbound interface and should reference the message type msgT_BIT400_## as the input message type. Save the message interface.

5. Create a message mapping msgMap_BIT400_##. Reference the IDoc type FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01 as the source structure and your message type msgT_BIT400_## as the target structure.

Hint: To select the source or target structure, select the IDoc type or message type from the navigation tree and drag them to the relevant hand icon by using drag&drop.

Define the structure mapping by selecting a field in the source structure and using drag&drop to drag it to the corresponding field in the target structure. Proceed as described for all remaining fields in the target structure. Also assign the segment E1SFL_SAVE to the node msgT_BIT400_##. Save the message mapping.

6. Create an interface mapping IF_Map_BIT400_##. Select the IDoc type FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01 as the outbound interface and your message interface

I_msgIF_BIT400_##as the inbound interface. Enter your message mapping msgMap_BIT400_## as the mapping.

7. Activate all objects you have created.

Continued on next page

26-02-2004 © 2004 SAP AG. All rights reserved.

131

Task 2:

Write flight master data to an XML file by using your local Adapter Engine.

Configure a new outbound file adapter and define a corresponding end point in the Integration Directory.

1. Create a new outbound file adapter called Training##_file_outboundin your Adapter Engine. Use the template file_outbound.

2. Create a subdirectory FilesXml. Place files in this directory with the name Training##_nnnn.xml. nnnn signifies a consecutive number. Which configuration parameters of the outbound file adapter are responsible for these settings? For information on the parameters, see the documentation.

3. Configure the file adapter. Follow the procedure in ’Configuring the Outbound File Adapter in the Integration Engine’ and get the necessary configuration parameters from the documentation.

Place the files in the directory that you created in 2. under

Training##_nnnnn.xml. nnnnn signifies a consecutive number.

Enter 8210 as the port that XI uses to reach the file adapter and /file/receiver##as the service. The mode for the file to be generated should be XML file. Save the configuration and start the adapter.

4. Create an XI connectivity end point for your business system BS_BIT_TravelAgency_##and your inbound interface

I_msgIF_BIT400_##in the Integration Directory, in the namespace BIT400_##. Make sure that the URL corresponds to your

configurations for port and service. Select Anonymous Logon.

Task 3:

Configure a scenario in the Integration Directory that sends flight master data from the outbound IDoc interface of the Travel_Agency_Summer business system to the BS_BIT_TravelAgency_## business system with the inbound interface I_msgIF_BIT400_## in the namespace BIT400_##by using your local file adapter. This receiver takes over from the receiver BS_BIT_TravelAgency. The data must only be distributed if the RCVPRN field of the segment EDI_DC40 has the value LS_BIT_##.

1. Create an interface determination from the outbound interface FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01to the inbound interface I_msgIF_BIT400_## in the namespace BIT400_## in the Integration Directory. Enter your mapping IF_Map_BIT400_##.

Continued on next page

BIT400 Lesson: Outbound File Adapter

2. Change your receiver determination. Delete the receiver

BS_BIT_TravelAgencyand add BS_BIT_TravelAgency_##.

Create a routing condition that ensures that the data is only distributed if the RCVPRN field of the segment EDI_DC40 has the value LS_BIT_##. Save the settings and check whether the system finds your end point in the configurations by using the ’Refresh’ icon.

26-02-2004 © 2004 SAP AG. All rights reserved.

133

Solution 7: Configuring the File Adapter for an XML Target File

Task 1:

Create all the objects that are required for an inbound interface in the Integration Repository. The structure of the interface must correspond to the requirements of an external application.

Hint: This task is the same as task 1 in the exercise ’Configuring an Asynchronous Scenario with Two Different Interfaces and Mapping’. If you have already completed this exercise, check your objects and complete them if necessary.

File Structure for the External Application

Field Name Meaning Type Length; Detail

AirlineID ID of airline Char 3

Connec-tionID

ID of flight connection Char 4

FlightDate Date of flight Char 8; YYYYMMDD FlightPrice Price of the flight in

the currency from the Currency field

Char 12; Decimal symbol= ’.’

Currency Currency ISO code Char 3

Create an interface mapping from the outbound interface

FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01for this inbound interface and perform a structure mapping by using a message mapping.

1. Log on to the Integration Repository. Look at the IDoc type FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01 that is used as the outbound interface. From the soft-ware component XI_Training_XX, choose Imported ObjectsIDocs. Display the imported IDoc type

FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01. Which fields does the segment E1BPSFLREP contain? Which segment fields correspond to the fields required in the inbound interface?

Continued on next page

BIT400 Lesson: Outbound File Adapter

2. Navigate to the software component SC_BIT400_TravelSoft. The namespace BIT400_## has been created for this exercise. Create a data type DT_BIT400_##, which contains the fields of the inbound interface. Save the data type.

a) Expand the node SC_BIT400_TravelSoftBIT400_##Interface ObjectsData Types. Create a new data type by calling the context menu and choosing New.... Enter the name DT_BIT400_##and check that BIT400_## is entered for the namespace and SC_BIT400_TravelSoft for the software component version. Choose Create. You can enter a description on the next screen. Position the cursor on the DT_BIT400_##

field and create new fields by using the icons with the green plus sign. For each new field enter a field name, the technical type, and, if required, detailed information.

3. Create a message type msgT_BIT400_## in your namespace BIT400_##and reference your data type DT_BIT400_##. Save the message type.

a) Under your namespace BIT400_##, choose Interface Objects then Message Types. Create a new message type by calling the context menu. Enter the name msgT_BIT400_## and enter a description. From the input help, select your data type DT_BIT400_##in the namespace BIT400_##.

Continued on next page

26-02-2004 © 2004 SAP AG. All rights reserved.

135

4. Create a message interface I_msgIF_BIT400_##. The interface is an asynchronous inbound interface and should reference the message type msgT_BIT400_## as the input message type. Save the message interface.

a) Under your namespace BIT400_##, choose Interface Objects then Message Interfaces. Create a new message interface by calling the context menu. Enter the name I_msgIF_BIT400_## and enter a description. Select the attributes Inbound and Asynchronous. In the Input Message Type field, call the input help and select your message type msgT_BIT400_##.

5. Create a message mapping msgMap_BIT400_##. Reference the IDoc type FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01 as the source structure and your message type msgT_BIT400_## as the target structure.

Hint: To select the source or target structure, select the IDoc type or message type from the navigation tree and drag them to the relevant hand icon by using drag&drop.

Define the structure mapping by selecting a field in the source structure and using drag&drop to drag it to the corresponding field in the target structure. Proceed as described for all remaining fields in the target structure. Also assign the segment E1SFL_SAVE to the node msgT_BIT400_##. Save the message mapping.

a) Under your namespace BIT400_##, choose Mapping Objects then Message Mappings. Create a new message mapping by calling the context menu. Enter the name msgMap_BIT400_##

and your namespace and choose Create. Enter a description. In the tree structure for the software component XI Training XXchoose Imported Objects and select the IDoc type FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01. Drag the IDoc type to the hand icon in the source structure by using drag&drop. Next, drag your message type msgT_BIT400_## to the hand icon in the target structure by using drag&drop. For all remaining target structure fields, assign the appropriate source structure field to the corresponding target structure field by using drag&drop. Assign the segment E1SFL_SAVE

to the root node of your target structure msgT_BIT400_## by using drag&drop.

Continued on next page

BIT400 Lesson: Outbound File Adapter

6. Create an interface mapping IF_Map_BIT400_##. Select the IDoc type FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01 as the outbound interface and your message interface

I_msgIF_BIT400_##as the inbound interface. Enter your message mapping msgMap_BIT400_## as the mapping.

a) Under your namespace BIT400_##, choose Mapping Objects then Interface Mappings. Create a new interface mapping by calling the context menu. Enter the name IF_Map_BIT400_##

and your namespace and choose Create. Create a short text and enter the outbound and inbound interface by using the input help. Alternatively, you can drag the interfaces to the hand icons by using drag&drop. Choose the Read Interfaces icon to display detailed information in the lower part of the screen. Use the input help for the Mapping Program field to select your message mapping, if you have already saved it.

7. Activate all objects you have created.

a) Navigate to the Change Lists tab page and activate your objects by calling the context menu and choosing Activate.

Task 2:

Write flight master data to an XML file by using your local Adapter Engine.

Configure a new outbound file adapter and define a corresponding end point in the Integration Directory.

1. Create a new outbound file adapter called Training##_file_outboundin your Adapter Engine. Use the template file_outbound.

a) Reactivate the template file_outbound for the outbound file adapter.

b) Create a new file adapter by choosing Add New Adapter.

Enter file_outbound as the template and select Training##_file_outboundas the name.

c) Deactivate the template.

Continued on next page

26-02-2004 © 2004 SAP AG. All rights reserved.

137

2. Create a subdirectory FilesXml. Place files in this directory with the name Training##_nnnn.xml. nnnn signifies a consecutive number. Which configuration parameters of the outbound file adapter are responsible for these settings? For information on the parameters, see the documentation.

a) Create the directory. In our solution example it is called c:/XI_Training/FilesXml.

b) The configuration parameter

file.targetDir=c:/XI_Training/FilesXmlis

responsible for the file name. If necessary, replace the directory with your directory name.

c) The configuration parameter

file.targetFilename=Training##.txtis responsible for the file name. You can number the files consecutively, separated from the file name by an underscore (_), by using the configuration parameter file.writeMode=addCounter

file.counterSeparator=_ file.counterFormat=0000 file.counterStep=1 .

3. Configure the file adapter. Follow the procedure in ’Configuring the Outbound File Adapter in the Integration Engine’ and get the necessary configuration parameters from the documentation.

Place the files in the directory that you created in 2. under

Training##_nnnnn.xml. nnnnn signifies a consecutive number.

Enter 8210 as the port that XI uses to reach the file adapter and

Continued on next page

BIT400 Lesson: Outbound File Adapter

/file/receiver##as the service. The mode for the file to be generated should be XML file. Save the configuration and start the adapter.

a) Replace ## with your group number.

## File adapter java class

classname=com.sap.aii.messaging.adapter.ModuleXMB2File

# Replace ’c:/XI_Training/FilesXml’ by the complete path of the folder file.targetDir=c:/XI_Training/FilesXml

4. Create an XI connectivity end point for your business system BS_BIT_TravelAgency_##and your inbound interface

I_msgIF_BIT400_##in the Integration Directory, in the namespace BIT400_##. Make sure that the URL corresponds to your

configurations for port and service. Select Anonymous Logon.

a) Expand the Receiver System End Points node in the Integration Directory. Your business system should not be in the list yet. To create a new end point, choose New.. in the context menu for the Receiver System End Points node. From the input help, select your inbound interface I_msgIF_BIT400_## in the namespace BIT400_##. Choose Create to navigate to the detail view of the new end point. Enter a description. Select the addressing mode URL. Enter the URL that accesses your outbound file adapter.

Select Anonymous Logon. Save and activate the end point.

Continued on next page

26-02-2004 © 2004 SAP AG. All rights reserved.

139

Task 3:

Configure a scenario in the Integration Directory that sends flight master data from the outbound IDoc interface of the Travel_Agency_Summer business system to the BS_BIT_TravelAgency_## business system with the inbound interface I_msgIF_BIT400_## in the namespace BIT400_##by using your local file adapter. This receiver takes over from the receiver BS_BIT_TravelAgency. The data must only be distributed if the RCVPRN field of the segment EDI_DC40 has the value LS_BIT_##.

1. Create an interface determination from the outbound interface FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01to the inbound interface I_msgIF_BIT400_## in the namespace BIT400_## in the Integration Directory. Enter your mapping IF_Map_BIT400_##.

a) Expand the Interface Determination for Outbound Interface node in the Integration Directory. Open the detail view for the outbound interface FLIGHT_SAVEREPLICA.FLIGHT_SAVEREPLICA01.

To create a new interface determination, use the Create icon.

Enter the business system Travel_Agency_Summer as the sender and the business system BS_BIT_TravelAgency_## as the receiver by using the input help, and select Create. Enter a description. From the input help, select your inbound interface I_msgIF_BIT400_##in the namespace BIT400_## and your interface mapping IF_Map_BIT400_##.

b) Save and then activate.

2. Change your receiver determination. Delete the receiver

BS_BIT_TravelAgencyand add BS_BIT_TravelAgency_##.

Create a routing condition that ensures that the data is only distributed if the RCVPRN field of the segment EDI_DC40 has the value LS_BIT_##. Save the settings and check whether the system finds your end point in the configurations by using the ’Refresh’ icon.

a) To open the receiver determination for your scenario, double click it. Select the receiver BS_BIT_TravelAgency. To delete the receiver, select the icon with the red minus sign.

b) To add a further receiver, select the icon with the green plus sign in the detail view for your receiver determination. Call the input help to select the receiver BS_BIT_TravelAgency_##.

Using the input help for Condition takes you to the Condition Editor. To add a condition, choose the Insert Expression icon.

Select the type Field Value and from the input help for segment EDI_DC40, select the field RCVPRN. Close the window with the IDoc structure by choosing OK. In the Value field enter LS_BIT_##. Close the conditions editor by choosing OK. Save and then activate.

BIT400 Lesson: Outbound File Adapter

Exercise 8: Configuring the File Adapter

In document Bit400 en Col34 Fv Part a4 (Page 137-149)