cancel
Showing results for 
Search instead for 
Did you mean: 

How to Populate file name from a field value - Proxy To File

vishnu_pallamreddy
Contributor
0 Kudos

Hi All.

My scenario is Proxy to File.

I am getting file name from Proxy to one field Bsed on some condition.

Condition is for on cycle file name is fileon_201501091234.dat and for off cycle file name is fileoff_201501091234.

How to create file name based on that field value.

Whether I need to create UDF or is it possible with value mapping.

Please let me know the Answer.

Thanks In Advance,

Vishnu Pallamreddy.

Accepted Solutions (1)

Accepted Solutions (1)

asdasd_asdasd
Active Participant
0 Kudos
vishnu_pallamreddy
Contributor
0 Kudos

Hi Colman,

In My case I am getting total file name(including type also, i.e, .DAT) from ECC to one field and I am getting  to types of File Names based on cycles like On Cycle and OFF cycle.

In this situation how can i populate it to file name?

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vishnu,

If you are populating any field on the target side by maintaining the validations on the filename field present on the source side, then you can go with variable substitution option available onthe receiver adapter. But if you are using any content conversion to convert xml file to a flat file, then this variable substitution does not work.

In this case, you need to use a udf in the mapping level. Please activate ASMA in the receiver file channel.

Please let me know if you want any help on the udf part.

vishnu_pallamreddy
Contributor
0 Kudos

Hi Vishnu,

I think you understood my case.

Based on field value I need to create file name on target side.

I am using FCC in my scenario.

Please help me on UDF part.

sahithi_moparthi
Contributor
0 Kudos

HiVishnu,

You can use dynamic configuration.Please find the code for the same:

DynamicConfiguration conf = (DynamicConfiguration) container

    .getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

String a=conf.get(key);

var1 = a;

return var1;

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vishnu,

As the first step, please enable ASMA in receiver file channel.

In mapping level, pass the file name which is coming in the source structure(I assume only one variable which captures either on cycle or off cycle case).

Code snippet:

DynamicConfiguration dc = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

dc.put(dck,input);

return "";

Map the output of the udf to the root node in the target structure.

If you are getting filenames separately for on cycle & off cycle, then you need to pass these two fields to the udf, and add the below lines extra to the above code:

String input="";

input = input1.length()>=1?input1:input2;

vishnu_pallamreddy
Contributor
0 Kudos

Thanks Vishnu.

For both conditions we are getting values into single field.

Thank You So much.

Answers (0)