on ‎2017 Jul 21 4:03 PM
Hi Experts,
I have a requirement to design a selection screen as below.

I have used ViewContainerUIElement element named 'VIEW_CONTAINER'.
Created Dynamic Selection screen using component WDR_SELECT_OPTIONS inside WDDOINIT method under my main view. Used flow layout for my design.

Then trying to create Labels with check box as given above dynamically inside WDDOMODIFYVIEW method. But not able to align the elements as per requirement.
I have created check boxes. but not able to bring it under my dynamic selection parameter (as shown below).

I have to take container w.r.t ROOTUIELEMENTCONTAINER.
If i am taking VIEW_CONTAINER as reference, it is giving error for add_child method as it is not available in cl_wd_view_container_uielement.
Data lr_container TYPE REF TO cl_wd_uielement_container.
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_container->add_child(
EXPORTING
index = sy-tabix
the_child = lr_check_box
Taken reference from below threads.
https://archive.sap.com/discussions/thread/630107
https://archive.sap.com/discussions/thread/3246709
Please help on this.
Thanks in advance,
Manoj
Request clarification before answering.
Hi Manoj,
What I see is the missing Layout Info. Before you 'add_child' apply layout to the ui element.
cl_wd_matrix_data=>new_matrix_data( element = lr_check_box ). " Add Matrix Head data OR Matrix data based on where the ui is required.
And instead of adding directly the UI at index place. Create a Transparent Container / Group UI and insert the check boxes within the Transparent container to have the Title for each section.
Hope this helps,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Kiran,
After Matthew's comment, I have created it in WDDOINIT method.
I have created a transparent container at design time as per my previous post.
METHOD wddoinit .
DATA:
lref_componentcontroller TYPE REF TO ig_componentcontroller,
lref_cmp_usage TYPE REF TO if_wd_component_usage,
* lref_label TYPE REF TO cl_wd_label,
lref_range_table TYPE REF TO data.
DATA:
lv_id TYPE string,
lv_sel_f_id TYPE string,
lv_description TYPE string.
* Instantiate the select-options component
lref_cmp_usage = wd_this->wd_cpuse_select_options( ).
IF lref_cmp_usage->has_active_component( ) IS INITIAL.
lref_cmp_usage->create_component( ).
ENDIF.
* Sets the helper reference
wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
* Hide the standard select-options components.
wd_this->m_handler->set_global_options(
i_display_btn_cancel = abap_false
i_display_btn_check = abap_false
i_display_btn_reset = abap_false
i_display_btn_execute = abap_false ).
* Adding a block (type Tray) to the select-options
wd_this->m_handler->add_block(
i_id = 'BK01'
i_block_type = if_wd_select_options=>mc_block_type_tray
i_title = 'Work item Selection' ).
CLEAR lv_id.
FREE lref_range_table.
lv_id = 'XUBNAME'.
* Create a range table that consists of this new data element
lref_range_table = wd_this->m_handler->create_range_table( i_typename = lv_id ).
* Add a new field to the selection
wd_this->m_handler->add_selection_field( i_id = lv_id
i_within_block = 'BK01'
it_result = lref_range_table
i_read_only = abap_false ).
lv_id = 'CHECK_BOX'.
DO 6 TIMES.
FREE lref_range_table.
lv_sel_f_id = sy-index. CONDENSE lv_sel_f_id.
IF sy-index = 1.
CONCATENATE 'CHECK_BOX_' lv_sel_f_id INTO lv_sel_f_id.
lv_description = 'FI Invoices'.
ELSEIF sy-index = 2.
CONCATENATE 'CHECK_BOX_' lv_sel_f_id INTO lv_sel_f_id.
lv_description = 'MM Invoices'.
ELSEIF sy-index = 3.
CONCATENATE 'CHECK_BOX_' lv_sel_f_id INTO lv_sel_f_id.
lv_description = 'Travel Expenses'.
ELSEIF sy-index = 4.
CONCATENATE 'CHECK_BOX_' lv_sel_f_id INTO lv_sel_f_id.
lv_description = 'Travel Requests'.
ELSEIF sy-index = 5.
CONCATENATE 'CHECK_BOX_' lv_sel_f_id INTO lv_sel_f_id.
lv_description = 'Shopping Cart'.
ELSEIF sy-index = 6.
CONCATENATE 'CHECK_BOX_' lv_sel_f_id INTO lv_sel_f_id.
lv_description = 'Purchase Order'.
ENDIF.
* Create a range table that consists of this new data element
lref_range_table = wd_this->m_handler->create_range_table( i_typename = lv_id ).
* Add a new field to the selection
wd_this->m_handler->add_selection_field( i_id = lv_sel_f_id
i_within_block = 'BK01'
i_description = lv_description
it_result = lref_range_table
i_no_extension = abap_true
i_no_intervals = abap_true
i_as_checkbox = abap_true ).
ENDDO.
ENDMETHOD.
Now i am struggling with creating block. there is no such method inside WDR_SELECT_OPTIONS.
Please guide.
Thanks,
Manoj
Hi Manoj,
With Select options, it's always matrix head data (new row); There is no provision to control the layout with the standard select options component. You will have to follow your initial approach(custom transparent container) and start adding the ui fields dynamically with the Layout data taken into account while adding the dynamic fields.
Standard select options (always new row) -> for your reference.

Hope this helps,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could create the checkboxes dynamically with your WDR_SELECT_OPTIONS. Probably easier. Or create another usage for WDR_SELECT_OPTIONS, and add the checkboxes as parameters within that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.