cancel
Showing results for 
Search instead for 
Did you mean: 

Need to name the receiver file with partial value of a field

Former Member
0 Kudos

Hello,

I am working on an IDOC to file scenario where I need to name the reciever file with partial value of an IDOC field.

Example : the value in the IDOC field is: AB-09273-T67E
Name of the receiver file should be : 09273-T67E.xml

I think,if I write an UDF ,it can solve the problem.If any one can help me with the code on UDF,it would be very kind.

Thanks & regards,

Sambaran

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use the below code.Pass the field value as the input to udf.

String temp = f.substring(3,f.length()-1);

String fname = temp.concat(".xml");

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

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

conf.put(FileName,fname);

return ""; //up to you

Regards

Venkat

Former Member
0 Kudos

Hi,

Variable substitution wont workout in your case as you need only part of the field value .So go with dynamic config udf in mapping .

Regards

Venkat

Answers (3)

Answers (3)

Former Member
0 Kudos

Sambaran,

F is the field name that would be input parameter of the UDF.

In Message mapping pass the IDOC field to the UDF & pass the output to Message Type(MT_***).

Hope this will help you in passing the IDOC field to the output.

Regards,
Ashish

Former Member
0 Kudos

Hi Ashish,

Thanks for the input and How I need to configure in the communication channel? what should I put as the filename in the target directory?

Thanks & regards,

Sambaran

Former Member
0 Kudos

Hi Sambaran,

You need to enable ASMA property in receiver comm channel & enable file name as check box.

Directory path would the same as per your requirement & you can keep any thing as file name as place holder, the file name you set in the UDF will over write the one as place holder.

Regards,

Ashish

Former Member
0 Kudos

Hi Venkat,

Thanks for the input.So,I need to replace the "f" by the "fieldname" I imagine? and how the mapping would look like?

Fieldname-->UDF--->Message type??

Regards,

Sambaran

Former Member
0 Kudos

Hi ,

As above said,f is just a dummy variable name used in udf .You can give any name.

>>and how the mapping would look like? Fieldname-->UDF--->Message type??

Yes .map udf o/p to target message type.

Regards

Venkat

Former Member
0 Kudos