cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple mapping with the timestamp

former_member229127
Participant
0 Kudos

Hi all,

Am facing an issue with the multiple mapping in the which i have created 3 different data type ,Message type , Service Interface and to which i have created one message mapping and also operation mapping , for the Idoc to File scenario

for that  i have created 3 different communication channel as there are 3 different file name and 1 single  ICO.

And to the which the file extension is .CSV so , my question is how to add time stamp for these 3 different files ,i have gone up with the variable substitution  and facing issue .

Can any one suggest

regards,

Vijender

Accepted Solutions (1)

Accepted Solutions (1)

former_member186851
Active Contributor
0 Kudos

Hello Sandhya,

your scenario is Idoc to 3 files right?

Go with Dyanmic Config UDF,instead of VS.

SAPTechnical.COM - Dynamic File name using ASMA (Adapter Specific Message Attributes) in XI / PI

former_member229127
Participant
0 Kudos

Yes Raghu !!

But it is CSV file hoe to use the dynamic configuration  ???

And to which node we have to map ??

Regards,

Sandhya

former_member186851
Active Contributor
0 Kudos

Hello Sandhya,

If you any input field to be given as name to UDF then map then same else just map the root node or you can remove all the inputs to the UDF.

engswee
Active Contributor
0 Kudos

You cannot use dynamic configuration with multimapping directly.

If it is always 3 files, you can use the following approach

If the number of target messages is dynamic, following is another approach.

And since target is CSV, variable substitution also is not possible because it can only be used for XML payloads.

former_member229127
Participant
0 Kudos

Hi Raghu ,

Thanks for the reply and through the dynamic configuration i have used the logic but only it is failng due to timestamp error in the time HH MM SS so how to handle it through HH MM SS _SSS .
so that it will be workfull to my scenario .

Regards,

former_member186851
Active Contributor
0 Kudos

Sandhya,

Please share th UDF so that I can help you out.

former_member229127
Participant
0 Kudos

Hi Raghu ,

please find the UDF ....

//Generate File Name

try

{

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

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

//Update the ASMA File Adapter attribute

conf.put(key,fileName);

}

catch (Exception e)

{

//raise an exception if the update fails

String exception = e.toString();

return exception;

}

//return the status

return dummy;

Regards,

former_member186851
Active Contributor
0 Kudos

So you would like to add the timestamp in the filename like below?

FileName_Timestamp

The logic in mentioned in the link only.

former_member229127
Participant
0 Kudos

Yes Raghu!

I need to add Time Stamp

former_member186851
Active Contributor
0 Kudos

Sandhya,

use the below code and enable ASMA parameters for both filename and timestamp.

try {

String filename    = "";

String timestamp = "";

DynamicConfiguration conf1 = (DynamicConfiguration) container

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

DynamicConfigurationKey key2 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","SourceFileTimestamp");

filename = conf1.get(key1);

timestamp = conf1.get(key2);

filename = filename.replaceAll( ".txt" ,"_" );

filename = filename+timestamp+".xml";

conf1.put(key1,filename);

return filename;

}

catch(Exception e)

{

     String exception = e.toString();

      return exception;

}

Answers (1)

Answers (1)

vijender_p
Active Participant
0 Kudos

Hi sandhya ,

why cant  you go with Add Time stamp through ID ??

Regards,

Vijender