cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic config help

Former Member
0 Kudos

Hi Every one,

I have a scenario where i have redirect target  to the alternate folder/dirctory, when Invoice amount value is zero value and missing PO line item number

The source is Invoice Idoc and target is CSV file

To make it clear i will give more details.

The mapping to get Invoice amount is E1EDS01/SUMME when E1EDS01/SUMID = 011 and the mapping to get Line Item number is E1EDP01/E1EDP02/ZEILE when E1EDP01/E1EDP02/QUALF= "001"

The requirement is E1EDS01/SUMME when E1EDS01/SUMID = 011 should not be 0 and E1EDP01/E1EDP02/ZEILE should exist when QUALF= "001".

The message should be redirected to directory /ATT_Invs/Test/EDIerr if either of the above cases fail. if every thing is fine the file should go to /ATT_Invs/Test/EDIout.

I know that this can be done by dynamic config, but have No idea on Java.

Can some one please send me the coed to achive the above.

Thanks in Advance

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member190624
Active Contributor
0 Kudos

Hi Chandrika,

You can use UDF for this as following ,

public String Redirect( String SUMID , String SUMME,Container container) throws StreamTransformationException{

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

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

int var1 = Integer.parseInt(SUMID);

int var2 = Integer.parseInt(SUMME);

if(var2== 011 && var1== 0)

{

String TDir="/ATT_Invs/Test/EDIerr";

conf.put(key, TDir);

}

else

{

String TDir="/ATT_Invs/Test/EDIout";

conf.put(key, TDir);

}

return "";

}

Let me know the result.

Regards

Hari.

Former Member
0 Kudos

Hi Hari,

Thanks for your help, but i want code for two requirements

I to have redirect target  to the alternate folder/dirctory, when Invoice amount value is zero value and missing PO line item number

The source is Invoice Idoc and target is CSV file

To make it clear i will give more details.

The mapping to get Invoice amount is E1EDS01/SUMME when E1EDS01/SUMID = 011 and the mapping to get Line Item number is E1EDP01/E1EDP02/ZEILE when E1EDP01/E1EDP02/QUALF= "001"

The requirement is E1EDS01/SUMME when E1EDS01/SUMID = 011 should not be 0 and E1EDP01/E1EDP02/ZEILE should exist when QUALF= "001".

The message should be redirected to directory /ATT_Invs/Test/EDIerr if either of the above cases fail. if every thing is fine the file should go to /ATT_Invs/Test/EDIout.

former_member190624
Active Contributor
0 Kudos

Hi Chandrika,

Correct me, if i got ur requirement wrongly.

messages should redirect to /ATT_Invs/Test/EDIerr. If ,

1. SUMID = 011 and SUMID not equal to 'zero'  

2.E1EDP01/E1EDP02/ZEILE should exist when QUALF= "001" . If yes, then use below UDF


public String Redirect( String SUMID ,boolean ZEILE,string QUALF, Container container) throws StreamTransformationException{

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

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

int var1 = Integer.parseInt(SUMID);

int var2 = Integer.parseInt(SUMME);

int var3 = Integer.parseInt(QUALF);

if((var1== 011 && var1!= 0))

{

if((ZEILE) && (var3==001)){

String TDir="/ATT_Invs/Test/EDIerr";

conf.put(key, TDir);}

}

else

{

String TDir="/ATT_Invs/Test/EDIout";

conf.put(key, TDir);

}

return "";

}

for 2nd parameter , before passing value to UDF use node function exists .

Regards

Hari.


Former Member
0 Kudos

Hi Hari,

Thanks for your help and Sorry about the confusion; but my actual requirement is

messages should redirect to /ATT_Invs/Test/EDIerr. If ,

1. SUMID = 011 and SUMME is equal to 'zero' 

                             (or)

2.E1EDP01/E1EDP02/ZEILE should exist when QUALF= "001" .

Please send me the code for the above requirement.

Thanks again for all your help

former_member190624
Active Contributor
0 Kudos

Hi,

public String Redirect( String SUMID ,boolean ZEILE,String SUMME,string QUALF, Container container) throws StreamTransformationException{

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

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

int var1 = Integer.parseInt(SUMID);

int var2 = Integer.parseInt(SUMME);

int var3 = Integer.parseInt(QUALF);

if((var1== 011 && var2== 0))

{

if((ZEILE) && (var3==001)){

String TDir="/ATT_Invs/Test/EDIerr";

conf.put(key, TDir);}

}

else

{

String TDir="/ATT_Invs/Test/EDIout";

conf.put(key, TDir);

}

return "";

}

Note : Maintain the order of parameters while passing to UDF .

Let me know , if you run in to  errors.

Regards

Hari.

Former Member
0 Kudos

Hi Hari,

One small doubt befor proceeding,

How to give boolean ZEILE in parameters.

Regards

rajasekhar_reddy14
Active Contributor
0 Kudos

Step1 1:

Dont write validtaion logic within  UDF,write in mapping level  as per your requirement and send directory as a input to below UDF code.

Below UDF have one input parameter root.

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

DynamicConfigurationKey key2 = DynamicConfigurationKey.create(FileNameSpace,"Directory");
conf.put(key2, Directory);

return root;

Regards,

Raj

Former Member
0 Kudos

Hi Raj,

Thanks a ton for your help, Can you please tell me how to validate The requirement E1EDS01/SUMME when E1EDS01/SUMID = 011 should not be 0

If SUMME=0 when SUMID=011 then file should redirect.

Please help me withis i am stuck.

Regards

rajasekhar_reddy14
Active Contributor
0 Kudos

You have two option to write this logic

1)Wrting logic in UDF (check HARI reply).

2)Writing logic in mapping.

iaki_vila
Active Contributor
0 Kudos

Hi Chandrika,

I think is possible to do without java implementation. You could do two receivers (finally you will have two receiver agreement with their corresponding communication channels and with their corresponding paths). Using the condition editor in the receiver determination and accesing to the payload.

Check the help: http://help.sap.com/saphelp_nw04/helpdata/en/67/49767669963545a071a190b77a9a23/content.htm

Regards.


Former Member
0 Kudos

Hi Villa,

Thanks for your help,

Can you please give me exact condition which i have to give in Receiver Determination. I am finding it difficult and write condition for my above requirement by my self.

I am new to PI and this is urgent requirement. If you can give me the condition i can assess it and learn for next time.

Regards

rajasekhar_reddy14
Active Contributor
0 Kudos

There are many discusions on dynaic configuration and similar kind of requirements.

Please search in scn..

Former Member
0 Kudos

Hi Raja,

I have already serached SCN; but I am not getting the code. I know the procedure, i jsut need java code.

Regards