cancel
Showing results for 
Search instead for 
Did you mean: 

how to combine the output of 2 if Conditions into one target node

venkatasap
Participant
0 Kudos
91

Hi Sap All.

i have got a requirement where in an Idoc To File Interface ,i need to check two IF conditions and then pass the result of any one of IF Condition(if it is TRUE) to the target.

If /ZRPA_ORDERS01/IDOC/Z1EDRPAORDCR1/E1EDK01/E1EDP01/E1EDP05/KSCHL = ‘’PAT’ then /ZRPA_ORDERS01/IDOC/Z1EDRPAORDCR1/E1EDK01/E1EDP01/E1EDP05/KRATE-> ‘gross_cost_excl’ when /ZRPA_ORDERS01/IDOC/Z1EDRPAORDCR1/E1EDK01/BSART is ‘ZRIC’ or ‘ZRUC’ or ‘ZUC’ or ‘ZIC’

or

If /ZRPA_ORDERS01/IDOC/Z1EDRPAORDCR1/E1EDK01/E1EDP01/E1EDP05/KSCHL = ‘’TODD’ then /ZRPA_ORDERS01/IDOC/Z1EDRPAORDCR1/E1EDK01/E1EDP01/E1EDP05/KRATE-> ‘gross_cost_excl’ when /ZRPA_ORDERS01/IDOC/Z1EDRPAORDCR1/E1EDK01/BSART is ‘ZRIC’ or ‘ZRIM’ or ‘ZC’ .

i have tried to use the Boolen 'OR' Condition but i couldnt get it right as it was not accepting the normal input values(output of IFTHEN Condition) (other than true or false ).so is there any way that i still can use the boolean IF Condition or can i go for the User Defined condition)

i have also tried with UDF by submitting the output of 2 IFTHENWithoutElse conditions but still i couldnt get the right values in the target according to the Context.

the source code of usd is as follows :

public void OR(String[] a, String[] b, ResultList result, Container container) throws StreamTransformationException{

if(!a.equals(""))
{
result.addValue(a);
}


if(!b.equals(""))
{
result.addValue(b);
}

will be waiting for the quick answer.

regards.

Varma

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Please mark answered for this thread.

Answers (1)

Answers (1)

Former Member
0 Kudos

this should work in your case or with minor context handling it should work.

venkatasap
Participant
0 Kudos

Hi mr Praveen.

thanks for the response but any way i have got the solution through the following below shown mapping.

The source code of UDF 'OR' is as below :

public void OR(String[] a, String[] b, ResultList result, Container container) throws StreamTransformationException{

String conditionA = "";
String conditionB = "";

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

  if (!b[i].equals("")) conditionB = b[i];
}

if (!conditionB.equals("")) result.addValue(conditionB);

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

  if (!a[i].equals("")) conditionA = a[i];
}

if (!conditionA.equals("")) result.addValue(conditionA);

Regards.

Varma