Generate DDIC structure from XSD?

abap, sap-data-dictionary, wsdl, xsd

Solution

There is a program on the system called `SPROX_XSD2PROXY` with which you can upload one or more XSD files which will generate proxy objects for you.

You also end up with a service consumer with a corresponding class and what looks like a dummy operation.

The program is fairly short; it uploads the files(s) to an XSTRING, then converts the XSD(s) to WSDL(s) and finally the WSDL(s) to proxy objects using methods of a class called `CL_PROXY_TEST_UTILS`.

However, the result is satisfactory as it does give me a structure I can work with. And by examining the contents of those methods, it may be possible to build a more fine-tuned tool if I need one.

Problem

I have a number of XSDs that are part of the enterprise definitions for several services at the client. I would like to be able to take a single XSD and generate a DDIC structure from it (without the use of PI!) Seeing as you can generate proxies directly from a WSDL, and this also generates structures and data elements from the XSD definitions inside the WSDL, there is obviously already ABAP code that does this. But do you know what classes/function modules to use to achieve this? Perhaps there is a convenient utility function or class method that takes the XSD as input and generates the relevant DDIC objects? Some background on why I need this: Some of the services include variable sections that include a piece of XML containing the data for one of the enterprise XSD entities; I am hoping to have a DDIC representation of these, which I can fill at runtime and then convert to XML to include in the message.

Original source