cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically filename is required in CC but not reuired in Target field

anurag_sinha3
Participant
0 Kudos

HI,

my requirement is to create filename dynamically(UDF) in Receiver communication channel but I dont want the name should be populated in the target field as target field is not provided by business.

I received the below UDF from SDN

String date = var1[0];

String RFCL = var2[0] ;

String FN = RFCL + date ;

AbstractTrace trace = container.getTrace();

trace.addWarning("Test" + FN);

String NameSpace = "http:/"+"/sap.com/xi/XI/Syatem/File";

DynamicConfiguration conf =

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

DynamicConfigurationKey key = DynamicConfigurationKey.create(NameSpace, "FileName" );

conf.put(key,FN);

//trace.addWarning("Test" + var2);

//trace.addWarning("Test" + RFCL);

result.addValue(var2);

Can any one suggest me how I can achieve my requirement

Thanks

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

In your code your namespace is wrong...

String NameSpace = "http:/"+"/sap.com/xi/XI/Syatem/File";

it should be System

HTH

Rajesh

Former Member
0 Kudos

Hi

Use the code

public String getFileName(Container container) throws StreamTransformationException{

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

//For getting filename

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

// Retrieve the filename

String FileName = conf.get(key);

return FileName;}

Map this to the root node. Do not forget to keep the Adapter Specific Message Attributes(ASMA) checked in the communication channels.

Set Adapter Specific Message Attributes

File Name.

Regards

Monika

Former Member
0 Kudos

Hi Anurag,

you can use UDF in mapping .. it will generate Filename at runtime and it will get assign to file..

in that case you need to use variable substitute in communication channel and few other option ..it depends on your requirement..

refer following weblog..

/people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

and search with dynamic file name and variable substitute and you will get many links.. for this..

Thanks,

Bhupesh

rajasekhar_reddy14
Active Contributor
0 Kudos

map your UDF to root node of your target structure, thats it..