cancel
Showing results for 
Search instead for 
Did you mean: 

Structure Definition

Former Member
0 Kudos

Hi,

I want to define a structure, where in I want to pass additional information or metadata apart from the actual pay load.

Additional information is Message Id and File Name. My structure should look like this

<?xml version="1.0"?>

 <message id=u201DmessageIDu201D>

        <header>

               <filename>D:\\inputfile.txt</filename>

        </header>

        <body>

               FileContent(here goes the payload)

        </body>

 </message>

Any Inputs would be appreciated.

Regards,

Varun

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Use the Mapping Runtime Constants for fetching the Message ID.

check this :

http://help.sap.com/saphelp_nw04/helpdata/en/b3/9a2aeb24dc4ab6b1855c99157529e4/frameset.htm

String headerField;

java.util.Map map;

// get runtime constant map

map = container.getTransformationParameters();

// get value of header field by using variable key

headerField = (String) map.get(key);

For example, to read the message ID from the message header, the variable key must have the value MessageId and not MESSAGE_ID.

Are you using the File Adapter on the Sender Side.

regards

Ganga

Answers (2)

Answers (2)

varun_k
Contributor
0 Kudos

Hi,

Thanks for your replies.

Do I need to define the Header and Body in the structure. If I define, does this not come under Payload of the Message.

Yes I am Using File Adapter as Sender and Receiver.

Regards,

Varun

santhosh_kumarv
Active Contributor
0 Kudos

>>Do I need to define the Header and Body in the structure

If you require the structure to have Header and Body tag create it in the Data Type.

>>If I define, does this not come under Payload of the Message.

No Doubt. It will come in the payload. What ever is mapped to the target structure will be there in the payload.

>>Yes I am Using File Adapter as Sender and Receiver.

Enable the option Adapter Specific message attribute and filename in sender CC.

Thanks

SaNv...

santhosh_kumarv
Active Contributor
0 Kudos

1. Use this UDF to retrieve the file name

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

String ourSourceFileName = conf.get(key);

return  ourSourceFileName;

Map this to the target field.

2. Use this to get the Messages ID.

map = container.getTransformationParameters();

String Mid  = (String) map.get(MessageId);
return  Mid;

Thanks

SaNv...

Edited by: Sãnthosh Kûmãr V on Aug 13, 2008 10:52 AM