# EDI document Mapping with SAP IDOC

**URL:** <https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299>\
**Category:** Forum\
**Tags:** EDI\
**Created:** [June 25, 2004, 8:12pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299 "2004-06-25T20:12:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajju](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajju](https://techcommunity.softwareag.com/u/ajju)\
**Post date:** [June 25, 2004, 8:12pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/1 "2004-06-25T20:12:00Z")

</div>

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 .  
Regards  
Ajay

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [June 25, 2004, 8:38pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/2 "2004-06-25T20:38:01Z")

</div>

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](http://www.unedifact.org) for understanding EDIFACT ORDERS segments.

HTH,

---

<div class="post-metadata">

**Author:** ![ajju](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajju](https://techcommunity.softwareag.com/u/ajju)\
**Post date:** [June 26, 2004, 4:41pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/3 "2004-06-26T16:41:24Z")

</div>

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.  
Ajay

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [June 26, 2004, 6:58pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/4 "2004-06-26T18:58:40Z")

</div>

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.

HTH,

---

<div class="post-metadata">

**Author:** ![ajju](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajju](https://techcommunity.softwareag.com/u/ajju)\
**Post date:** [June 28, 2004, 8:02pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/5 "2004-06-28T20:02:35Z")

</div>

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  
Ajay  
 ![](http://www.wmusers.com/wmusers/messages/117/36306.jpg)

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [June 28, 2004, 8:31pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/6 "2004-06-28T20:31:50Z")

</div>

Ajay,

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…

---

<div class="post-metadata">

**Author:** ![ajju](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajju](https://techcommunity.softwareag.com/u/ajju)\
**Post date:** [July 1, 2004, 12:30am UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/7 "2004-07-01T00:30:34Z")

</div>

Hi,  
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

DTM+4:20040422:122’  
but in  
DTM+4+20040422+4’  
Service is not differentiating Subfield\_separator.  
Am I doing any thing wrong in this service.  
I am considering WMEDISamples for desiging this flow services.

Regards  
Ajay

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [July 1, 2004, 2:19am UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/8 "2004-07-01T02:19:02Z")

</div>

If you are specifying the Subfield\_separator( ![](http://www.wmusers.com/wmusers/clipart/happy.gif) 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…

---

<div class="post-metadata">

**Author:** ![Chris\_L](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@Chris\_L](https://techcommunity.softwareag.com/u/Chris_L)\
**Post date:** [July 1, 2004, 4:16am UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/9 "2004-07-01T04:16:10Z")

</div>

Ajay,

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.

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [July 1, 2004, 6:43pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/10 "2004-07-01T18:43:01Z")

</div>

Chris,

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.

---

<div class="post-metadata">

**Author:** ![ajju](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajju](https://techcommunity.softwareag.com/u/ajju)\
**Post date:** [July 1, 2004, 8:21pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/11 "2004-07-01T20:21:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ajju](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajju](https://techcommunity.softwareag.com/u/ajju)\
**Post date:** [July 2, 2004, 7:35pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/12 "2004-07-02T19:35:50Z")

</div>

Hi,

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.  
Regards  
Ajay

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [July 2, 2004, 8:50pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/13 "2004-07-02T20:50:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ajju](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajju](https://techcommunity.softwareag.com/u/ajju)\
**Post date:** [July 2, 2004, 10:35pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/14 "2004-07-02T22:35:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ajju](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajju](https://techcommunity.softwareag.com/u/ajju)\
**Post date:** [July 5, 2004, 5:16pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/15 "2004-07-05T17:16:51Z")

</div>

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.

Ajay

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [July 7, 2004, 9:44pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/16 "2004-07-07T21:44:11Z")

</div>

Ajay,

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.

Thanks,

---

<div class="post-metadata">

**Author:** ![ajju](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajju](https://techcommunity.softwareag.com/u/ajju)\
**Post date:** [July 7, 2004, 10:11pm UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/17 "2004-07-07T22:11:20Z")

</div>

Hi,

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  
nsRecord(EDIFACT ![](http://www.wmusers.com/wmusers/clipart/proud.gif)RDER97A)  
Segment\_termintor( ')  
Field\_separator (+)  
Subfield\_separtor ( ![](http://www.wmusers.com/wmusers/clipart/happy.gif)

output String

1. addICEnvelopeEDIFACT

Input :  
String to documents and filled are fixed coded.

Here is the example file  
UNB+UNOA:2+5106575900:01+9610774161:12+040705:0939+040513+1445+00000000001697’  
UNH+16975900+16970001 ![](http://www.wmusers.com/wmusers/clipart/proud.gif)RDERS:S:97A++CT:A97’  
BGM+271:SOP:9’  
DTM+242:102’  
PAI+1’  
RFF+ON:0000000036’  
NAD+BT+’  
CUX+7:EUR’  
TOD+++5’  
UNZ+1+040513’  
what to send SOP+BELNR(SAP Field ) to EDIFACT.

Regards

Ajay

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [July 8, 2004, 1:07am UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/18 "2004-07-08T01:07:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ajju](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ajju](https://techcommunity.softwareag.com/u/ajju)\
**Post date:** [July 8, 2004, 1:47am UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/19 "2004-07-08T01:47:40Z")

</div>

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.

BGM+271:928373:9’

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

Regards  
Ajay

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [July 8, 2004, 2:08am UTC](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299/20 "2004-07-08T02:08:06Z")

</div>

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…

Thanks,

[Next page](https://techcommunity.softwareag.com/t/edi-document-mapping-with-sap-idoc/107299.md?page=2)
