Create and IDOC in Business Connector


I’m trying to create an IDOC and send it via FTP to a EDI clearing house. The problem is that the IDOC is not correctly formated.

My service is very simple. I only use EncodeString and the IDOC is then encoded into iDocString. The problem is IDOC doesn’t get correctly formated, the fieldnames etc included in the file.

Exemple in my IDOC
E1EDK01 100000000000117001300000100000001 >>>ACTION=000, CURCY=SEK, WKURS=1.00000, ZTERM=HE30, BELNR=0000562096, VSART=02, VSART_BEZ=standard, RECIPNT_NO=0000021077<<<

How do I loose the fieldnames etc?
I have tried different mappings, but haven’t succeded yet.

What should I do?


can’t find the edit button for my message…

A small edit to my message

I’m trying to create and flatfile IDOC and nothing else!


Please use the search functionality provided in this site,you will be surprised after seeing the results.Many threads discussed on this procedure.It is the faster way to resolve the issue.



Go thru this thread if it helps,

Bascially once you are done with custom mapping to IDOC flat structure
use the (TransformHierarchyToFlat)service,this will create IDOC string based on the SAP Schema/DocumentType structure.Finally push this IDOC flatfile to your EDI clearing house.


Hi again.

I can’t find the documentation for TransformHierarchyToFlat in the SAP BC Built-in-services manual and I can’t get the service to transform the value to a string.
Does anyone know where I can find the documentation?

I do no mapping at all, since the IDOC should be as it is.
My simple service is built as follow;
boundNode is mapped to RecordReference of ORDERS02
the RecordReference of ORDERS02 is mapped to boundNode and this is
mapped to a string and a object.

I think this is the way to do it, but how do I convert the RecordReference or an object to a string?


thanks Bhavani!

I must have missed it in the SAP Adapter Guide. I can’t use convertToString since I don’t have a template for the IDOC, I have to try it with the TransformHierarchyToFlat.




Glad you find out information about of SAP Adapter service,This will create you IDOC string based on the SAP Schema/DocumentType structure(file conformsTo)



Glad you find out information about of SAP Adapter service,This will create you IDOC string based on the SAP Schema/DocumentType structure(fill conformsTo param)


RMG, gives string Output ? No, I guess !!! You need to use the recordToDocument and then documentToString to get the string output !!!

Rollo ,
Few of the cases, convertToString has converted record to String when , nsRecord is specified.

Just give it a try…
Bhavani Shankar
Correct me if I am wrong !


you are right and here with i am correcting my sentence service,This will prepares the IDOC record structure accordingly
(IDOC_CONTROL_REC_40,IDOC_DATA_REC_40) and next step following with documentToRecord to get string output based on the IDOC record.

I believe convertToString also works with passing nsRecord (IDOC record)


Hi again!

Well, it was easier then I thougt!
I’ve solved it with a very easy flow. If someone else needs to do the same, here is my flow!

  • transformFlatToHierarchy
  • decode
  • encodeSDATA
  • encodeString

Then you have a very nice IDOC in your variable iDocString!