Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
Webdynpro ABAP

Reading values entered in Select options

 

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.

clip_image001

Enter the text for the Button UI element.

clip_image002

Create an action for the Button UI Element as shown below.

clip_image003

clip_image004

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.

clip_image005

clip_image006

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.

clip_image007

Choose the required attributes and press Enter.

clip_image008

Context node will be created as below.

clip_image009

Drag and drop the context tab to the view controller.

clip_image010

clip_image011

Right click on the table UI element and select create binding.

clip_image012

Select the context button to choose the node.

clip_image013

Choose the context node and press enter.

clip_image014

By default the cell editor of the column will be text view. If not choose the column editor as text view and press enter.

clip_image015

Attributes of the context node will be binded to the table as shown below.

clip_image016

Step 3: Go to action ONSUBMIT and write the following code.
Instantiate the used component.

clip_image017

Code will be generated as below.

clip_image018

Call the method call in the current controller using the code wizard.

clip_image019

clip_image020

Call the method get range table of the select option interface if_wd_select_options.

clip_image021

Code will be generated as below

clip_image022

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.

clip_image023

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.

clip_image024

Now write the codings to fetch the data and set it in the context node.

clip_image025

clip_image026

Save and activate. Test the application.

Output:

clip_image027

clip_image028

 

About Arun

1 Comments:

  1. 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

Powered by Blogger.