When the number of functional groups is known
If you are sending more than one functional group within the same interchange, you may know which application data is in the input.
For example, purchase orders, invoices, and so on. In this case, you would index the number of groups you need to produce.
Then, you would proceed to make each application's functional group envelope as specified in "Creating a single functional group envelope" .