cancel
Showing results for 
Search instead for 
Did you mean: 

getting an error in Dynamic Configuration

Former Member
0 Kudos

Hi Guys,

I need to dynamically post the file into different directories based on the file in the source payload.

In Receiver File Communication Channel

Target Directory : *

Filename : *

Checked the ASMA Attributes for filename and directory

Iam refering this weblog

/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping

In the mapping

<filename> ---> UDF --> topnode of target message.

My UDF is as below

public String Directory(String a,Container container){

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

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

String FileName = conf.get(key);
FileName = a;
conf.put(key, FileName);

String Directory = conf.get(key1);
Directory = "/SAPInterface/XI/PPD/DHX/out";
conf.put(key1, Directory);

return " ";
}

But in runtime(moni) iam getting error as

com.sap.aii.af.ra.ms.api.MessagingException: The Adapter Message Property 'FileName' was configured as mandatory element, but there is no 'DynamicConfiguration' element in the XI Message header: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but there is no 'DynamicConfiguration' element in the XI Message header

Please suggest me how to correct this.

Thanks

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

do you see dynamic configuration nodes in the target XI message header ?

(if not maybe the UDF does not get executed)

Regards,

Michal Krawczyk

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks Michel,

missed the configuration in ID

Former Member
0 Kudos

> But in runtime(moni) iam getting error as

> com.sap.aii.af.ra.ms.api.MessagingException: The Adapter Message Property 'FileName' was configured as mandatory element, but there is no 'DynamicConfiguration' element in the XI Message header: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but there is no 'DynamicConfiguration' element in the XI Message header

You are getting this error message because you have not selected the ASMA settings in your Sender File Adapter. Just select the ASMA setting along with FileNmae & DirectoryName and then test your scenario again.

Regards,

Sarvesh

former_member181985
Active Contributor
0 Kudos

Apart Michael's suggestion, the following statements are not required.

String FileName = conf.get(key);
FileName = a; 
String Directory = conf.get(key1);
Directory = "/SAPInterface/XI/PPD/DHX/out";

Instead use,

conf.put(key, a);
conf.put(key1, "/SAPInterface/XI/PPD/DHX/out");

Former Member
0 Kudos

Hi Srinivas,

You said you are having dynamic directories to post the file. But I see you hardcorded or put constant for directory which is /SAPInterface/XI/PPD/DHX/out. I think you need to put //SAPInterface/XI/PPD/DHX/out.

Try this in udf:

public String Directory(String a,Container container){
 
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
 
DynamicConfigurationKey key  = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "Directory");
 
String FileName = conf.get(key);
FileName = a;
conf.put(key, FileName);
 
Directory = "//SAPInterface/XI/PPD/DHX/out";
conf.put(key1, Directory);
 
return " ";
}

Put FileName and Directory in file name and directory paramters in receiver communication cahnnel and cehck.

Regards,

--Satish