In a Query Chain, we can iterate over a set of values and ingest the data. The iteration process takes place looping in between a set of key values. Here in this example, we considered SAP VBAK (Sales Document: Header Data) table and VBELN (Sales and Distribution Document Number) column as one of the primary keys.
Steps involved:
- Create a Query using static values
- Create a variable using an output Query
- Add the created variable in a Query
- Run the Query Chain using an output Query
Create a Query using static values:
- Click the QUERY STUDIO module.
- Hover on Query Builder snippet and click on Query.
- This action navigates to the Query page.
- Let’s select RD Datastore from the Profile drop-down list.
- Add the required values and click on the Save.
- An Additional saving options pop-up window is displayed.
- Under the Query Name text field, let’s add VBAK using 3 values.
- Select the desired folder path and click on Save.
- A toaster message VBAK using 3 variables saved successfully! is displayed.
Create a variable using an output Query:
- Hover and click on Variable Explorer.
- This action navigates to the Variable Explorer
- Click on Variable Builder.
- This action navigates to Variable Builder
- Add the Variable Name, and Description text fields and select the Variable Type drop-down list.
- Select Output from query for Input options.
- Select VBAK using 3 values for the Select Query.
- Click Test Variable button.
Note: Here, the Selected Query is updated accordingly.
- A Results for USR_VBAK Variable with 3 values pop-up window is displayed that shows the variables list.
- Close this window.
- Click on Save.
- A toaster message ‘VBAK Variable with 3 values’ Variable Created Successfully is displayed.
Add the created variable in a Query:
- Click the QUERY STUDIO module.
- Hover on Query Builder snippet and click on Query.
- This action navigates the user to the Query page.
- Select SAP ECC Livewire from the Profile drop-down list.
- Click the Navigator button.
- Search for VBAK table and click on it.
- This action loads the table.
- Click the Local Filter icon.
- A Local Filter Expression for VBAK pop-up window is displayed.
- Drag the Available Fields option and select VBELN(Sales and Distribution Document Number) column from the drop-down list.
- Drag the Available Operators and select Like from the drop-down list.
- Click the Variable icon.
- A Variables pop-up window is displayed.
Note: By default, Predefined variables tab is selected.
- Select the User defined variables tab and select the variable USR_VBAK Variable with 3 values which loads the metadata slide screen.
- Click on Test Result.
- The list of values is loaded in the Result text field.
- Click Ok to load the variable.
- The expression VBELN LIKE ‘~ ~USR_VBAK Variable with 3 values # #’ is updated accordingly.
- Click on Save to save the filters.
- The Local Filter icon is turned green which indicates the filter condition is added successfully.
- Click on Save.
- An Additional saving options pop-up window is displayed.
- Add SAP VBAK Variable Query under the Query text field.
- Click on Save.
- A toaster message SAP VBAK Variable Query saved successfully! is displayed.
Run the Query Chain using an output Query:
- Click the QUERY STUDIO module.
- Hover on the Query Builder snippet from the left pane options.
- Click the Query Chain option.
- From the Data Source tab, drag and drop Queries icon and double-tap on it.
- A Read data from Query pop-up window is displayed.
- Let’s search with SAP VBAK Variable Query to populate the results.
- Select and checkbox SAP VBAK Variable Query to view its metadata as a slide screen.
- Click on Select button to save the Queries widget.
- Click the Output tab.
- Let’s drag and drop an RD Output icon and double tap on it.
- An RD Output pop-up window is displayed.
- Click on Select button.
- This action saves the RD Output widget.
- Click on the Iterative Ingestion icon.
- An Iterative Ingestion pop-up window is displayed.
- Let’s switch on Iterative Ingestion toggle button and select USR_VBAK Variable with 3 values from the Available Variables.
- Click on Save button to save the Iterative Ingestion settings.
- Click on Execute Now button.
- This action executes the Query Chain.
- Here, we can notice, the Iterative Ingestion icon turned green which indicates the settings are applied successfully.
- Here the Query Chain is passed.
Note: Here the iteration and ingestion process take place in the background.