TransformHierarchyToFlat Service

Hello All,
The “transformHierarchyToFlat” service in SAPBC is returning BLANK Control Record and Data Records. The input to the service is the bound note (to which the standard ORDERS05 IDOC data) is being passed.

The bound note format and contents have been checked and are fine. We need to convert the Hierarchial IDOC into RFC format to be able to send it across into SAP.

Any help in very much appreciated.
Thanks in Advance
Bhavani Shankar


Did you find a solution to this problem yet? I have the same issue as of today. If I find an answer I will let you know.

I have tried several other things like performing a recordToDocument and then running a decode on that. The XML produced seems to be correct but yet I still cannot get the decode service to produce the control records. It seems to me that we both have a problem with our boundNode input but I am not sure what it could be.

Just now noticed this was posted in 2002, not 2003. You probably have answer by now.




Thanks for the solution. I got it to work last night as well by adding the structure of my IDOC to the bound node. Well, at least the transformHierarchyToFlat service works. It seems that the DTD created by SAP did not have all the needed information to make the IDOC work. So this morning I have added HLEVEL as an attribute and it now seems to work overall. At least I am able to get IDOC’s into the system and run through my transaction.

I appreciate the help. My area of expertise is SAP HR, ALE and ABAP/ABAP Objects so I had to figure all of this out from scratch. Now that I have everything working it all seems pretty simple but I really feel the documentation could be improved. I was pretty happy when I got my own little java service to work list night since I don’t know java and haven’t used C++(seems very similar) in about 8 years. I guess that is why they have training classes. If you ever need any help in the areas of my expertise I answer questions at Search SAP(



Hi Brian & Bhavani,

I am actually facing the same problem right now,as you told i checked all the mandatory fields are getting populated or not and i tried to add HLEVEL field but couldnt understand where to add as i dont have that mush expertise in SAP but still working on it.Is there any thing else i need to take care of.i am working on a Custom Idoc which is an extension to SDPIID01.



Best way is to start from Basics… Just insert a save to pipeline in the very first statement of the service.

Once the IDOC is sent, just check whether such a file was created and what are the contents. If you feel the contents are ok, then check the conforms to parameter (the complete path of the IDOC structure must be given )
Ex: folder.subfolder:record

the output boundNote should have the IDOC data populated.

Let us know the results for us to help you more


Hi Bhavani,

I am a little bit confused about where to insert the savePipeline.Let me give you a brief idea of my flow so that you can guide me in the right direction.

my flow is like this

–> getFile
–> ConvertToValues
–> map(map to Idoc Structure which i created using DTD)
–> TransformHierarchyToFlat(boundNode gets populated but output is blank)
–> encodeSDATA(fails becoz Input values donot contain IDOC Control and data tables)
–> createTID
–> InvokeTransaction

I added HLEVEL field for each Segment and made sure that all mandatory fields are populated correctly in the Idoc but it didnt help me.
So where you think i am going wrong.


You intend to create an IDOC from a file you have !

Input to the TransformHierarchyToFlat should be the IDOC (record to be created from the DTD downloaded from SAP)
Output will be (in case the version is greater than 4.0)

Savepipeline before and after the TransformHierarchyToFlat service will give you more details of what is happenning in the TransformHierarchyToFlat

Hi Bhavani,

I did all whatever you said but no use,the Pipeline does contain all the data which i mapped to Idoc but it doesnt have anything about IDOC_CONTROL or IDOC_DATA. The thing is here we have undergone an SAP upgrade very recently and the Idocs whcih we are using are older version 3.x but being used in Latest Ver SAP 4.x. So is this causing any problem. but i was able to receive an Idoc from SAP and write it to a file successfully.

I am not sure, whether that could be a problem. The TransformHierarchyToFlat service has 2 sets of input (one for versions above 4.0 and one below 4.0). try for both sets and one of them may work… you can even check the version from the Control record and branch to automatically make it work for all versions.

Do check for all outputs of the service. Be sure that the IDOC is appearing correctly before getting into the service.

hi Bhavani,

I got rid of the problem somehow, The thing is the Name of the Idoc which i am giving as a reference is wrong. It is not the same as the root element of the Idoc.that is why its not getting populated now that is solved the InvokeTransaction Service is getting executed properly.

Thank you very much bhavni for the follow up

Hi all,

I’m doing an application that is intended to obtain information from a SAP machine and insert into a data mining DB. At the moment I’ve already done a couple of routing rules and services that “listen” to the idocs I’m sending from SAP.

Now I’m thinking in using the Broker, and I’ve not very sure how this matches with the SAP listener and the routing rules I’ve defined.

One solution that came to me is to create a routing rule that call an IS Service that transform the idoc into a canonical form and then publishes it to the broker. Moreover I’ll have several services that are subscribed to these canonical format that will transform the data and insert it into the database.

Does anyone sees any architecture error (I know are there). Some idea how to improve it? Any suggestion?

Thanks in advance,



I am trying to convert the XML to IDOC. I am Using SAP Business Connector 4.6.

I created the record structure from Schema for ORDERS05. I am able to read the XML. Can I directly map the XML to ORDERS05 record structure. Do I need to use “transformHierarchyToFlat” service?.

I tried to use to that service but I don’t see any service in or service out parameters?.

Can Some body point me the documentation and guide me to move in right direction. I am new to SAP.


yes you can map XML to ORDERS05 (SAP IDOC record) and once you build this as expected then invoke transformHierarchyToFlat (fill conformsTo)and this will give the IDOC String and process further to push to SAP.

There are lot of threads discussed on the basic procedure for SAP BC,use the keyword search based on the “transformHierarchyToFlat”


Hello guys,

I have to transform an XML structure to an IDoc in BC developer 4.6.
My flow service contains the steps as follows:

  1. Map //default
  2. documentToRecord //passes XML into the data reference
  3. Map //should map XML values to the IDoc
    structure, but IDoc structure remains
    blank!, and I don’t know why!!!
  4. transformHiearchyToFlat
  5. Transport Service: ALE Iutbound //sends IDoc to SAP

If anyone has any idea please contact me!

Kind regards,


Can anyone help me on making a segment mandatory in a standard IDOC.

Kind regards