on 03-11-2013 1:23 PM
Hello Guru's.
I am unskilled in Java / XSLT and was hoping for direction on a mapping problem I have in SAP PI.
I want to scan through an IDOC - INVOIC01 and from segment E1EDP03 I want to determine the oldest date and the newest date that occurs in this recurring segment - In essence I want to determine the date range of all the items that appear in this IDoc.
This I subsequently want to use in naming the file.
The UDF (if necessary - Can this be achieved graphically???) for scanning and determining the date range is my main concern. I would be grateful to any of you if you could provide sample code for this.
My thanks to you all in advance.
Hi,
Your requirement is not clear.As per my understanding try as below.
Convert the string date (YYYYMMDDHHMMSS) to int using "Integer.parseInt(inputdate)"
Now sort it and pick the required values in the array.
>>For setting receiver file name use the below udf.
try {
String filename = "";
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","FileName");
filename = assaign ur output file name.
conf.put(key,filename);
return filename;//It is up to you
}
catch(Exception e)
{
String exception = e.toString();
return exception;
}
Regards
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mike,
Along with udf you need to do some configs in receiver file adapter .
Go through below link for steps .Let me know if you struck with any issue.
https://scn.sap.com/thread/1712384
Regards
Venkat
Hi Mike,
You can achieve it through graphical mapping.
Apply sort function on date field in the segment E1EDP03. Since sort function doesnt allow any context change in between so before applying sort function either use node function removeContext to remove context or change the parent segment of the date field to INVOIC01.
This would return sorted data with min value on top & max value on bottom.
Hope this would sort out your issue.
Regards,
Ashish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That was what I was looking for - Thanks Ashish - (And everyone else too!) - Can I expand on this slightly if I may please? I am doing the mapping as you suggest and it looks good in the Message Mapping Test Tool - However when I do an actual test from WE19 through PI I get an error:
"Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD".
I have check the source XML in the MEssage being received into SAP PI and it has the values - However the mapping does not seem to be completing despite it looking good in the ESR:
Any ideas anyone?
Thanks in advance.
Hi Mike,
If i am understand your requirement properly then i think you can achieve this using graphical mapping only,
try to first sort your input date field and then read first and last occurrence of output that is your require range i think....
Regards
GAgandeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.