cancel
Showing results for 
Search instead for 
Did you mean: 

Java mapping -> Setting the name of the file dinamically

Former Member
0 Kudos

Hi all,

Problem: I know how to set the name of the file in an Idoc to file interface if I'm using a message mapping, but not if I'm using a Java mapping.

I'm using this code inside a user-defined function of the message mapping so that I can set the name of the file dinamically:

-


public String GetFileName(String inboundParameter,String IdocNumber,Container container){

String filename;

java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMdd" );

filename = "cikk_" + dateformat.format( new java.util.Date() ) "_" IdocNumber + ".txt";

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

conf.put(key, filename);

return inboundParameter;

}

-


(See also: /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14)

But how can I do that if I'm using a Java mapping??

I don't have the class Container there. How can I retrieve the DynamicConfiguration object without that class?

Thank you very much.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jorge -

Go to the <a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/pi/index.html">XI javadocs link</a> and click on "DynamicConfiguration" class on the left. There it provides you with an example using a Java mapping.

Regards,

Jin

Former Member
0 Kudos

Thank you Jin,

I knew that it had to be related with the Map object got in setParameter, but in this link:

http://help.sap.com/saphelp_nw04/helpdata/en/0f/80243b4a66ae0ce10000000a11402f/frameset.htm

you can't find the constant DYNAMIC_CONFIGURATION.

I think it's not up to date.

Former Member
0 Kudos

Hi Jorge,

If u code in any java IDE, the constant(StreamTransformationConstants.DYNAMIC_CONFIGURATION) is part of that StreamTransformationConstants class .

Regards,

Sudharshan

Answers (0)