cancel
Showing results for 
Search instead for 
Did you mean: 

Reg:Dynamic Configuration

Former Member
0 Kudos

Hi....

I am having one problem while using Dynamic Configuration.

In Dynamic Configuration, i am using the below code.

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

conf.put(key, a);

return "";

I am having the condition like, if the Product code="DD" and Server Name =" A", then the file should be places in "Disb" directory else it should be places in the "Power" directory.

Can you please help in this issue.

I have executed the scenario, but both the files are going to the same folder.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

if you are having a product code and server name in the payload then you can proceed as

if (code ="DD" and serverName ="...")

then dir ="some directory"

config.put(key,dir);

other wise let us know from where you are expecting parameters?

other wise post your entire code

Rajesh

Edited by: Rajesh on Mar 26, 2009 11:23 AM

Former Member
0 Kudos

Hi....

From input message i will get the Product code and the server name.

There i am using if condition and mapping it to the Dynamic Configuratiion and then to Target.

IF -


Dynmaic Configuration -


Target Node

Can you tell me, how to insert the condition in the code itself.

Regards,

Leela

Former Member
0 Kudos

pass your input as (String Product code,Server Name)

in the UDF write the condition as

string dir;

if(Product code.equals("DD") && Server Name.equals("A"))

dir = "your dir name";

else if(Product code.equals("CC") && Server Name.equals("B"))

dir = "Another dir name";

else dir = "default dir name";

config.put(key,dir);

return either product code or server string (if dont want anything to be returned)

HTH

Rajesh

Former Member
0 Kudos

Hi...

I have changed the code i like below..

Can you please tell where i have done wrong. It is having compilation errors

public String DynamicDirectory(String code,String server,Container container)

{

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

if(code="DD" and server="DISB")

{

a="/home/corpuser/Disbursement/DD";

}

else

{

a= "/home/corpuser/Disbursement/CC";

}

conf.put(key, a);

return "";

}

While activating, it is throwing the below error.

/usr/sap/APD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map426036e019cf11de9d46002264977f6e/source/com/sap/xi/tf/_MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_.java:298: ')' expected if(code="DD" and server="DISB") ^ 1 error

Can you please help in this issue....

Former Member
0 Kudos

Hi...

Check the below code whther it is correct or not.

public String DynamicDirectory(String code,String server,Container container)

{

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

if(code.equals("DD") && server.equals("DISB"))

dir = "/home/corpuser/Disbursement/DD";

else(code.equals("CC") && server.equals("DISB"))

dir = "/home/corpuser/Disbursement/CC";

config.put(key,dir);

return "";

}

While activating, i am getting the below error.

usr/sap/APD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1354a56019d011debb16002264977f6e/source/com/sap/xi/tf/_MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_.java:301: not a statement else(code.equals("CC") && server.equals("DISB")) ^ /usr/sap/APD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1354a56019d011debb16002264977f6e/source/com/sap/xi/tf/_MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_.java:302: ';' expected dir = "/home/corpuser/Disbursement/CC"; ^ 2 errors

Can you please in this issue.

Regards,

Leela

Former Member
0 Kudos

put else if instead of else

also decalre string dir;

Rajesh

Edited by: Rajesh on Mar 26, 2009 12:08 PM

Former Member
0 Kudos

Hi Rajesh,

I have changed it to else if.

But now i am getting the below error.

usr/sap/APD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mape7babb0019d011de95f4002264977f6e/source/com/sap/xi/tf/_MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_.java:299: cannot resolve symbol symbol : variable dir location: class com.sap.xi.tf._MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_ dir = "/home/corpuser/Disbursement/DD"; ^ /usr/sap/APD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mape7babb0019d011de95f4002264977f6e/source/com/sap/xi/tf/_MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_.java:302: cannot resolve symbol symbol : variable dir location: class com.sap.xi.tf._MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_ dir = "/home/corpuser/Disbursement/CC"; ^ /usr/sap/APD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mape7babb0019d011de95f4002264977f6e/source/com/sap/xi/tf/_MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_.java:304: cannot resolve symbol symbol : variable dir location: class com.sap.xi.tf._MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_ config.put(key,dir); ^ /usr/sap/APD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mape7babb0019d011de95f4002264977f6e/source/com/sap/xi/tf/_MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_.java:304: cannot resolve symbol symbol : variable config location: class com.sap.xi.tf._MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_ config.put(key,dir); ^ 4 errors

Former Member
0 Kudos

hey declare dir varaible

as String dir;

also use ("http:" + "/" + "/" + "sap.com/xi/XI/System/File",......) like this

Rajesh

Former Member
0 Kudos

Hi Rajesh,

I have declared String dir;

Evne though it is showing the below error.

/usr/sap/APD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map9492aa8019d211de88ea002264977f6e/source/com/sap/xi/tf/_MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_.java:306: cannot resolve symbol symbol : variable config location: class com.sap.xi.tf._MM_MTO_Payment_DB_To_MTI_Payment_DD_CC_ config.put(key,dir); ^ 1 error

Regards,

Leela

Former Member
0 Kudos

Hey you have declared DynamicConfiguration as conf but you have specified as

config.put(key,dir);

thats the reason behind error change it ti conf.put(key,dir);

also return some string instead of "".

Rajesh

Former Member
0 Kudos

Hi...

I have done with the UDF. But while executing, it is going to only one directory. It is not checking the else condition. All the files are going to first directory.

Below is the code

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

String dir;

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

for(int i=0;i<product.length;i++)

{

if(product<i>.equals("DD") && server<i>.equals("DISB"))

dir="/home/corpuser/Disbursement/DD";

else if(product<i>.equals("CC") && server<i>.equals("DISB"))

dir="/home/corpuser/Disbursement/CC";

else dir = "default dir name";

result.addValue(""dir"");

conf.put(key,dir);

}

Regards,

Leela

Former Member
0 Kudos

why are looping through product code as you are looping through that it will return only one value for all your product code .

select value in UDF and try executing the same

Rajesh

Former Member
0 Kudos

Hi...

First i have tried with Value. For my interface, the rows will be repeating. so i am using the loop.

Regards,

Leela

siddhesh_pathak4
Contributor
0 Kudos

Hello,

Check with the Queue after the UDF, if it checking with only one value (product) in for loop.

Check the type of your product..it should be string array.

Former Member
0 Kudos

Hi...

I have checked with the queue. Eventhough i am not gettting the correct output. Anyways i have used Varaible substitution and i got the output.

Thank u rajesh for giving the UDF..

Regards,

Leela

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

There is no condition specified in the dynamic configuraiton code whu=ich u have writtern,

Please ensure the AdapterSpecificMessageAtribute in the channel should be checked.

Regards,

Rajesh

Former Member
0 Kudos

Hi...

I have specified the condition in the mapping.I have enabled the Adapter Specific Message Attributes.

Regards,

Leela