Error while reading IDOC as string using decodeString

Hi,

I am trying to read an IDOC (in string format) with multiple records using the service “decodeString”, but the result seems to be erroneous as some fields in the idoc are wrongly parsed.

Any ideas/comments/suggestions will be highly appreciated.

Tx in advance,

ONS

ons,

you should use this service pub.sap.idoc:transformFlatToHierrachy (SAP AdapterService)which will parse the IDOC to IDATA structure based on the IDOC document structure reference.And I believe you have the particular IDOC DTD/Schema downloaded from SAP site the one that you are trying to parse.

HTH,

Hi RMG,

 Thanks a lot for ur immediate response.I am using decodeString in the following sequence, 

getFile
bytestoString
decodeString
decodeSdata
transformFlatToHierrachy

 I found the decodeString seems to be erroneous in reading multiple record IDOCS.Have you worked in similar scenario ? 

 Would appreciate and welcome to share your ecxperience in this regard. 

Tx,

ONS

Check this thread,
http://www.wmusers.com/wmusers/messages/117/1482.shtml

HTH,

Hi RMG,

I greatly appreciate your responses.I have gone through all the postings related to reading IDOC string.My probs is actually reading MULTIPLE record idocs.When used all the above discussed services to decode the input IDOC string from an MQ output, the decoded data does not have all the records in the IDOC.Hope now you have a clear picture about my issue. 

Would appreciate any comments/ideas/suggestions regarding this.

Tx,
ONS

Hi RMG,

I would like to have your contact mail address, so that we can discuss this issue in detail.Hope you don’t mind for this.

Tx in advance,

ONS

ons,

Oops,i may not be helpful to solve this issue,but if i have any clue surely i will post it to you.

Regards,
RMG

Hi ons,
Did you find the solution to your problem. Currently I have exactly the same problem you had.
Regards,
Sathya

This sounds suspiciously like a “conformsTo” issue. In the transformFlatToHierarchy call make sure the conformsTo parameter is set appropriately.

Hello Everyone,

I also am running into some “issues” with the “pub.sap.idoc:decodeString” service.

I receive an “Idoc String” from another application (not SAP). In this string, the DOCNUM, SEGNUM, PSGNUM values are not properly valued resulting in the corresponding values in the “IDOC_DATA” documents created in the pipeline not being correct. A subsequent execution of the “pub.sap.idoc:transformFlatToHierarchy” will understandably create an IS document with data “missing” and the structure inconsistent with the “true” IS doc type for the Idoc.

However, I know the “pub.sap.idoc:decodeString” works correctly. That is because if I take an outbound SAP document, convert it to a string using the “pub.sap.idoc:idocToString” service, I can then use that resulting string (it has valid DOCNUM, SEGNUM, PSGNUM values) as input to the “pub.sap.idoc:decodeString” and subsequently execute “pub.sap.idoc:transformFlatToHierarchy” to create a valid/correct IS doc type for the Idoc (including multiple Idoc situations).

It appears to me that the “Idoc string” MUST contain valid DOCNUM, SEGNUM, PSGNUM values. If they are not supplied or are not correct, is there a way to “fix” the “Idoc string” other than brute force (e.g. parsing through the string, fixing up the values which in turn requires knowledge of the specific Idoc structure)?

Thanks in advance for any assistance/thoughts on this question.