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.