EDI document Mapping with SAP IDOC

Hello Everybody,
We are running SAP Enterprise server connected to SAP Business Connector(WM Integration Server). I have imported the EDI Module also. I am passing SAP IDoc document to SAP BC and routed to flow Service but from there i am not able to proceed to convert into EDIFACT ORDERS Format which is completly different to SAP IDOC.
Pls help me to proceed further .

Once you have the IDOC in the routed flowservice pipeline then parse the IDOC (transformFlatToHierarchy)gives output IDOC structure then map the data to EDIFACT ORDERS individual Segments (UNH child segments)based on the mapping specifications and create UNH structure.

Finally invoke WmEDI services (convertToString)pass the input FFSChema (EDIFACT ORDERS schema)this will create EDI String.Final steps will be invoking (wm.b2b.edi.util:addICEnvelopeEDIFACT)and pass the above created EDI String to (parameter “documents”)along with other inputs this will adds EDIFACT Envelope segments(UNB/UNG/UNZ).Bottom line is these steps will accomplish to EDIFACT ORDERS format.

For validating the ORDERS envelope (UNB)segments you can use the envelopeProcess service before routing to external world.

If you feel this not elaborate info,regarding mapping EDI segments
please look into WmEDISamples package sample flows to get an overview.

check this site www.unedifact.org for understanding EDIFACT ORDERS segments.


Hi ,
Thanks for your reply. I tried to understand the process you mentioned.
I need some more information on mapping SAP IDoc to EDIFACT ORDERS individual segments. Becos SAP EDI IDOC_DATA & IDOC_CONTROL cannot be directly mapped to individual segment of EDIFACT. Do i have to create a Idoc record type for mapping or write a java program to mapping.
Thanks for your advice.

yes,you have to parse the IDOC to make recordstructure (for this create a IDOC recordtype based on the SAP provided Schema) and then use
(transformFlatToHierrarchy)service output of this service map to a recordReference (IDOC doctype)then you will see IDOC_DATA_40 & IDOC_CONTROL_40 structures.Then start mapping the IDOC segments to the corresponding EDIFACT ORDERS segments based on the mapping specifications you got from your functional team.

And rest follow the above procedure to make EDIFACT document.


I have created recordstructure and tried to map to IDOC coming from SAP but at the time of mapping i am not able to C how to map fields from SAP IDOc to Record Structure IDOc. Can U pls elaborate it more.
I was also looking at EDISamples it is very difficult to understand it.
Pls look into attachment what i did.
Thank for you help


I am not able to see the attachment properly.

Are you using transformFlatToHierarchy SAP Adapter service?

If so may the output of this service will be the IDOC recordStructure that you have created above,do a recordReference(IDOC structure) in the pipelineout and map it to this reference.next Add a map step and step thru the flow you will see the control and data record segments with the data.So there is no need to map manually to this IDOC structure and follow on with IDOc to EDI mapping which i mentioned above.

Sorry if my comments confuses…

Now i have created the IDoc recordStructure and also the EDI Record Structure.
I am building Services for example IDocToBGM, IDocTODTM etc.
Exactly how the EDISamples given.
Just for a trail purpose i called service convertToEDI . I could able to get the data but not in the format i want ie

but in
Service is not differentiating Subfield_separator.
Am I doing any thing wrong in this service.
I am considering WMEDISamples for desiging this flow services.


If you are specifying the Subfield_separator( in convertToString service then for the EDIFACT document it should show correctly.

I dont know what might be the reason that why it is not giving the ouput as expected for segments if they DTM/DTM01/Code1 and DTM/DTM01/Code2 like that…


If I remember correctly you need a fix for this if you’re using 6.0.1.
I ran into this issue last summer at a client.
There are quite a few EDI Fixes in 6.0.1 surrounding convertToString and convertToValues. If you experience problems check advantage for possible fixes. It’ll save you alot of time.


I think Ajay is using SAP BC,so i think this fix may not apply for him which i noticed this in his initial posting.

Thats true i am using SAP Business Connector 46 but from SAP download site i could able to see some Fix.zip file which i implemented already.


I am getting following error when i call the Service EDI:ConvertToString

2004-07-02 15:59:46 GMT+02:00 java.lang.ClassCastException: com.wm.lang.ns.NSSchema.

I have given NSRecord which is created from Schema downloaded from EDI Module.

Are you passing the fully qualified EDIFACT ORDERS recordName (folder.subfolder:recordname) in that parameter (NSRecord)?Dont pass the schema name in that param instead use the record name.
please make sure the syntax is correct.

Thanks alot I have now cracked the format. I can proceed with it now.
Thanks once again for your kind help.

I am able to create a EDIFACT structure. But SAP IDOc field values are not coming in the EDIFACT format though i did the mapping.
I have download the record structures which is mapped to EDIFACT record structure. Values are present in the pipeline.



Sorry for the delay,

Can you please elaborate on the steps converting the EDIFACT document using convertToString service.looks like you might be missing some thing in the flow.
And also you have to EDIFACT envelope after the convertToStrin step using (addICEnvelopeEDIFACT) WmEDI service.

And pls try to post your questions in one thread instead of creating new ones.



Sorry for posting it in a new thread. I thought this thread is closed.
Coming to EDI Mapping
I use the following Services

  1. transformFlatToHierarchy Service
  2. Map ORDERS05(SAP IDoc) to ORDERS97A(EDIFACT). Here in this step i map individual fields from ORDERS05 to OREDRS97A.
  3. ConvertToString

Input : ORDERS97A mapped to Values
Segment_termintor( ')
Field_separator (+)
Subfield_separtor (

output String

  1. addICEnvelopeEDIFACT

Input :
String to documents and filled are fixed coded.

Here is the example file
what to send SOP+BELNR(SAP Field ) to EDIFACT.



Your flow is correct but i dont understand where you got stuck and about this statement "what to send SOP+BELNR(SAP Field ) to EDIFACT. "

please let me know.

I am trying to map BELNR field of IDOC record structure to EDIFACT ORDERS For example
BGM+271:BELNR(ex: 928373):9’
928373 will be coming from SAP IDOc Orders.
Finally segment should like this.


but i am getting BGM+271::9’
It is the case for all the fields mapped from SAP IDoc to


If this is the case then the problem might be in the mapping part itself.
So debug the mapping and step thru the flow and check the pipeline whether the BGM segment fields populating the values as expected and same applies for all the rest of the segments mapping issues you had.
I know this is the hard way but this happens when ever we do complex mapping like EDI,IDOC…structures…