Did you ever had the need of creating a xml scheme out of DDIC tables/structures ?
I was searching in google for some ideas as this should be a quite common problem. But most of the solutions ended up in too much coding (using functions from function group SDIXML)
Indeed there seems to be a quite short solution using the ECATT implementation which by nature faces the same problems in a even wider variety:
These few lines will create a scheme for the table BKPF exporting it to a string:
Please take this short peace of code as opportunity to play around with all the other parameters and helper methods.
In case the ECATT classes do not fit all your needs you can still chosse the function group SDIXML. You will find a quite comprehensive example in the article of Sanjay Badhai following this link.