Вы находитесь на странице: 1из 5

Accessing Adapter-specific attributes

By Punit J, PI Competency Team, YASH Technologies Use of Adapter-Specific Message Attributes. In a business scenario a need could arise to access some adapter specific parameters at runtime. There the value is either not known until runtime or simply needs to be changed or accessed at runtime. Mapping runtime constants can be used to get access to the java classes for adapter specific parameters.

The message header of an XI message contains a header for adapter-specific message attributes that the sender adapter can use to write additional information to the message header. This enables sender adapters to write information that is not known until runtime to the message. Features The key for accessing the value of an adapter-specific attribute comprises a namespace belonging to the adapter and an attribute name. The adapter namespace comprises the namespace in the Integration Repository in which the adapter metadata for the adapter is saved and the name of the adapter metadata object. The adapter namespaces for the adapters shipped by SAP therefore have the following format: http://sap.com/xi/XI/System/<Adapter Metadata Object Name of Adapter>. The adapter metadata objects are located in the namespace http://sap.com/xi/XI/System of software component SAP BASIS. Mapping API The classes for accessing the adapter-specific attributes are part of the mapping API (package com.sap.aii.mapping.api): com.sap.aii.mapping.api.DynamicConfigurationKey

Class used to create a key object for an adapter-specific attribute. The key object comprises the adapter namespace and the attribute name. com.sap.aii.mapping.api.DynamicConfiguration

Class used to read, change, or delete the value of an adapter-specific attribute. In a method, you use objects of type DynamicConfigurationKey to access the attributes. Lets have a look at the simple scenario where sender will put a file, having customer details, at a FTP server. The file can have different names. The File needs to be moved to the other location, where Target File Name = Customer Name from Source File + Source File Name Integration Repository 1. Create Data Type, Message Type and Message Interface for Sender and Receiver service.

2. Create Message Mapping.

Here field ofile will have target file name. GetTargetFile is a User-Defined function, which extracts the file name at runtime. The sample code for the function is

Configuration on ID. Configure Sender Communication Channel. 1. Configure Sender Communication Channel. This will pick all the XML files whose name starts with yh296.

2.

Parameter FileName, under adapter specific message attributes, is checked in the communication channel, the source file name will be present in the header of the XI message.

Configure Receiver Communication Channel. 1. Check the checkbox Variable Substitution. Value from field ofile of message MT_Output is copied into the variable var. This variable is used as File Name for output file.

Configure the Receiver Determination, Interface Determination, Sender agreement, Receiver agreement.

Testing the Scenario: Following is input file, with name yh296_Input_1.xml

Following is output file. Customer name ABC is concatenated to the input file name yh296_Input_1.xml.

Reference: Refer to the following link for information on Classes and Methods http://help.sap.com/saphelp_nw2004s/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm

Вам также может понравиться