Hi Experts,
In our project there is a field which is populated with the Idoc fields. The scenario is Idoc to file and multiple idocs can come at one point of time.
So for my concerned field, the data is coming based on several conditions like payrun, company code, payment method etc...
Previously I was using the graphical mapping but now as many conditions are getting added in to the mapping, I am thinking of going with the advanced UDF.
The sample conditions are based mainly on payment method, company code, bank and one other field.
I have written an UDF and it is giving me the correct output but one more null is getting added after the last context change , which was not happening with the graphcal mapping. Also I want to know if the written UDF is correct or not.
Even please let me know if my understanding is correct for simple and advanced UDFs - simple - when you need to populate the target field only once.
Advanced when you are populating the target field several times????
Please find the below sample code for UDF which I have written
for(int i=0;i<PaymentMethod.length;i++)
{
if(PaymentMethod[i].equals("Y")&&CompanyCode[i].startsWith("XX"))
{
result.addValue(":23E:TRE");
result.addContextChange();
}
else if (PaymentMethod[i].equals("W")&&Bank[i].startsWith("ING")&&CompanyCode[i].equals("AB29"))
{
result.addValue(":23E:PRGE");
result.addContextChange();
}
else if(PaymentMethod[i].equals("W")||PaymentMethod[i].equals("F")||PaymentMethod[i].equals("I"))
{
result.addValue(":23E:TRE");
result.addContextChange();
}
}
This is working fine but giving an additional null context as shown below.
But when I am trying with the normal graphical there is no last null.... Please let me know how to correctly add the context change so that the additional null will not get added..