In the previous post, we studied about how to set the select option in the screens and what are the various options that can be set using the select options.
Now, we will study about how to read the values that is entered in the select option into the application.
We will read some values from the screen based on an action.
Let us create a button and a table UI element to display the records for the entered value in the select options.
Step 1: Right click on the root container UI element and select insert UI element. Create a button UI Element as shown below by providing the id and type for the UI element.
Enter the text for the Button UI element.
Create an action for the Button UI Element as shown below.
Right click on the root container UI element and select insert UI element. Create a table UI Element as shown below by providing the id and type for the UI element.
Step 2: In the context tab of component controller, create a context node and bind it to the table.
Enter the name and dictionary structure and select add attribute from structure.
Choose the required attributes and press Enter.
Context node will be created as below.
Drag and drop the context tab to the view controller.
Right click on the table UI element and select create binding.
Select the context button to choose the node.
Choose the context node and press enter.
By default the cell editor of the column will be text view. If not choose the column editor as text view and press enter.
Attributes of the context node will be binded to the table as shown below.
Step 3: Go to action ONSUBMIT and write the following code.
Instantiate the used component.
Code will be generated as below.
Call the method call in the current controller using the code wizard.
Call the method get range table of the select option interface if_wd_select_options.
Code will be generated as below
Modify the code as below.
Replace the ME object reference with the object created earlier.
Pass the I_ID and Create a range table of type ref to data, because receiving parameter rt_range_table is declared in the same way mentioned above.
Now write the below codings to get the value entered in the select option. RT_EBELN contains the object reference and from that we need to get the value. Here we require a field symbol to do the job. Declare a field symbol of type table and then assign the object reference to the field symbol. The field symbol will now hold the data entered in the select options which you can see it in the debugger.
Now write the codings to fetch the data and set it in the context node.
Save and activate. Test the application.
Output:
CAN YOU PLEASE SHARE A WEB DYNPRO PROGRAM WITH 2 VIEWS , IN ONE VIEW THERE WILL BE SELECTION SCREEN USING SELECT OPTION COMPONENT AND IN SECON DVIEW THERE WILL VE ALV OUTPUT USING ALV COMPONENT.
ReplyDelete