cancel
Showing results for 
Search instead for 
Did you mean: 

Remove date from Filename

badugu_sarika
Participant
0 Kudos

Hi SCN ppl,

The requirement is to remove date from filename and send it to target .Filename is

abc_date.csv and need to send abc.csv to target.

I read few blogs on this and I think we need to create dummy objects(as it is a pass through) in ESR and create UDF and map to root node at target.

Are there any other ways to achieve ??...

Kindly give your valuable suggestions

Thanks

SARIKA

Accepted Solutions (1)

Accepted Solutions (1)

apu_das2
Active Contributor
0 Kudos

Hi,

You need to use Java mapping for this.

Simply create one DT with any structure you wish as this will not be used for mapping. In the OM, take the Outbound and Inbound SI and in MM use Java Mapping.

Java mapping will be very simple. Just take input data through inputStream and out same data as it is using outputSteream as you don't want to do any modification in the data. In between set Dynamic Configuration as you have done in the UDF.

Try it in your interface. Let me know if you need help in Java Mapping.

Thanks,

Apu

badugu_sarika
Participant
0 Kudos

Hi Apu Das,

Thanks for your inputs.

I have done Java mapping and could achive it.

Thanks

SARIKA

Answers (1)

Answers (1)

former_member190293
Active Contributor
0 Kudos

Hi Sarika!

Dummy objects are usually created in ID and no ESR objects are created if we really mean "pass-through".

If you want to use UDF in message mapping you should create ESR objects according to your scenario.

Regards, Evgeniy.

badugu_sarika
Participant
0 Kudos

Hi Evgeniy,

I have created ESR objects and using below UDF to remove date from Filename.

<Filename>_20052017 need to send this filename as <Filename>.

try {

String filename = "";

DynamicConfiguration conf1 = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

filename = conf1.get(key1);

filename = filename.substring((filename.length()-9), filename.length);

conf1.put(key1,filename);

return filename;

}

catch(Exception e)

{

String exception = e.toString();

return exception;

}

I am getting below error.

Can you pls help me on this.

Thanks

SARIKA

manoj_khavatkopp
Active Contributor
0 Kudos

It should be filename.length() ;