on 06-12-2006 6:26 PM
Hi
I'm getting weird error in my message mapping.
The scenario is pretty basic, IDoc to file, but the file is of fixed length format, so we are using field-content-conversion.
Thereis this particular field which is a description field, that needs to be 20 char in length. The incoming Idoc field is 80 char in length, so I used the function substring.
Idoc-field>>>>>substring(staring position0 & length20)>>>target-field
Also, in my comm channel, I have specified the field length in the content conversion parameters.
The mapping test is successful, but at runtime, I get a mapping error. The trace gives me this message "target msg type/target field Exception: [java.lang.StringIndexOutOfBoundsException: String index out of range: 20]"
The funny thing is if I change the Substring to 7char instead of 20, it goes well, but obviously errors at field content conversion.
Any idea what could be the problem or what I need to do?
Thanks
Rachana
Hi,
if you need a fixed length, you cannot use substring function to achieve this, because you will need a String with an exact lenght. So the best solution would be to write your own user defined function where you first check the length of your input string. If the length is greater than 20, use substring to get only 20 characters, if it is less than 20, you will need to fill it up with whatever will be valid in the target file e.g. spaces.
Regards
Christine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
<i>but obviously errors at field content conversion.</i>
>>>No, error is in Mapping .. Check all the fields which are mapped are coming from the idoc.. Ie, is all the fields are coming with some values.
And error tells some String outof bound exceptions,.ie the value for which you used Substring is not containing that many characters...check it
Also make sure that after mapping , all the fields should be with exact data length as mentioned in the data type.
Regards,
Moorthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.