CALL TRANSFORMATION
Simple Transformations are a SAP proprietary programming language that is integrated into ABAP by CALL TRANSFORMATION in kernel release 6.40. Its concept differs from other transformation languages, like JiBX, which is used for XML-Java mapping, or languages suitable both for queries and transformations, like Lore, XCerpt, XDuce or even XSLT, which is also supported in ABAP by CALL TRANSFORMATION. By looking at examples of ABAP package SST_DEMO you will understand how ST works. In contrast to XSLT, Simple Transformations (ST) are fast, memory efficient and symmetric, but lack of expressiveness. Unfortunately I can't describe the power of ST in a mathematical way because, as usual, conditions cause most technical problems and the seems to be difficult to handle. In fact, despite its name, Simple Transformations have very powerful and sometimes complicated commands. So, when I'm asked about expressiveness, usually I tell how many times an ABAP or XML node can be accessed, mention the linear order during processing, lookahead of 1 and so on. If I start to tell about the possibilities to use parameters and breaking symmetry between serilization and deserilization, clever people will start to think how far they can go. A typical question is: Can I create relational data models from nested structures with an unbounded number of occurrences during deserialization? This is a natural question when you are doing data exchange with non-SAP systems using standardized XML frameworks and you want to save your data in transparent tables with additional foreign keys. If you are working with small datasets you won't have problems when you copy nested internal tables into the target data structure in ABAP. But let's ask the question if we can avoid heavy postprocessing. Of course, I would accept a pragmatic solution. Simple post processing in ABAP without copying data from one internal table into another would be acceptable. The answer to the question above is, "no chance. You have to do heavy post processing." The reason is very simple and has to do with the statement. Let's go into detail. In the following we consider an XML-document with a simple nested structure: A10102 A203 A typical example for a ST is to transform. this XML document into an internal table whose table line contains an component 'nummer' and another internal table: <?sap.transform. simple?> Note that the transformation above is symmetric and can be used in both directions to serialize and deserialize. If we want to transform. the XML stream above to a relational data model first we have to break up the nested structure. The values of elements have to be put into one internal table and then elements into another one. Afterwards we have to deal with the problem of how to link these internal tables. Without ABAP calls from ST we will have problems generating the foreign keys we need. But perhaps this could be done using clever mapping methods. If there is a new |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/99072/viewspace-531631/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/99072/viewspace-531631/