cancel
Showing results for 
Search instead for 
Did you mean: 

Part of a file name in the message mapping

Former Member
0 Kudos

Dear friends,

I've a question about part of a file name in the message mapping.

I receive this file: DESADV02_20071227_160310_2.xml and in my target XML I've the fields date, time and sequence number.

Is there a possibility to map the date in the message name with the date field in the target structure and so on for time and sequence number?

I've seen Michal's blog about how to get the file name in the message mapping but the question is now how to cut the message name and map it to three separate fields (date, time and sequence number)?

[https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2664] [original link is broken] [original link is broken] [original link is broken];

Thank you in advance,

Points will be rewarded,

Kind regards,

Kamran

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Write a UDF that does the split.

Its just a question of using java substring functions / split functions.

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Do you have an example of such a UDF?

Regards,

Kamran

justin_santhanam
Active Contributor
0 Kudos

Kamran,

You can follow the below example.

UDF1 -http://www.flickr.com/photo_zoom.gne?id=2180181503&size=o

UDF2- http://www.flickr.com/photo_zoom.gne?id=2180181569&size=o

Mapping -http://www.flickr.com/photo_zoom.gne?id=2180181573&size=o

Results -http://www.flickr.com/photo_zoom.gne?id=2180181575&size=o

The Results are as per your File name in the thread...

raj.

Former Member
0 Kudos

Raj,

Thank you very much. I'm going to try this. I've rewarded you in advance.

Kind regards,

Kamran

Answers (1)

Answers (1)

Former Member
0 Kudos

Vakili,

Get the filename using a user defined function as defined by michals blog. Then use this user defined function with the substring functioality and map to your target like:

Source field-->UDF --> Substring(x,y) --> Target field.

I think with this there should not be any issues while mapping the date and time. Also I am expecting the date and time will always be in this format only becaue then only your substring will result the output else it throws mapping exception.

For the sequence number you will hae the problem for writing the substring function. So you may need a user defined function for this also which will pick the value from 'x' location and before '.'

Regards,

---Satish