Generating Document Types

Generating Document Types for RFC Structure

About this task

This feature allows you to generate an RFC document type for an RFC structure defined at an SAP system.

Note: To do this, you must have Adapter for SAP plug-in installed on the machine that hosts Designer .

To create a document type for RFC Structure

Procedure

  1. In Designer, select File > New > Document Type.
  2. Select the parent namespace and name for the document type, and click Next.
  3. From the list of source files, select SAP as the type of source file from which to create the document type. Click Next.
  4. Select RFC as the SAP Document Type and click Next.
  5. Select the SAP System ID and click Next.
  6. Select the RFC Structure. If no structures have been cached, you must type the structure name into the field.
  7. Click Next and then Finish.

Generating Document Types for IDocs

Create an IDoc Document Type Using the DDIC

About this task

You can create an IDoc document type using the metadata describing the IDoc structure that is available in the DDIC. This is the best approach for creating an IDoc document type.

Note: To do this, you must have Adapter for SAP plug-in installed on the machine that hosts Designer .

To create a document type using the DDIC

Procedure

  1. In Designer, select File > New > Document Type.
  2. Select the parent namespace and name for the document type, and click Next.
  3. From the list of source files, select SAP as the type of source file from which to create the document type. Click Next.
  4. Select IDoc as the SAP Document Type and click Next.
  5. Select the SAP System ID and click Next.
  6. Fill in the following fields:
    Field Description/Action
    IDoc Type The IDoc version.
    CIM Type Optional. The IDoc type extension (CIM type/customer extension type).
    SAP System Release Optional. The IDoc release.
    Old IDoc Type 2 Optional. The IDoc version. Uncheck for a new version 3 IDoc, check for old version 2 IDocs (as in 3.1 SAP systems).
  7. Click Finish.

Generating an IDoc Document Type from an XML Document

About this task

To create an IDoc document type from an XML document

Procedure

  1. In Designer, select File > New > Document Type.
  2. Select the parent namespace and name for the document type. Click Next.
  3. From the list of source files, select XML. Click Next.
  4. To select the source location, do one of the following in the File/URL field:
    • To create the document type from an XML document on your local file system, type the path and file name, or click the Browse button to navigate to and select the file.
    • To create the document type from an XML document that resides on the Internet, type the URL of the resource. The URL you specify must begin with http: or https:
  5. Click Finish.
    Important: If your IDoc is earlier than Version 3, edit the document type to remove the “40” designation from the control header element. For example, change EDI_DC40 to EDI_DC.

Generating an IDoc Document Type from a DTD

About this task

Note: If you are using SAP system version 4.6A or higher, you can create a DTD for an IDoc from transaction WE60. (See your SAP documentation for procedures). If you want to generate a document type from a DTD that you have created, you must first create an XML file that defines a root element and points to this DTD. (Use the XML files that SAP provides as guides.) Use this XML file to build your document type.

To create a document type from an IDoc DTD

Procedure

  1. In Designer, select File > New > Document Type.
  2. Select the parent namespace and name for the document type. Click Next.
  3. From the list of source files, select DTD. Click Next.
  4. To select the source location, do one of the following in the File/URL field:
    • To create the document type from a DTD on your local file system, type in the path and file name, or click the Browse button to navigate to and select the file.
    • To create the document type from a DTD that resides on the Internet, type the URL of the resource. The URL you specify must begin with http: or https:
  5. Click Next.
  6. Under Select the root node, select the root element of the DTD.
  7. Under Element reference handling, select one of the following:
    • Select Only generate document types for elements with multiple references to instruct Integration Server to create a separate document type for a referenced element only when the DTD contains multiple references to that element.
      • If an element is referenced multiple times, Integration Server creates a separate document type for the element. Integration Server replaces each element reference with a document reference field.
      • If an element is referenced only once, Integration Server defines the element in line by replacing the element reference with a document field.
    • Select Always generate document types for referenced elements to instruct Integration Server to always create a separate document type for a referenced element even if it is referenced only once. In the document type, Integration Server replaces each element reference with a document reference field.
  8. Click Finish.

Generating a Document Type from a Sample IDoc

About this task

If you do not have access to an SAP system or if you do not have, or cannot create, a DTD for your IDoc, you will have to generate your document type from a sample document that you submit to Designer at design time. If you have to use this option, you must obtain or create a comprehensive sample document before you begin building the service. The sample document should contain examples of all possible fields in the IDoc. Fields that are not represented in the sample document will not appear in the document type.

To generate a document type from a sample IDoc, in Designer you must:
  1. Save a pipeline image capturing the IDoc.
  2. Retrieve the created pipeline image.

Saving a Pipeline Image Capturing the IDoc

About this task

To save a pipeline image capturing the IDoc

Procedure
  1. Open Designer.
  2. On the File menu, select New.
  3. On the New panel, select Flow Service.
  4. On the New Flow Service panel, do the following:
    1. In the Folder tree, select the folder into which you want to save the document type.
    2. In the Element name field, type a name for the document type using any combination of letters, numbers, and/or the underscore character. (You might want to include the name of the IDoc in the name, for example app:mapOrders02.)
  5. Click Finish.
  6. Now switch to the empty flow service you just created.
  7. Click the icon on the Flow Pane toolbar and select the pub.flow:savePipeline service. If the service does not appear in the list, select Invoke to find it.

    The service will copy the contents of the pipeline so that you can retrieve the pipeline at a later stage. Later on the savePipeline step will be deleted from your flow again. Its purpose is simply to capture a copy of the IDoc. It is not a permanent part of your flow.

  8. Select the Pipeline tab.
  9. Select the $name variable under Service In and click the icon on the toolbar.
  10. Type a name for the saved pipeline and select OK.
  11. Click the icon to save the flow service.
  12. To send your sample IDoc to the service:
    • Use the SAGGui or the utility at /WmSAP/submitIDocXML.html
    • Send an IDoc over HTTP to the routing listener.

    Specify sender, receiver, and msgType as specified for the routing notification that should invoke the app:mapOrders02 service. For more information on how to create a routing notification see Configuring a Routing Notification.

Results

When the routing listener receives the document that you submit, it invokes the flow service you created above, which captures the IDoc by making a copy of the pipeline. In the next step, you will retrieve the saved image of the pipeline.

Note: The pipeline image created by the savePipeline operation is stored in memory and can be recalled by any subsequent service. However, the image is not stored on disk. If the server is restarted, it will no longer be available. You can create a permanent copy by using savePipelineToFile instead.

Retrieving the Created Pipeline Image

About this task

To retrieve the pipeline image you created

Procedure
  1. In Designer, create a new flow service in the same way you created app.idocs:mapOrders02.
  2. Select the Flow tab.
  3. Select the icon on the Flow Pane toolbar and select the pub.flow:restorePipeline service. If the service does not appear in the list, select Invoke to locate it. The service will retrieve the contents of the pipeline you saved previously.
  4. Set the $name input field of the service to the name of the saved pipeline and select OK.
  5. As the next step of the service, insert:
    If IDoc sent to Adapter for SAP Service Name Service Location
    over http pub.xml.xmlNodeToDocument WmPublicPackage
    over tRFC from an SAP System pub.sap.idoc:DocToDocument WmSAPPackage
    from the sample page /WmSAP/submitIDocXMLhtml pub.sap.idoc:DocToDocument WmSAPPackage
  6. Click the icon to save the flow service.
  7. Execute the service and then select the Results tab and locate the document variable. It should contain the data of your IDoc.
  8. Create an empty Document Type and copy the IDoc structure just captured:
    1. Select the root document defined within document. In this example, the root document is ORDERS02.
    2. Select Edit > Copy to make a copy of the root document.
    3. Switch back to the empty document type and mark the empty pane on the right hand side. Select Edit > Paste to paste the structure of the captured IDoc into your document type.
    4. Click the icon to save the document type.