cancel
Showing results for 
Search instead for 
Did you mean: 

Changing File Extension in File Adapter

Former Member
0 Kudos

Hi I have a file adapter that can pick up to 20 files up so it is looking for *.csv

Files cane be called something like

NON_R1.csv

EMP_R1.csv

NON_R2.csv

TEST_R3.csv

etc

However when I drop off them off using a file adapter, after processing them, the recieving system needs the same file name but a different extension so they require

NON_R1.xml

EMP_R1.xml

NON_R2.xml

TEST_R3.xml

Is there an easy way in the adapter to keep the file name but change the extension rather than having to build multiple recieving Adapter channels with the .xml name defined ? I could always put a function in the mapping to do it too but wondering if there was a way to keep coding out of it

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Easiest way I see is to take the file name in your mapping from the Adapter Specific Message Attributes and change the extension. You can do this in an UDF:

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

DynamicConfiguration conf = getConfig(container);

if (conf != null)

      conf.put(fileName, name);

Answers (3)

Answers (3)

nageshwar_reddy
Contributor
0 Kudos

Adapter Specific Message Attributes(ASMA) + UDF to change the extension is the way to go. I do not think if there is any way to change just the extension without an UDF.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Brian,

                I dont think this is possible without mapping, as the receiver adapter has no ways to know the original filename (without the extension). I may be wrong, Please wait for experts oinion.

Regards

Anupam

Former Member
0 Kudos

Thanks folks...I will create the UDF

B

Former Member
0 Kudos

Hi Brian, you can keep the source filename with DynamicConfiguration, but changing the extension of the target filename would require some coding.

- Either change the filename extension in an UDF in message mapping

- or you set the target filename with DynamicConfiguration and use an OS command to change the filename extension.

You find plenty of examples on SCN.

Regards, Martin