How to use raw IDOC as input

I am trying to test a mapping service without access to SAP backend. I however have a IDOC.txt file to test. I have tried get file and stringToDocument/recordToDocument with no success.

Can someone suggest what services to invoke? thanks Laura.

Please try
StringToDocument
DocumentToRecord

This should give you the record structure for IDOC
Good Luck!

You might also want to have an xml format of the IDOC.

Hi Laura,

Are you trying to convert from OR to an Idoc? If Idoc.txt is in the Idoc format, you should use the “sap.idoc:transformFlatToHierarchy” service.

Otherwise if Idoc.txt is simply a flat file you are trying to read, VR’s suggestion should be sufficient.

Regards,
Devan

Laura,

Do you have the SAP Adapter and version 4.6 of IS?

If you do, inside the “pub” directory of the SAP adapter package is a HTML file that you could use to send an IDOC to IS. It is called, appropriately, Submit_IdocXML.html.
To use it, try http://servername:5555/SAP/Submit_IdocXML.html. Submitting from this web page, will simulate SAP sending the IDOC to IS.

HTH.

Ajandja

Vr and Devan:
thanks for the quick responses. I am mapping the idoc to a edi format. The input Idoc.txt is in the idoc format (unfortunately NOT xml format).

  1. I start with a getFile and give the FileName as the absolute path in IS.
  2. The “sap.idoc:transformFlatToHierarchy” create a boundNode with a another recordcalled “dummy”. No data underneath it.
    Any ideas?

Do you have any value in the confirmsTo field? Do you have the IDOC record structure somewhere in your server?
Thanks

If you are using the SAP Adapter 4.6 please use the following sequence of services:

  1. pub.sap.idoc:decodeString
  2. pub.sap.idoc:decodeSDATA
  3. pub.sap.idoc:transformFlatToHierarchy

Cheers,
Erik

Laura and Company: Just curious, what was the final solution to your problem? what services did you call to get a IDoc loaded to test you map service?

Has anyone been able to solve the problem described by Laura? I have exactly the same requirement/problem. In addition, I want to receive the raw idoc file through an FTP port. I thought of using the pub.sap.idoc:decodeString service but got stuck, because I didn’t know how to supply the input fields of the service (filename and servername). Can anyone help?

For outbound purchase orders from R/3 I just go straight into “pub.sap.idoc:transformFlatToHierarchy”(or hierToFlat for inbound documents).

For testing off-site I usually take home a copy of the file from save pipeline, but there are other methods.

When you load the file are you loading a bytes or stream, what are the values in the pipeline if you step past the load and pause there?

The sample submitIDOC.html is just a html form to post to a DSP, you can create your own to execute your service.

In an html wrapper…
%invoke Development.Invoice.xCBL30:R3InvoiceTester%
%value string%
%onerror%
%value /lastError/error%
%end%
/body

An easy way I use is to create an empty MAP step, insert a text field and “paste” the content into the field. Use it from there. This is better for inbound documents simulating a http post from your business partners.

I got my problem solved through the following procedure:

I connect to the IS through the standard FTP client of W2K, then change to the directory of my custom flow and upload the file:
open sapbc2 8021
cd /ns/TST/RAW_IDOC
put g:\test.txt

The following flow is invoked through the upload:

pub.io:streamToBytes
pub.string:bytesToString
pub.sap.idoc:decodeString
wm.PartnerMgr.gateway.transport.ALE:InboundProcess

Comments:

  • In the flow tab of the serivice “streamToBytes” I created an Object named “contentStream” and mapped it to “Service In” of “streamToBytes”
  • The output variable “string” of the service “bytesToString” is used as input for the service “decodeString”
  • In addition, “decodeString” needs an existing SAP Server alias to function properly.

In my example, the idoc is successfully passed to an SAP R/3 test system.

I’m dealing with a situation similar to the thread above. I am receiving a flat file that is in the correct IDOC format. I can run through the process listed below and post the IDOC into SAP.

pub.io:streamToBytes
pub.string:bytesToString
pub.sap.idoc:decodeString
wm.PartnerMgr.gateway.transport.ALE:InboundProcess

This process works great if there is only one IDOC in the file, but there are problems when there are multiple IDOCs in the file. For example, I have a file that contains 2 individual IDOCs with 10 segments each. When I look in SAP after the above process successfully completes, I do have 2 IDOCs, but each of those IDOCs have 20 segments, not the 10 they should.

Is there a built in service or a property setting that will split out the idocs and their associated segments? It doesn’t appear that there is any association between the IDOC_CONTROL record list and the IDOC_DATA record list. I am trying to avoid parsing the source idoc file if at all possible.

thanks in advance,
Michael

I’m a WebMethod’s newbie, and I’m trying to map a flat file that contains differents Idoc’s (.txt) and obtain some fields from those Idocs. At the moment I’ve tried the next thing:

  • getFile
  • pub.io.streamToBytes
  • pub.string.bytesToString
  • pub.sap.idoc.decodeString

But I’m having problems with the streamToBytes flow. The only thing I’ve done is giving the FileName to getFile as the absolute path of the input file. What mappings i need to add?

Thanks in advance,
Ignasi

Try this:

Set getFile: loadAs bytes

and then use pub.string:bytesToString
mapping: body/bytes to bytes

you should get the file content in string

best regards,

Sebastián Miranda
Barcelona, Spain

Hi,
I am a new developer to webMethods and would like to ask a question. I have ORDERS05 IDOC and like to map to EDI 850 flat file schema to send it to TN and further to VAN. My question is that do I have to map each segment fields one by one or is there any service that could map the whole IDOC into EDI 850 (X12 3010) template?

I am using version 6.0.1.

I will apprecaite your response.
Thanks,

Hi,
I am a new developer to webMethods and would like to ask a question. I have ORDERS05 IDOC and like to map to EDI 850 flat file schema to send it to TN and further to VAN. My question is that do I have to map each segment fields one by one or is there any service that could map the whole IDOC into EDI 850 (X12 3010) template?

I am using version 6.0.1.

I will apprecaite your response.
Thanks,

Nadeem,

Its not a direct mapping from IDOC-EDI.

Basically first step you have to parse the ORDERS05 IDOC(basing on the SAP defined Schema)and map the required individual segments to EDI 850 structure referring the mapping specifications you have.
And finally make the EDI 850 string along with ISA,GS Envelopes and route it to TN(there are lot of threads discussed on this mapping,use the search functionality in this site).

If you have any further questions,let us know.

PS:please take some time and register your self in this site,welcome wmusers…

HTH,

getFile
stringToDocument
documentToRecord
transferHierarchyToFlat
OutboundProcess

“ALE Transport: IDoc is empty, should have been sent to TST”

TST - is the SAP server

For some reason i am getting the above message, even though documentToRecord is correctly outputting the boundnode and can see the data there. Any Idea?
Do i need to map the boundNode to an IDOC schema?