After defining the identity for the message type, the next step is to specify the structure, or the "segment grammar", of the HL7 message type being defined. The segment grammar should be based on a combination of the sample message currently being analyzed and your counterparty's interface specification document if available. The goal of this step is to build up an accurate picture of the segments expected to appear in any instance of the message type as well as their order, optionality, repetition and grouping characteristics.
To add the segments to the segment grammar:
Open the Message Grammar window by double-clicking Message Grammar in the Workspace.
Click and drag each segment into the Segment Grammar panel and drop it under MSH to match the structure of the sample message, as shown below: