Skip to Content
0

Remove date from Filename

May 19, 2017 at 01:07 PM

126

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Apu Das May 21, 2017 at 02:15 AM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Apu Das,

Thanks for your inputs.

I have done Java mapping and could achive it.

Thanks

SARIKA

0
Evgeniy Kolmakov May 19, 2017 at 02:00 PM
0

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.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

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

gmgtz.png (12.0 kB)
0

It should be filename.length() ;

0