Mapping of InfoProvider fields in CompositeProvider
When creating CompositeProviders in the new BW modeling tools in Eclipse it may become difficult to get a good overview of which InfoObjects from which InfoProviders are mapped in the Union or Join part, especially when your CompositeProvider contains many objects.
For MultiProviders we can use table RSDICMULTIIOBJ to get an overview of the mapping between source and target fields. However, since the definition of a CompositeProvider is stored as XML such a table does not exist for CompositeProviders. Although the XML of a CompositeProvider can be displayed in RSA1, ít’s difficult to read, even when you export the XML definition to Excel.
By making use of the attached program, it’s possible to display the mapping between InfoProvider fields and the CompositeProvider on your screen.
For this example I created a simple CompositeProvider containting two Advanced Datastore Objects;
The CompositeProvider contains the InfoObjects 0DOC_NUMBER and 0CALDAY from ADSO 01 as well as the InfoObjects 0DOC_NUMBER, 0DOC_ITEM, 0AMOUNT and 0CURRENCY from ADSO 02. The InfoProviders are joined on 0DOC_NUMBER.
The XML definition that has been created when activating the CompositeProvider, is stored in table RSOHCPR, field XML_UI:
This XML-string is displayed in the ‘hierachical view’ when you use the ‘Dispay XML’ button in RSA1 (partially shown below):
In this definition the <entity> part contains the name of the involved InfoProviders, whereas the <mapping xsi:> part contains the mapping between the source and target fields.
In order to ‘breakdown’ this hierachical view we need to put the XML definition into an internal table. One way to this, is to make use of the the function module SMUM_XML_PARSE, a guide with more information on this function can be found here.
This function parses the XML definition to and internal table containing 4 columns:
HIER – the hierarchy ‘node’
TYPE – A for ‘header’ and ‘V’ for value nodes
CNAME – the name of a node
CVALUE – the value of a node
To display the InfoProvider name and the source and target fields on our screen, we need to collect these values from the internal table into an output table. As seen above, the <element> part contains the name of the InfoProvider. So we check the column CNAME for the value ‘entity’ and get the tecnhical name in column CVALUE (minus the addition ‘.composite’.).
After that we get the values of the source and target fields by checking CNAME for ‘sourceName’ and ‘targetName’:
When all values have been checked, the values are displayed by making use of the SAP class cl_salv_table:
Note: the XML definition also contains information about the type of join and the properties of the CompositerProvider, which could also be added to the program output in order to create a ‘documentation program’.