Electronic Data Interchange
Generating the Functional Acknowledgment (ASC/X12)

Generating a functional acknowledgment in Framework EDI (FREDI) requires the following:

  1. An EDI document to verify.
  2. Implementation Guidelines.
  3. Programmatically Generate the Functional Acknowledgment.

 

Implementation Guidelines

The following implementation guidelines are required to generate a functional acknowledgment:

  1. An implementation guideline containing the transaction set(s) that defines the syntax of the subject document.  When the subject document is traverse, this implementation guideline is referenced regarding the correct syntax of semantic objects encountered.  An example of an implementation guideline for the subject document is one that contains the Purchase Order (850) transaction set.
  2. An implementation guideline containing the Functional Acknowledgment (997) transaction set.  This guideline is used to build the functional acknowledgment.

Both transaction sets can  be referenced in the standard reference library as long as the EnableStandardReference (in the ediSchemas) to TRUE (or 1) .  When the subject document is verifying, the required transaction sets will be referred to if found in the library, and if no matching transaction sets were found in any other SEF files, if any were provided.

If the implementation guidelines were provided in Standard Exchange Format (SEF) files, the transaction sets can be provided as two separate files or both transaction sets can be in the same SEF file.  If the required transaction sets are not found in the SEF files then the standard reference library will be consulted. To exclusively use the SEF files, set the EnableStandardReference to FALSE (or 0), and an error is generated instead if the transaction sets are not found in any of the SEF files.

 

Programmatically Generate the Functional Acknowledgment

To generate an implementation guideline for EDI documents, enable the option EnableImplementationAcknowledgment in the ediAcknowledgment object.  The following example is in Visual Basic, and the following sample files are used:

Create an instance of ediDocument.  The ediDocument object is the top level application instance for Framework EDI (FREDI).  This object is the topmost object in the object model hierarchy of FREDI.  This instance is always created at the start of a program.

Dim oEdiDoc As Fredi.ediDocument

Set oEdiDoc = New Fredi.ediDocument

Enable the Functional Acknowledgment.  To enable the generation of the functional acknowledgment, set the option EnableImplementationAcknowledgment (in the ediAcknowledgment) object to TRUE.

Dim oAcknowledgment As Fredi.ediAcknowledgment

' Enable to generate implementation acknowledgment
Set oAcknowledgment = oEdiDoc.GetAcknowledgment
oAcknowledgment.EnableFunctionalAcknowledgment = True

Specify implementation guidelines.  Specify the implementation guidelines using the LoadSchema method of the ediDocument object.  In this example, the standard reference library will not be used so we disable its use by setting the EnableStandardReference property to false in the ediSchemas object.

Dim oSchemas As Fredi.ediSchemas
Dim oSchema850 As Fredi.ediSchema
Dim oSchema997 As Fredi.ediSchema

' Disable standard reference library.
Set oSchemas = oEdiDoc.GetSchemas
oSchemas.EnableStandardReference = False

' Load schema for Purchase Order document.
Set oSchema850 = oEdiDoc.LoadSchema(App.Path & "\850_X12-4010.SEF", Schema_Standard_Exchange_Format)
' Load schema for Functional Acknowledgment.
Set oSchema997 = oEdiDoc.LoadSchema(App.Path & "\997_X12-4010.SEF", Schema_Standard_Exchange_Format)

Load EDI document.  Load the EDI document using the LoadEdi method of the ediDocument object.  This method will read the 850_X12-4010.X12 subject document file, and verify its correctness using the 850 transaction set in the 850_X12-4040.SEF file previously loaded using the LoadSchema method.  The data is stored and organized internally in a hierarchical tree.

' Load EDI document normally.
oEdiDoc.LoadEdi App.Path & "\850_X12-4010.X12"

Traverse Data Segments of the Acknowledgment.  The functional acknowledgment is automatically created as the file 850_X12-4010.X12 is verified.  The transaction set 997 is used as a guideline to build the functional acknowledgment document, and because it is also an EDI file, it contains data segments that can be traversed.  To traverse the data segments, access the first data segment in the functional acknowledgment using the GetFirst997DataSegment of the ediAcknowledgment object, and move down the tree using NextDataSegment method.

' Traverse all the data segments in the EDI document and extract the value in the its individual
' data elements.

Set oDataSegment =
oAcknowledgment.GetFirst997DataSegment

While Not oDataSegment Is Nothing

Dim oDataElements As Fredi.ediDataElements
Dim oDataElement As Fredi.ediDataElement

sDisplayString = sDisplayString & "Segment: " & oDataSegment.ID & vbCrLf

' Get the data elements collection of the data segment.
Set oDataElements = oDataSegment.DataElements

' Get the value of the individual data elements
For Each oDataElement In oDataElements
' Only show data elements that have data
If Len(oDataElement.Value) > 0 Then
sDisplayString = sDisplayString & vbTab & "Element: " & oDataElement.ID & " = " & oDataElement.Value & vbCrLf
End If
Next

' Get the next data segment in the document.
Set oDataSegment = oEdiDoc.NextDataSegment
Wend

Save or View the Functional Acknowledgment.  Alternatively, the functional acknowledgment can be saved to a file using the Save method, or viewed using the GetEdiString method (in the ediAcknowledgment) object.


' View the functiona acknowledgment
MsgBox oAcknowledgment.GetEdiString()

See Also: