Hi Karen,
You can do this DME tree, you need:
In the propierties of DME tree, folder 'Sort/key fields' you should select three fields of structures FPAYH or FPAYHX that have the detail that you need in each level.
Then, you should create four segments:
Header, Payment detail, Invoices detail and return, like this picture:
In Payment segment you should select level 2 and 'End of segment' with the value 'Define different settings for this segment' with Carriage return doesn't select
In Invoices segment you should select level 3 and 'End of segment' with the value 'Define different settings for this segment' with Carriage return doesn't select
In Return segment, this is a segment without data, you should select level 2 and 'End of segment' with the value 'Define different settings for this segment' with Carriage return doesn't select, but with the field 'Empty segment for generating CR/LF' selected.
With this settings, the DME file works like you need.
Regards,