Help with mapping an IDoc

I have successfully received and INVOIC IDoc from SAP via RFC and created a routing rule in the Partner Manager to process the INVOIC IDoc and call my flow service. The first flow step in my flow service, was transformFlatToHierarchy, the out put of that service is a record (boundNode) and I have confirmed I have the INVOIC IDoc data in that boundnode record.
I am not sure what the next step should be. I need to be able to map elements from the IDoc to a record I have already created as an output to the flow service. Can someone provide some guidance for this process?

Let me re-phase this question. I am guessing I need to create a record in the format of the INVOIC IDoc that I am receiving. Then map the boundNode record to that record. Then I would have the an IDoc record where I could map elements from the IDoc record to my record representing my outbound xml document, right? Well, I am stuck trying to create a record from and IDoc, how is this done?

Hi
Just map this boundnode to yours Idoc data structure in pipeline.First take this Idoc structure in pipeline and then map to boundnode.

Steve:
Strictly speaking, it is not necessary to define a record describing the INVOICE IDoc. You can map from the IDoc if you know the names of the nodes that you want to map from. I assume you’re aware of how to declare record structures “on the fly” in the pipeline within Developer.

However, it would be better and much easier to define a record representing your IDoc structure. The best way to do this is to have an XML schema file (.xsd) or a DTD that describes the IDoc. In Developer, you create a new record. The dialogs that come up allow you to specify a DTD or XML schema file from which to create the record.

Lacking a .xsd or .dtd file, you can use an .xml file though there are issues with this: 1) if the .xml file doesn’t use all possible data elements, then those will not be defined in the record; 2) if the IDoc can have a repeating element, but the sample .xml file holds only one element then the record definition will not allow repeating.

I’ve not used the SAP modules/adapters in the IS environment, but my guess is that there is already record definitions in the package somewhere. Can someone confirm?

HTH

Hi Steve,

You are correct to take the boundNode from
transformFlatToHierarchy service and send that to a INVOIC IDOC record definition.

To get the record defined on IS first, you could use the INVOIC IDOC that you are getting from SAP to create the record definition. The method is documented in detail in Chapter 8,in the “Obtaining a Record Definition for Your IDoc” section of the webMethods SAP Adapter User’s Guide. If you don’t have this, I could email it directly.

Additionally, you could go out to SAP’s interface repository website and get the record definition of any IDOC. This is how I normally build a IDOC record definition.

Go to http://ifr.sap.com and click enter. This website uses cononical URLs (review the doc on the web site for details) which allows you to build the record definition directly from your Developer application. See e.g. below.

Assuming that you want a 4.6C version of the INVOIC01 IDOC, here is what you would key in when you use developer to build this.
Select new, key in the name and select the folder to build it in, click next and select XML schema and next, and enter in this URL:
http://ifr.sap.com/catalog/query.asp?namespace=urn:sap-com:ifr:LO:46C&type=idoc&name=INVOIC01&xml=schema

Make sure this is one line.
Click next and wait, it takes a sec. Select the Root Node and hit Done. In your flow, simple add this as a record Reference in the pipeline out of the transformFlatToHierarchy service and map the boundNode to that record reference.

Hope this helps you.

Thanks,

ajandja

Instead of creating a record reference and mapping values out of the IDOC, another alternative is to convert the boundNode record into a Node (documentToXMLString then xmlStringToXMLNode) and then use XQL to extract what you want from the IDOC. This often reduces the branching/looping required in a typical flow service since you can use conditional logic to query the IDOC.

Great feedback! I got a copy of the SAP Adapter Users guide 46, that always helps. Following the suggestions above, I downloaded the Schema for the INVOIC01 IDoc version 46B from the http://ifr.sap.com web site and have built a record from that schema. I have then mapped the boundNode output record from the transformFlatToHierarchy service to the record I created from the IDoc schema. All that is working great.
Thanks for the feedback!

Now that I have my record representing the IDoc populated with data from the IDoc, I tried to map data from the IDoc record to another record representing my xml schema. I can step through the mapping service and see the map step execute and check the results tab upon execution completion to verify that the data element in the IDoc record does have a value. However the data element in the xml record that I was mapping that IDoc data element value to, does not have a value. The only values for the xml record that are displayed in the results tab are values that I have done “Set Value” on. None of the maps are working. Am I missing something here?

Can you post a portion of the XML file and the corresponding map steps? Can you verify that the IDoc record in the results tab structurally matches what the map steps are mapping from?

You can run IS at debug level 6 and that will display MapCopy status messages. For instance a Flow MapCopy that does not find the source value is not an error, but the message will be displayed at level 6.

Rob,
Now that you mention it, the record I created from the IDoc DTD looks like this,

INVOICE (REC)
IDOC (REC) <— record in the flow tab
@BEGIN (STRING)
EDI_DC40 (REC)
E1EDK01 (REC) <— record in the flow tab
E1EDKA1 (REC LIST)
E1EDK02 (REC LIST)
E1EDK03 (REC LIST)
E1EDK05 (REC LIST)
E1EDK04 (REC LIST)
E1EDK17 (REC LIST)
E1EDK18 (REC LIST)
E1EDK23 (REC LIST)
E1EDK28 (REC LIST)
E1EDK29 (REC LIST)
E1EDKT1 (REC LIST)
E1EDK14 (REC LIST)
E1EDP01 (REC LIST)
E1EDS01 (REC LIST)

In the results tab, I have found that the IDOC record is a recordList and the E1EDK01 record is also a recordList, which means I need to use a loop or set the index to read the record for that record list.

The question I have is, when I created the record from the IDoc DTD, the entry “IDOC” is a record (not recordList) and when I call this service by sending an IDoc to the IS, I see a RecordList for the IDOC entry in the results tab. The same for the E1EDK01 entry. Why are these entries records when created from the DTD and RecordLists when processing an actual IDoc? The thing that was throwing me off was, in the flow view of the developer I still see a record, but the results tab show a recordList for these entries, so it was making feel like something was not quite right.

below is from the results tab
INVOICE (REC)
IDOC (REC LIST) <— record list in the results tab
@BEGIN (STRING)
EDI_DC40 (REC)
E1EDK01 (REC LIST) <— record list in the results tab
E1EDKA1 (REC LIST)
E1EDK02 (REC LIST)
E1EDK03 (REC LIST)
E1EDK05 (REC LIST)
E1EDK04 (REC LIST)
E1EDK17 (REC LIST)
E1EDK18 (REC LIST)
E1EDK23 (REC LIST)
E1EDK28 (REC LIST)
E1EDK29 (REC LIST)
E1EDKT1 (REC LIST)
E1EDK14 (REC LIST)
E1EDP01 (REC LIST)
E1EDS01 (REC LIST)

There are no error messages in the log, that I can find.

Did you set the “conformsTo” parameter in the call to transformFlatTo Hierarchy? From the User’s Guide: “Without conformsTo, all tables in the hierarchical structure will be record lists.”

Rob,

No, I have not set the “conformsTo”, let me set that and see if that makes a difference.

steve

steve,
As Rob said, once you have got the boundNode that means you have the proper record structure. You can directly map the bound node to your record structure based on your XML schema . In your case its INVOICE right?. So for that you have to first create the record from DTD. And i think SAP has facility that you can get the DTD or from SAP site you can also download the DTD or schema-name it INVOICE01.
So once you have created the record, map boundNode with this record i.e. INVOICE01.

now you have the data ready to map from SAP system. And you can the different flow services to map as per your requirement.

HTH.

I have the bound node being mapped to the the record structure that I created from the DTD for INVOICE and I am able to process that record just fine. My last question was more out of curiosity than anything else, which was when I created the record from the DTD the first four structures are shown as records, but when I actually received an IDoc from SAP the record structures where actually record list, and I was just wondering why the difference. I set the conformsTo variable on the TransformFlatToHierarchy, but that did not seem to make a difference. I am looping through the record lists, which all contain only one record. I was hoping to avoid having to deal with the recordlist, being that I only have a single record in each of the record lists.

Steve

I’m experiencing the same problem, however I followed the instructions in this note and I can’t see the data in my service results tag , I got bounNode…dummy, INVOIC01…dummy.

My service declared in the routing rule start with transformFlatToHierarchy then I mapped the bounNode to an INVOIC01 IDOC record structure downloaded from ifr.com ,theIDOC vertion 40B , verified and matches with the outbound options in my partner definition segment release also 40B. When I start the process in SAP the IDOC reach the WM IS without problems, I’m able to see the data (transactions) into the IS received using FTP, the TID shows:
Header information
TID AC100C2006503ECBCBFC1330
Sender SABPRD100
Message Type INVOIC
Receiver 0000020012

Transaction Status
Current State Confirmed
Last Error None

Transaction Processing
View As XML
As HTML
As Values
Digital Signature

Audit Log
05/21/2003 02:57:01 PM State changed to: Created
05/21/2003 02:57:06 PM ALE:InboundProcess Execute AC100C2006503ECBCBFC1330
05/21/2003 02:57:06 PM State changed to: Created
05/21/2003 02:57:06 PM Gateway Manager ← 'ALE (R/3 IDOC)
05/21/2003 02:57:07 PM Invoked flow wm.PartnerMgr.flows.SABPRD100.0000020012:INVOIC
05/21/2003 02:57:07 PM IS Transport: ← Sent Msg to service: EDI:In_IDOC
05/21/2003 02:57:07 PM State changed to: Confirmed
05/21/2003 02:57:08 PM Message sent to Gateway manager
05/21/2003 02:57:09 PM State changed to: Executed
05/21/2003 02:57:09 PM State changed to: Committed
05/21/2003 02:57:09 PM State changed to: Confirmed

If I use the savepipelineToFile in the seem service the data is copied into the file in format XML (if that normal ?)can I save the data in another format usin this service? , so that means the boundNode must contains this data ??.
I need something else to do or what I missing something ?
Could someone share a Map ?
I have to map from IDOC INVOIC01 to X12-810

Sorry I’ newbie to WM , we are using vertion 6.0.1

Thanks for your cooperation,

Hi, Javier.

On the pub.flow:savePipelineToFile question: yes, that is normal. pub.flow:savePipelineToFile is useful for debugging, but I have always preferred pub.flow:savePipeline, myself.

As you discovered, pub.flow:savePipelineToFile creates an XML document that contains the pipeline elements at the point of service invocation. It can get confusing to read.

Using pub.flow:savePipeline (and, subsequently, pub.flow:restorePipeline, the values are viewable as name-value pairs in the Results tab. It’s a preference, but one that I rely on.

On to your question, let me restate it to see if I have it right…

You are mapping an inbound IDOC to an EDI template. The IDOC is populated with values but the EDI template is empty. You are trying to understand why your field data did not map.

If that is the case, try stepping through your Flow to find the exact point where the data “disappears”. You can “step” using the F7 key in Developer.

My hunch is that you have a nested document root that is tripping up the pub.web:documentToRecord service.

Thanks.

I just wanted to comment on the last message: You can use savePipelineToFile and then use restorePipelineFromFile so that you get the same behavior (pipeline visible in results tab).

FYI
I opened a request to WM and the response is that they founded a bug in the IS with transformFlatToHierarchy service, now I’m waiting for the fix in order to continues with my development… this service is unable to create the boundNode properly, we are using WM 6.0.1 with SAP adapter 4.6. So far if i use the seem procedure in BC 4.6 the bounNode is created successfully.

Hi all,

I’ve already done a service that maps an IDOC from SAP and process the information. Now I’m trying to test my service. To do that, I prefer to modify an XML file that represents the IDOC and that has been generated with the “savePipelineToFile” service (this is the first instruction in the service that “waits” for an incoming IDOC).

On my service test I invoke “restorePipelineFromFile” and then “transformFlatToHierachy”, and what’s my surprise when I realize that my pipeline is null!! The fields are all null, and of course my service crashes.

Does anyone know how can I do it?

Thanks in advance,

Ignasi