cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve file size and XI message ID?

Former Member
0 Kudos

Hi,

I am doing File to IDOC scenario.

Where I need to map file name, file size and XI message ID to IDOC. Here I need your help to retrieve file size and XI message ID at message mapping level.

Is there any global variable which are storing these details, so I can use them in message mapping?

Thanks,

Sunil Bhavsar.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks

Former Member
0 Kudos

Prateek, where should I write this Java code?

Thank you

justin_santhanam
Active Contributor
0 Kudos

Jenni,

You need to write them in UDF of Mapping program..

raj.

prateek
Active Contributor
0 Kudos

MessageID:

U have to write a simle java code for this and access the attribute

java.util.Map map;

String messageId;

map = container.getTransformationParameters();

messageId = (String) map.get(StreamTransformationConstants.MESSAGE_ID);

return messageId;

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

Also see this

/people/michal.krawczyk2/blog/2005/06/11/xi-how-to-retrieve-messageid-from-a-bpm

Size:

I couldnt find a direct way to achieve this in mapping. Better u create a field in file specifying the size.

Regards,

Prateek

former_member192892
Active Contributor
0 Kudos

Hi sunil,

File size can be captured using Adapter Specific Message Attribute. In yous sender file CC, check the option Use Adapter Spec Message Attribute and check source file size in that.

In your mapping, Declare global variables messageID and fileSize under the global variable button.

Now in your mapping include this code..

messageID = (String) container.getTransformationParameters().get(StreamTransformationConstants.MESSAGE_ID);

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

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

fileSize = conf.get(key);