on 10-23-2017 1:46 PM
Hello Gurus,
I have following requirement:
In the Invoice IDoc, there are multiple E1EDP01 segments with many E1EDP26 sub segments. This segment has different QUALF and BETRG fields. Now, if there exist a qualifier with value 004, I need to pass the corresponding BTERG field value in output. But, if there is no qualifier with 004, I need to pass the value of BETRG with QUALF 002.
Issue: This is not possible with standard functions.
Could you please help with UDF for this.
Thanks
Hi Pankaj!
Issue: This is not possible with standard functions.
Really? 🙂
QUALF and BETRG are in E1EDP01 context in both cases.
Or if you want to use UDF:
public void getConditionalValue(String valueToCheck, String valueToCheckIfNotFound, String[] queueToCheck, String[] queueToReturn, ResultList result, Container container) throws StreamTransformationException {
String retValue = "";
String retValueNotFound = "";
for (int i = 0; i < queueToCheck.length; i++) {
if (queueToCheck[i].trim().equals(valueToCheck)) {
retValue = queueToReturn[i].trim();
break;
}
else if (queueToCheck[i].trim().equals(valueToCheckIfNotFound))
retValueNotFound = queueToReturn[i].trim();
}
result.addValue(!retValue.isEmpty() ? retValue : retValueNotFound);
}
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy,
Thanks for the help!. But the output is not what is desired.
1. The mapping with standard functions works fine when both the Qualifiers 004 and 002 exist. But not when 004 does not exist, output is blank.
2. Using UDF also, I am getting a blank output for both the scenarios.
Screenshots attached.
From the screenshots, in a single line Item, if the value qualifier 004 exist, BTERG of 004 need to be sent, else BTERG of 002 needs to be sent.
Hope this clarifies.
Thanks,
Pankaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy,
BTERG is required for each E1EDP01 segment. Any reason that you see why I am receiving blank values in output. As shown in screenshots.
Thanks,
Pankaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pankaj!
If you could see from provided result screenshot, implementations worked in both cases right the way you described (ID - standard functions, Qty - UDF). So it looks strange especially in case of UDF.
One question: do you need the BETRG value for each E1EDP01 segment or the single value for all E1EDP01 segments?
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.