This section describes all of the development steps required to create a Natural IDoc client. This client creates messages for the IDoc inbound pipeline. The same interface is provided for COBOL.
To setup development
The development page (http://YourGateway:8080/sapr3idocxmlgateway/transformer/IDocType_ToFile or menu item
) provides an IDL text editor and the associated batch commands to develop a Natural PMQ Client. To set up this page, use the setup IDoc XML Gateway wizard on http://YourGateway:8080/sapr3gateway/manager/setupWizardIDocXMLGW#11 and perform step 11 .To create a Natural IDoc Client
Create the IDoc type information for your client on http://YourGateway:8080/sapr3idocxmlgateway/transformer/IDocType_ToFile or use the menu items , and .
Use the
link to open the IDL for a Natural IDoc client in a new browser window.The IDoc type DEBCOR01 returns the following IDL:
Program 'DEBCOR01':'DEBCOR01' Is Define Data Parameter 1 EDI_DC40 IN /* IDoc control record 2 MESTYP (A30) /* Message type 2 SNDPRT (A2) /* Partner type of sender 2 SNDPRN (A10) /* Partner number of sender 1 E1KNA1C IN /* (Must=X, OccMin=1, OccMax=9999, GMust=, GOccMin=0, GOccMax=0) Core master customer master basic data (KNA1) 2 MSGFN (A3) /* Function 2 KUNNR (A10) /* Customer number 2 ANRED (A15) /* Title 2 KTOKD (A4) /* Customer Account Group 2 LOEVM (A1) /* Central Deletion Flag for Master Record 2 NAME1 (A35) /* Name 1 2 NAME2 (A35) /* Name 2 2 ORT01 (A35) /* City 2 ORT02 (A35) /* District 2 PFACH (A10) /* P.O. Box 2 PSTL2 (A10) /* P.O. Box postal code 2 PSTLZ (A10) /* Postal Code 2 SORTL (A10) /* Sort field 2 STRAS (A30) /* House number and street 2 LAND1 (A3) /* Country key 2 SPRAS (A1) /* Language key 2 SPRAS_ISO (A2) /* Language according to ISO 639 End-Define
Mark and copy the contents of the browser window to your clipboard.
Start the developer editor for Natural PMQ client on the development page http://YourGateway:8080/sapr3gateway/manager/dev. This development environment is created by the Setup Wizard IDoc XML Gateway (http://YourGateway:8080/sapr3gateway/manager/setupWizardIDocXMLGW).
Paste the clipboard contents to the end of the edit IDL.
Change the 8-character short name of the program statement. In the
DEBCOR01
example, you can change it to DEBCOR
. The
starting test program will have the name DEBCORP
.
Click the
button.Click
.Transport the generated SYSTRANS file to your Natural development environment using the function
.Start the SYSTRANS utility in your Natural development environment and import the file.
The target Natural library is the library that is used in the library
statement of IDL. In this example: IDOC
.
Compile all of the sources with the catall
command.
Start the program to edit the example with the same IDoc type name.
In this example: DEBCORP
. See
inbound configuration of
partner profile for more parameter values.
* --------------------------------------------------------------------------- * * Test program for sending an XML document in a unit of work * This source is automatically generated from IDL * * --------------------------------------------------------------------------- DEFINE DATA /* DEBCOR01 LOCAL USING PMQINFOA LOCAL USING DEBCOR0A END-DEFINE * * DO NEXT INIT CALL ONCE IN THE SESSION * AND SET THE QUEUE CONNECTION PARAMETER CALLNAT 'PMQINIT' PMQ-SERVICE PMQ-RETURN * * DO NEXT OPEN CALL FOR EACH UNIT OF WORK CALLNAT 'PMQOPEN' PMQ-SERVICE PMQ-RETURN ...
Set all fields with the values that are necessary for your client
... * SET VALUES EDI_DC40.MESTYP := 'DEBCOR' /* TYPE = A(30) EDI_DC40.SNDPRT := 'LS' /* TYPE = A(2) EDI_DC40.SNDPRN := 'SRG' /* TYPE = A(10) E1KNA1C.MSGFN := '005' /* TYPE = A(3) ...
Make no changes to document sending and error handling:
* WRITE GROUP EDI_DC40 INTO STREAM CALLNAT 'EDI_DC40' EDI_DC40 * * WRITE GROUP E1KNA1C INTO STREAM CALLNAT 'E1KNA1C' E1KNA1C * * COMMIT AND CLOSE STREAM CALLNAT 'PMQCMMT' * ASK FOR STREAM INFORMATION CALLNAT 'PMQINFO' PMQ-SERVICE PMQ-RETURN * WRITE 'OK :' PMQ-RETURN.OK IF PMQ-RETURN.OK THEN WRITE 'CONV-ID:' PMQ-RETURN.CONV-ID WRITE 'UOW-ID :' PMQ-RETURN.UOW-ID ELSE WRITE 'CODE :' PMQ-RETURN.CODE WRITE 'MESSAGE:' PMQ-RETURN.MESSAGE END-IF END /* END OF DEBCOR
Set the connection parameter BROKER-ID to the
inbound pipeline in the generated
subprogram PMQINIT
.
... * * SET QUEUE CONNECTION PARAMETER BROKER-ID := 'localhost' SERVER-NAME := 'INBOUND-IDOC-XML' SERVER-CLASS := 'QUEUE' SERVICE := 'TEST' * USERID := *INIT-USER PASSWORD := ' ' * ...
To set the connection parameter on generation process, the following
parameter can be set with -D KEY=VALUE
syntax in the make command.
Key Parameter | Value Description | Default Value |
---|---|---|
SUPPRESS | The value PMQINIT suppresses the
generation of this subprogram in the SYSTRANS file.
|
|
BROKER | Sets the value for Broker ID. | localhost |
CLASS | Sets the value for class name. | QUEUE |
SERVER | Sets the value for server name. | INBOUND-IDOC-XML |
SERVICE | Sets the value for service name. | TEST |
USERID | Log on with this user ID as client . | The Natural system variable
*INIT-USER |
PASSWORD | User ID's password with EntireX Security. |
To change the make command for setting parameters, go to , , menu item and edit the command line in the opened text editor.
,...bin/erxidl -D BROKER=ETB001 -D FILE=PMQ.txt -t NatPMQClient.tpl $IDL
This example (on UNIX) sets the Broker ID to value
ETB001
and overwrites the default.
Run the test program. The test program writes the conversation ID and UOW ID to the output.
Go to the inbound pipeline and display the processing status.
Start the transaction we02
to display the inbound IDoc
in the SAP application server. Make sure that the
inbound partner profile
is configured.
To change the IDoc interface
There are cases in which the IDoc interface may be changed and cases in which it must be changed. Use the following rules during the development steps to optimize the IDoc interface.
The library name in IDL is the target Natural library. The SYSTRANS fills the Natural objects in this library.
The 8-character program name is used to generate the test program
(postfix P
), the PDA (postfix A
), and the subprogram
for creating the IDoc control record.
The alias of the 8-character program name is used for the XML main tag, which is the IDoc type name. Do not change this name. Do not change the group of field names.
Fields that are not needed can be deleted in IDL.
Groups that are not needed (=IDoc segment) can be deleted in IDL or the associated subprogram not called in the PMQ interface. Call a subprogram multiple, if this IDoc segment has multiple occurrences.
Do not change the calling sequence of subprograms.
The name of the segment is the sub-program name, if this name is less than or equal to 8 characters. The IDoc type determines whether the segment name is longer than the sub-program name. In this case, the first 6 characters become the IDoc type name and the last 2 are an index.
Alternative architecture
If the changes are too complex to use the IDoc interface from your existing application, consider the following implementation architecture.
Create your own IDL for exporting data from the business system.
Generate, import and call the PMQ interface.
Create a pipeline step to call the stylesheet you have created. This stylesheet transforms the XML document generated from your PMQ Interface to the IDoc XML structure. To get the schema of the IDoc structure, use the SAP R/3 interface repository link on the overview page.
To create this pipeline step, use the PMQdoc_toPMQ stylesheet. This stylesheet calls the stylesheet you created in the previous step.
Post the IDoc XML document into the
QUEUE/INBOUND-IDOC-XML/TEST
queue.