B2B Integration 10.4 | Administering and Monitoring B2B Transactions | webMethods Module for EDI | Preparing to Process Inbound Non-TRADACOMS Documents Using Trading Networks | Coding Services to Process Transaction and Group Documents | Logic to Process a Group Document when splitOption is Group
 
Logic to Process a Group Document when splitOption is Group
When the splitOption EDITPA variable is Group, Module for EDI does not create Transaction documents. If you want to process individual transactions, you can do so when you process the Group document. The following sample code illustrates the processing of individual transactions within the group.
Flow operation
Description
1
Invoke the wm.b2b.editn:getTspace service to retrieve the content of the Group document from the BizDocEnvelope (in the bizdoc variable) to populate the edidata variable. You can use the getTspace service regardless of whether the document is considered large.
For more information about getTspace, see webMethods Module for EDI Built-In Services Reference .
2
Invoke the wm.b2b.edi:envelopeProcess service to process the envelopes in the Group document. This service converts the interchange, group, and transaction set headers into an IData object named Values. The contents of the transaction sets remain unparsed.
*For ANSI X12 documents, Module for EDI creates an IData object of the ISA/IEA, GS/GE, and ST/SE headers/trailers.
*For UN/EDIFACT documents, Module for EDI creates an IData object of the UNB/UNZ, UNG/UNE, and UNH/UNT headers/trailers.
When setting the input variables to the envelopeProcess service, there is no need to validate or perform the compliance check on the Group document because the module already performs this validation during initial processing of the EDI document.
For more information about envelopeProcess, see webMethods Module for EDI Built-In Services Reference .
3
If the wm.b2b.edi:envelopeProcess service returns errors, invoke the wm.pub.flow:debugLog service to log a message to the server log.
4
Loop through the transaction set headers. Note that a Group document contains only a single interchange and a single group header. The data for the transaction set headers is within the Values IData object:
*For ANSI X12 documents, transaction set headers are in Values/ISA/GS/ST (as shown in the sample code).
*For UN/EDIFACT documents, transaction set headers are in Values/UNB/UNG/UNH.
The remaining steps specify processing to perform for the content of each transaction.
Flow operation
Description
5
Invoke the wm.b2b.edi.util:getEDIstring service to convert the transaction set header and trailer back to a string and concatenate them with the transaction set contents. The resulting transaction set with header and trailer can be either a String or InputStream object. For more information about the wm.b2b.edi.util:getEDIstring service, see webMethods Module for EDI Built-In Services Reference .
You must have an element that contains the entire transaction set, including header and trailer, before you can invoke the next service, wm.b2b.edi:convertToValues. This is because convertToValues uses a flat file schema for the EDI transaction set that includes the transaction set header and trailer. If you input data without the header and trailer, convertToValues returns errors.
6
Invoke the wm.b2b.edi:convertToValues service to:
*Convert the content of the transaction set from either a String or InputStream object to an IData object.
*Validate the structure of the EDI transaction.
The inputs to the convertToValues service include the flat file schema for the EDI transaction. convertToValues uses the flat file schema to determine how to parse the transaction set into an IData object and validate its structure.
For more information about convertToValues, see webMethods Module for EDI Built-In Services Reference .
7
Map the data from the EDI transaction set into the internal format.
Now that the contents of the transaction set are an IData object, you can access the data in the transaction set to map it to an IData object for the internal-format document. Depending on the complexity of your mapping requirements, you might need to add more logic than a MAP flow operation, or create a separate service to perform the mapping.
8
Invoke the wm.b2b.edi:convertToString service to convert the internal-format document from an IData object to a String.
The inputs to the convertToString service include the IData object, which contains the data and the flat file schema for the document in internal format. convertToString uses the flat file schema to determine how to form the internal-format document. convertToString can also use an IS document type to define the structure of the internal-format document.
For more information about convertToString, see webMethods Module for EDI Built-In Services Reference .
9
Branch based on the value of the EDI Processing Mode custom attribute. This attribute is in the bizdoc/Attributes/EDI Processing Mode variable. Module for EDI sets the value of the EDI Processing Mode custom attribute based on the setting of the EDITPA processingMode variable. For more information, see processingMode Variable.
10
If the value of the EDI Processing Mode custom attribute is:
*Production—Send the document in internal format to the back-end system by adding your own logic or invoking a service you created.
*A value other than Production (for example, Testing) —Invoke wm.pub.flow:debugLog to log a message to the server log. For example, the message may be, “Testing document was received but not sent to back-end system.”

Copyright © 2016- 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release