cancel
Showing results for 
Search instead for 
Did you mean: 

Fixed Text+dynamic filename in file to file scenario- Request Help!!

0 Kudos

Hi,

I have a requirement to hardcode the file name+add the original file name in a file to file scenario.

Its a file to file scenario.

If the source file is ABCD, I need to send out adding constant text - SAPACHFILE....

So I need the target filename as SAPACHFILE.ABCD.

To achieve this I tried using ASMA + Variable substitution, but it still take just the original filename as ABCD not the hard-code, I can either get the harcode value or dynamic file name but not both....

Kindly help!!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Since u want some static text in front of ur file name, so u can use below approach also - var substitution + dynamic config bean.

Thanks

Amit Srivastava

nabendu_sen
Active Contributor
0 Kudos

Hi Harry,

Just use ASMA, no need of Variable Substitution:

UDF Code:

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 = "SAPACHFILE." + filename;

conf1.put(key1,filename);

return "";

}

catch(Exception e)

{

     String exception = e.toString();

      return exception;

}


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



Regards,

Nabendu.



0 Kudos

Hi Nabendu,

Thanks for your quick reply.

But I'm not using ESR, I cannot use UDF.

Do you think its possible to achieve with file-to-file without mapping.

nabendu_sen
Active Contributor
0 Kudos

Hi Harry,

If Filename is not coming under any Source Field, variable substitution would not make sense. For ASMA, if you had to pass same Source File name to Target, you are not required to create any ESR objects.

To achieve your case (anyhow it is custom requirement) you can create a Message Mapping (Source & Target Structure same and 1:1) and add this UDF. Just take any Source Field as input in the UDF and return the same (output of UDF) to the same Target field.

Otherwise check:

Dynamic file name for pass-through scenario - Process Integration - SCN Wiki

But in that case you have to again write Java Mapping, which is time consuming.

Regards,

Nabendu.

Former Member
0 Kudos

Hello,

You can write a simple AM to create dynamic file name in a file to file pass through scenario.

http://wiki.scn.sap.com/wiki/display/Snippets/Dynamic+file+name+in+a+File+to+File+pass+through+scena...

Thanks

Amit Srivastava