sending Multiple idocs to SAP

Hello All,
I am sending multiple idocs to SAP.
When the flow runs normally all the segments of SAP are under one idoc number,but When i restore the flow and submits, the data is going in a proper way to SAP.

I feel the problem is with service transformHierarchyToFlat.If anybody having faced the same problem,Please share with me which will be very helpful for me.

A quick response will be very worth to me.

I have seen the same thread but there was no solution specified .
I am spinning around this.