on 07-06-2011 6:35 PM
Hello People,
I have implemented an SALV table using the config model, and it has one of the columns as a button with an onClick action, and this part works fine. These buttons need to be enabled/disabled based on the values of the other fields that are part of that row in the table.
What is the best way for me to selectively enable or disable a button slectively in a column using the SALV config model.
Any code snippets or pointers to existing blogs would be highly appreciated.
Thanks in advance for all your help.
Sumit.
Check this link.. here the author is making columns editable conditionally...this might help to build your logic.
There is a link for article in the below where author is setting color to one of the column.. You can follow the same logic to suppress push button.
http://wiki.sdn.sap.com/wiki/display/WDABAP/HowtoeditconditionallyrowofaALVtableinWebDynprofor+ABAP
Edited by: gvsastry on Jul 6, 2011 2:16 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sumit,
just add one more attribute of type wdy_boolean, and bind this attribute to readonly property of button by coding.
then as per your cell value set the attribute value, below is the some sample code.
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
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.