cancel
Showing results for 
Search instead for 
Did you mean: 

Select-Option on WDA

former_member300754
Participant
0 Kudos

Hi All,

In R/3, we can use Select-Option to get the parameter in range. What about in WDA? How can i use the select-option on WDA?

in case i want the selection screen to receive the criteria as a date range. for example:

Posting date: _____ to _____

Thanks in advance. : )

Regards,

Peerasit

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Peerasit,

Use this link

Regards,

Varun

Answers (3)

Answers (3)

former_member300754
Participant
0 Kudos

Thanks all

uday_gubbala2
Active Contributor
0 Kudos

Hi Peerasit,

You can find many resources available on SDN for the same. Try to do a search in the forum or in the bloges section. Am giving out a few available sources to you.

[Working with Select Options in Web Dynpro for ABAP by Abhimanyu Lagishetti|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c09fec07-0dab-2a10-dbbe-c9a26bdff03e]

[Using Select Options in a Web Dynpro(ABAP) Application by Rich Heilman|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2868] [original link is broken] [original link is broken] [original link is broken];

[Creating and using Variant in Select Options with Web Dynpro for ABAP -1 by Sharad Agarwal|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/10707] [original link is broken] [original link is broken] [original link is broken];

[Creating and using Variant in Select Options with Web Dynpro for ABAP -2 by Sharad Agarwal|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/10731] [original link is broken] [original link is broken] [original link is broken];

[Creating and using Variant in Select Options with Web Dynpro for ABAP -3 by Sharad Agarwal|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/10756] [original link is broken] [original link is broken] [original link is broken];

Regards,

Uday

Former Member
0 Kudos

Hi Peerasit,

Yes in WDA u can use select option very well.

Lets consider your case that you want to craete select option for posting date:

Step 1) Create a component with a view called main and in this view you want to create a select option called posting date.use componenet wdr_select_option in component usage.Also in view insert the same component i.e dr_select_option

Step 2) Now in wdiniti or view main you are suppose to write code to create select option.So just try to understand following code

method WDDOINIT .

DATA: lt_range_table TYPE REF TO data,

LV_TEXT TYPE STRING,

read_only TYPE abap_bool.

DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.

  • create the used component

l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).

IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.

l_ref_cmp_usage->create_component( ).

ENDIF.

  • get a pointer to the interface controller of the select options

*component

wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).

  • init the select screen

wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).

CALL METHOD wd_this->m_handler->set_global_options

EXPORTING

i_display_btn_cancel = abap_false

i_display_btn_check = abap_false

i_display_btn_reset = abap_false

i_display_btn_execute = abap_false.

  • lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'ZPOSTING_DATS' ).

wd_this->m_handler->add_selection_field( i_id = 'POSTING'

it_result = lt_range_table

i_read_only = read_only

I_DESCRIPTION = 'Posting'

).*

Here the most important code is the bold one .So by using above code u can create a select option in WDA

If you have any further doubts feel free to ask.

regards

PG

former_member300754
Participant
0 Kudos

Thanks for the advise you all

Hej PG,

your code is working well but i still have a doubt. At the time user enter the parameter, how the program store the value. As i think i must create a node which contains Sign, Low, High, and Options. Or any other way?

Thanks in advance.

Peerasit

uday_gubbala2
Active Contributor
0 Kudos

Hi Peerasit,

No you won't have to create a node of type SIGN, OPTION, LOW, HIGH for this. I guess that you were distracted after going through this [blog|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c09fec07-0dab-2a10-dbbe-c9a26bdff03e] by Abhimanyu Lagishetty. He was just trying to give out an example where you could get to see the criteria entered by the user in an table UI element.

For your requirement you will have to create the range table in the WDDOINIT method using the create_range_table method of IF_WD_SELECT_OPTIONS. (The system will automatically pass back the necessary reference of type IF_WD_SELECT_OPTIONS to you when you call the method init_selection_screen) While creating the range table you just specify an unique id by which you can identify this range table. So suppose you want the select-options to appear for 2 fields say CARRID & CONNID then you will have to create 2 range tables. After making his entries the user will click up on a button to trigger the search action. Within this button's action handler you will have to read the data from this range table and pass it on to your SELECT query using the method get_range_table_of_sel_field. Try refer to this [excellent blog|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2868] [original link is broken] [original link is broken] [original link is broken]; by Rich Heilman in which he explains about the same. Pay particular attention to the coding he puts into the WDDOINIT method & the button's action handler ONACTIONCONTINUE.

Regards,

Uday