IDOC encoding

I am trying to use the service The output in iDocString is something like this:

EDI_DC40 674000000000022801146C 3014 HROT_USM HROT_UM SAPDCH HR 0000000001 A000000011LS FILEPORT 20040921213426 20040921213421
E1HR_HD 674000000000022801100000100000001 >>>ABKRS=U1, ZEINH=01, PABRJ=2004, PABRP=09, PERBE=20040901, PEREN=20040930, VERSN=MD, PERMO=01<<<

Notice how the values in SDATA show up as ABKRS=U1 for example and are comma separated. I want the output to show just as if SAP had sent the idoc to a fileport. For example:

EDI_DC40 674000000000022312946C 3014 HROT_USM HROT_UM SAPDCH HR 0000000001 KRONOS LS FILEPORT 20040819155053 20040819155045
E2HR_HD000 674000000000022312900000100000001U1012004082004080120040831MD 01
E2HR_KY000 67400000000002231290000020000000200760056123456783 U12004081820040831200408 US01USCH0001 200408 20040829

Notice how the values in SDATA now show as fixed length values without the field name. According to the SAP Adapter documentation this is the service I need to use to ‘encode an IDoc to a string equivalant, the format that is used by the file port of an SAP system.’ Is there a different service that I should use? Is this something to do with the encoding? I noticed that the $encoding parameter is not available for input with this service. (It is available on the and services.) Any help is greatly appreciated.


Use these steps,

  • transformFlatToHierarchy
  • decode
  • encodeSDATA
  • encodeString

Then you have a nice IDOC in your variable iDocString.