on 01-08-2009 11:42 PM
Sorry for the probably dumb question but does anyone know how to make a ABAP web dynpro table editable? both specific rows and the whole table?
Regards
Mart
Hi Mart,
If you want to make your whole table editable then take all the cell editors of your table as input fields & then bind an initial internal table to your TABLE ui element. Am giving you a sample code fragment as to how you can bind an initial internal table to your node:
Regards,
Uday
METHOD wddoinit .
DATA: lt_sflight TYPE if_main=>elements_sflight,
wa_sflight TYPE if_main=>element_sflight,
lv TYPE REF TO if_wd_context_node.
DO 10 TIMES.
APPEND wa_sflight TO lt_sflight.
ENDDO.
lv = wd_context->get_child_node( name = 'SFLIGHT' ).
lv->bind_table( new_items = lt_sflight ).
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Appologies for the delay but thankyou everyone for your replies, my table is now working a treat.
Regards
Mart
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mart,
I now explain you the scenario to make selected fields as editable in WDA.
Just create the standard cell editors of the table control as, "Input Fields" instead of the normal 'TextView". (This can be done as follows... When you right click on the table UI element (under ROOTUIELEMENTCONTAINER) & say "Create Binding" you have the, "Standard Cell Editor" & "Standard Property" fields. Set "Standard Cell Editor" to "InputField" & "Standard Property" to "Value") Create a boolean attribute at component controller level & bind it to the readOnly property of the Table. (This variable should be under the same node which you are using for binding to your table ui element. If you dont create it under the same node then this variables value would stand true for all the cells under this column. If you however create it under the same node which you are using to bind your table then each cell of the column can have different true/false values resulting in different editable features.)Then within the WDDOINIT method you can You will then get the output as how desired.
Consider the code fragment below. It would result in all the fields which have the MEINS value equal to GM as read only & the rest would be editable. Hope this is clear to you now.
METHOD wddoinit .
DATA: lv_node TYPE REF TO if_wd_context_node,
lt_mara TYPE ig_componentcontroller=>elements_mara,
wa_mara TYPE ig_componentcontroller=>element_mara.
SELECT matnr
ersda
ernam
mtart
matkl
meins FROM mara INTO CORRESPONDING FIELDS OF TABLE lt_mara
WHERE meins = 'GM' OR meins = 'CCM'.
SORT lt_mara BY meins.
lv_node = wd_context->get_child_node( name = wd_this->wdctx_mara ).
LOOP AT lt_mara INTO wa_mara.
IF wa_mara-meins = 'GM'.
wa_mara-readonly = 'X'.
ELSE.
wa_mara-readonly = ' '.
ENDIF.
MODIFY lt_mara FROM wa_mara TRANSPORTING readonly.
lv_node->bind_structure( SET_INITIAL_ELEMENTS = ABAP_FALSE
new_item = wa_mara ).
ENDLOOP.
lv_node->bind_table( new_items = lt_mara ).
ENDMETHOD.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mart,
for making a table UI element editable ,wt you have to do is to bind an internal table(having initial lines) to ur table node like:
DATA lo_nd_cn_table TYPE REF TO if_wd_context_node.
DATA lo_el_cn_tableTYPE REF TO if_wd_context_element.
DATA ls_cn_cn_table TYPE wd_this->element_cn_table.
DATA lt_table TYPE wd_this->elements_cn_table.
DATA ls_table TYPE wd_this->element_cn_table.
navigate from <CONTEXT> to <CN_DARTDETAILS> via lead selection
lo_nd_cn_table = wd_context->get_child_node( name = wd_this->wdctx_cn_table ).
//AS many rows u want editable append that many initial lines.
do 5 times.
append ls_table to lt_table.
enddo.
lo_nd_cn_table->bind_table( lt_table ).
it works fine.in any issue ,get back.
Regards
govi
where cn_table is the node to which u have binded ur table ui.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.