This blog complements the blog “Easy queries on SAP NetWeaver BW” written by Uwe Fisher, giving detailed information about how-to-build a WebDynpro consumer for an Easy Query.
Currently there is no wiki available for easy query and so I use this blog to provide additional information to “Easy Query”
Easy Query ( EQ ) can be used as a datasource for Web Dynpro applications ( WDA ). With the following description you can build up a WDA within 10 minutes.
With the build in wizard web dynpro makes it easy to quickly build up a web dynpro component ( WDC) using an RFC as datasource. The next steps are already defining the layout for the screen.
4 steps to get started:
- Create an empty WebDynpro Component ( WDC)
- Execute the service wizard. As a result you get a WDC containing the complete logic to calls the RFC and fill the WDC context.
- Defining the data visualization and define when the data should be called (e.g. WDDOINIT)
- Create an WebDynpro Application ( WDA ) for the WDC from step 1
4 steps to get started (step-by-step-description)
Logon to BW system and call transaction EQMANAGER
My example is based on query SDN_EQ. The related EQ RFC is “/BIC/NF_50”.
- Check that the EQ generation is finished (field pending status is initial) and memorize the corresponding RFC
Have a look to the RFC API – in this case function /BIC/NF_50.
*" VALUE(E_S_QUERY_PROPERTIES) TYPE !RSEQ_S_QUERY_MD
*" VALUE(E_QUERY_OUTDATED_OR_INVALID) TYPE !RS_BOOL
*" !E_T_GRID_DATA TYPE !/BIC/NE_50
*" !E_T_COLUMN_DESCRIPTION TYPE !RSEQ_T_COLUMN_DESCRIPTION
*" !E_T_ROW_DESCRIPTION TYPE !RSEQ_T_ROW_DESCRIPTION
*" !E_T_MESSAGE_LOG TYPE !BAPIRETTAB.
Querymetadata like InfoProvider, query name, created on, created or changed by (user), changed on (date)
Flag that indicates whether the query is obsolete or invalid. If the query is changed, and an easy query already exists, the easy query must be generated again to ensure that the current data is displayed. If the easy query is not generated again, the system sets the E_QUERY_OUTDATED_OR_INVALID=X flag, and the easy query does not display any data.
Table E_T_GRID_DATA contains the values. Every key figure appears twice in this table: an unformatted key figure for use in diagrams, and a key figure as a text string formatted according to the local user settings.
This table contains language-dependent names for the grid columns and can be used for the table column header.
|E_T_Row_Description||This table provides additional information to the result e.g. giving details about which column is a total/subtotal column. Consumer can use this e.g. to highlight such a line.|
Provide all occured messages
If the query also contains query variables the RFC API also contains an Importing section.
The following step-by-step-description makes only use of E_T_GRID_DATA as this is the most important part of the RFC output.
(1) Start to build WDC
Create an empty WebDynproComponent (WDC) with SE80 with these input:
- Name: Z_SDN_EQ
- Description: WDC example for Query SDN_EQ
- Type: Web Dynpro Component
- Window Name: W_Main
- View Name: V_Main
(2) Call the service wizard
right-click on the new WDC-name “Z_SDN_EQ” and select create -> service-call
and run throught the wizard
Section “Select Controller”
Use Existing Controller = COMPONENTCONTROLLER.
Section “Select Service Type”
Select Radiobutton Function Module
Section “Select Service”
Function Module = /BIC/NF_50
Leaf the destination empty if the RFC call is local otherwise specify the destination.
Section “Adapt Context”
In this section the RFC output is mapped to the WDC context on COMPONENTCONTROLLER level. Especially for output E_T_GRID_DATA and E_T_MESSAGE_LOG I would use the mapping to object type Context due to the following layout definition step.
- set Object Type “Context” for all given Parameters
Section “Specify Mehtod Name”
- Method = EXECUTE_NF_50
- Description = “Call RFC /BIC/NF_50”
(3) Building the visualization
As preparation step the componentcontroller context needs to be maped to the view controller context.
- Select View V_MAIN within the View section of the WDC and highlight the Context tab.
- Map the componentcontroller context to V_MAIN controller
Switch to the layout tab and define the visualization
- Add a table control to the view V_MAIN and create a table control title
Assign datasource to the tablecontrol
- rightclick on the table control and select “create binding”
E_T_GRID_DATA contains the query resultset. Select context node E_T_GRID_DATA via context button and flag the wanted columns. Each column for keyfigures appears twice. The column with prefix ‘_F’ contains the formated value. The column without prefix contain raw values for grafical display purpose.
- Define a titel for each table column
Switch to componentcontroller section and navigate to tab „methods”
- To trigger the RFC call edit method WDDOINIT.
method WDDOINIT .
- Activate the whole WDC
(4) Create WebDynpro Application ( WDA ) for the WDC
Last step is to make this WDC an Web Dynpro Application
Create an WebDynpro Application (WDA) with SE80 with these input:
- Name: Z_SDN_EQ
- Description: Demo WDA for Query SDN_EQ
- Component: Z_SDN_EQ
- Interface View: W_Main
- Plug Name: DEFAULT
Test the WDA
Navigate to the WDA section , select the WDA and use the Test/Execute Icon
the result looks like this