on 02-18-2010 12:55 PM
Hi Experts,
In my application I have created On Checkbox named All statically.
Now I want that if this checkbox is marked as "checked" then the other two checkboxes named A1 and A2 which are created dynamically should be checked automatically. How to achieve this functionality?
Please help.
Thanks,
Pratibha
Edited by: pratibhas on Feb 18, 2010 6:27 PM
Hi,
When you must have created dynamic checkboxes you must have bound its Selected or Checked property to some attribute.
Try setting those attributes to abap_true when your ALL checkbox is checked.
Regards
Manas Dua
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
I have done like this :
SELECT * INTO TABLE it_dom FROM dd07t
WHERE domname = 'ZREQTYPES'.
LOOP AT it_dom INTO wa_dom.
str1 = wa_dom-domvalue_l.
str2 = wa_dom-ddtext.
str = str1.
CONCATENATE 'DYNAMIC.' str1 INTO str.
lr_check = cl_wd_checkbox=>new_checkbox(
text = str2
bind_checked = str
id = str1 ) .
cl_wd_grid_data=>new_grid_data( EXPORTING element = lr_check ).
lr_container->add_child( the_child = lr_check ).
ENDLOOP.
Hi
as per your code you are binding it to context node DYNAMIC
and attribute name is same as value of str1.
So I would say that in your code just get a reference to this attribute and set it to true, u can use the same loop
only instead of new checkbox and other stuff, you need to get node reference and set its attribute value.
Or other way could be
As you know the dynamic check box Id - value of str1...
you can set a flag when ALL check box is clicked in your on check method
and then in domodifview based on this flag set you
can get the view element by Id - str1 and set the checkbox as checkbed by using metho Set_checked.
Regards
Manas Dua
Hi,
You must be creating both the checkbox and writing this code in wddomodifyview, just be sure that you write this code after you have created those checkbox, and also see to it the ID of checkbox is correct to get the element reference.
You can also make a check to execute your code only when you get a reference to the checkbox created dynamically.
Hi
As per your code, your Id's are stored in variable str1
SELECT * INTO TABLE it_dom FROM dd07t
WHERE domname = 'ZREQTYPES'.
LOOP AT it_dom INTO wa_dom.
str1 = wa_dom-domvalue_l.
str2 = wa_dom-ddtext.
str = str1.
So, you can again loop at it_dom and use value str1 ( wa_dom-domvalue_l ) as ID.
Hi MAnas,
I have written following code ..pls tell why I am getting " Access Via Null Object Not Possible "
.
METHOD wddomodifyview .
DATA : lr_ui_root TYPE REF TO if_wd_view_element,
lr_container TYPE REF TO cl_wd_uielement_container,
lr_container_t TYPE REF TO cl_wd_uielement_container,
lr_check TYPE REF TO cl_wd_checkbox,
lr_check1 TYPE REF TO cl_wd_checkbox,
it_dom TYPE STANDARD TABLE OF dd07t,
lr_delegate_button TYPE REF TO cl_wd_button,
lr_view_delegate TYPE REF TO cl_wd_button,
wa_dom LIKE LINE OF it_dom.
DATA: lo_componentcontroller TYPE REF TO ig_componentcontroller.
lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).
DATA : str TYPE string,
str1 TYPE string,
str2 TYPE string.
IF first_time = abap_true.
lr_ui_root = view->get_element( 'TC2' ).
lr_container ?= lr_ui_root.
endif.
*clear internal tables
CLEAR: it_dom,
wa_dom.
data : id1 type abap_bool.
*fill the requistion type drop down with person's id pre raised requisitions.
SELECT * INTO TABLE it_dom FROM dd07t
WHERE domname = 'ZREQTYPES'.
LOOP AT it_dom INTO wa_dom.
str1 = wa_dom-domvalue_l.
str2 = wa_dom-ddtext.
str = str1.
CONCATENATE 'DYNAMIC.' str1 INTO str.
lr_check = cl_wd_checkbox=>new_checkbox(
text = str2
bind_checked = str
id = str1 ) .
cl_wd_grid_data=>new_grid_data( EXPORTING element = lr_check ).
lr_container->add_child( the_child = lr_check ).
lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).
IF lo_componentcontroller->flag = 'Y'.
lr_check ?= view->get_element( ID = str1 ).
CALL METHOD lr_check->set_checked
EXPORTING
value = 'X'
.
ENDIF.
ENDLOOP.
*IF lo_componentcontroller->flag = 'Y'.
*
*
* CALL METHOD lr_check1->set_checked
* EXPORTING
* value = 'X'.
* .
*
** lr_check1 = cl_wd_checkbox->set_checked(
** value 'X' ).
*
* ENDIF.
ENDMETHOD.
Thanks,
Pratibha
Hi,
I am getting error at this line :
lr_container->add_child( the_child = lr_check ).
And Error Is as under :::
Note
The following error text was processed in the system D11 : Access via 'NULL' object reference not possible.
The error occurred on the application server kcinhjsap12_D11_00 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: WDDOMODIFYVIEW of program /1BCWDY/7GCOK02YK0840142NIOZ==CP
Method: IF_WDR_VIEW_DELEGATE~WD_DO_MODIFY_VIEW of program /1BCWDY/7GCOK02YK0840142NIOZ==CP
Method: DO_MODIFY_VIEW of program CL_WDR_DELEGATING_VIEW========CP
Method: MODIFY_VIEW of program CL_WDR_VIEW===================CP
Method: DO_MODIFY_VIEW of program CL_WDR_CLIENT_COMPONENT=======CP
Method: DO_MODIFY_VIEW of program CL_WDR_WINDOW_PHASE_MODEL=====CP
Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP
Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP
Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP
Method: IF_WDR_RUNTIME~EXECUTE of program CL_WDR_MAIN_TASK==============CP
Hi,
i tried your code to create a checkbox dynamically and it is working fine for me ( Instead of looping, i was just creating one checkbox with hardcode binding path and ID ).
As I noticed in the following piece of code
IF first_time = abap_true.
lr_ui_root = view->get_element( 'TC2' ).
lr_container ?= lr_ui_root.
endif.
you have endif statement.
So when modifyview is called second time then you dont have reference to lr_container.
probably that can be the cause.
and other could be 'TC2' is the right ID of Transparent Container ..
Just check on these
Hi Manas,
You are right. Now when I click on ALL check box remainig two are getting checked automatically, but when I uncheck ALL checkbox, the remaining are not getting unchecked instead I am getting Error : There is already element with ID OTH_TRL which is ID of my first checkbox which I am getting from str.
Please help,
Thanks,
Pratibha
This is because on any action domodifyview will be triggered and you will be creating those check box with same ID again.
Place you code inside some if else loop so that check box are created only once .
On uncheck of ALL - you have to again do the same codig to but with abap_false for method set_enabled.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.