Problem:
In Visual Composer 7.11 and up in WebDynpro runtime all Bex Query structures are displayed in columns.
Example:
Bex Query below contains two different structures.
The result of the query’s execution in Bex Analyzer is as following:
The result of the query’s execution in VC WebDynpo runtime:
Reason:
In VC 7.11 and up BI data is displayed in WebDynpro ALV table.
ALV table cannot display structure in rows. Therefore all query structures are displayed in the columns of ALV (please refer to the following on-line documentation):
http://help.sap.com/saphelp_nwce72/helpdata/en/48/e8b38783d4105ee10000000a42189d/frameset.htm
- Note that BI queries and query views in SAP List Viewer (ALV) are not displayed in the same way as in BEx Analyzer or BEx Web. For example:
- All query structures are displayed in the columns.
http://help.sap.com/saphelp_nwce72/helpdata/en/48/e8b3fc83d4105ee10000000a42189d/frameset.htm
- If the BI object contains a key figure structure and another structure, these three fields are generated for each member combination of the two structures.
Solution:
The issue can be solved by modeling in Visual Composer Design Time. As a result of the issue the output of the Query comes in one single row with the crisscrossed columns:
So the objective of the modeling solution is to split the row in such a way that there will be tree columns:
1. The read only column of “2004” and “2003”
2. The column of Net Sales
3. The column of Lost Deals
In order to implement the solution please follow the step by step instruction below:
- Create a White Service (Service Component); let’s call it “DoTranspose”
- Add DataIn (in1) connector to the Service Component and define its data as following:
We defined two text fields for the headers of the rows (it will be “2003” and “2004”) and 4 fields for the key figures.
Make sure that the types of the fields are correct.
3. Add Union operator with two input ports and connect it with DataIn
Note: the number of Union operator ports should be equivalent to the number of rows – in our case it is 2 rows: for 2003 and for 2004
4. Right click on the Union and choose command “Define Operator”
5. Define the Union operator as following:
Field Name defines the columns` headers.
In the row of Year put the fields that represent year (@year2003 and @year2004)
In the row of Net Sales put the fields of NetSales (for 2003 and for 2004 respectively)
In the row of Lost Deals put the fields of LostDeals (for 2003 and for 2004 respectively)
When you define the Union operator, you can use the values in the Drop Down, it will save your time:
6. Connect the output port of Union operator with DataOut connector.
Open the Define Data dialog of the DataOut connector and make sure that its fields are the columns` headers:
7. Save the ServiceComponent. It should look like the following:
8. Create a model , add the Query to it, connect the Query with StartPoint
9. Add the ServiceComponent to the model
10. Connect the DATA port of the Query with the in1 port of the SericeComponent and maintain the mapping in the following way:
Assigned value of the field year2003 should be string “2003” (constant string)
Assigned value of the field year2004 should be string “2004” (constant string)
Note: Field’s year2003 and year2004 will serve for the most left column of the table.
Assigned value of the numeric fields should be chosen from the drop down respectively. The drop down contains the list of key figures that comes from the back end.
For example, for NetSales2003 choose the value of Net Sales(2003)
As a result we have the following mapping:
11. Connect a table with the out1 port of the Service Component and name it ‘Fixed Table’
12. Connect a table with DATA port of the Query and name it ‘Original Table’
13. Deploy the model and run it. Check the result:
14. Go to Layout and make the column “Year” of the Fixes Table to be read only. The result will be the same as in Bex Analizer: