Create and IDOC in Business Connector

Hi!

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?

rollo

Hmmm
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!

Rollo,

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.

HTH,

Rollo,

Go thru this thread if it helps,
[url=“wmusers.com”]wmusers.com

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.

Regards,

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;
transformFlatToHierarchy
boundNode is mapped to RecordReference of ORDERS02
transformHierarchyToFlat
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?

rollo

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.

cheers

rollo

Rollo,

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

HTH,

Rollo,

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

HTH,

RMG,
pub.sap.idoc:TransformHierarchyToFlat 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 !

Bhavani,

you are right and here with i am correcting my sentence
pub.sap.idoc:TransformHierarchyToFlat 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)

Cheers,

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!

regards

rollo