cancel
Showing results for 
Search instead for 
Did you mean: 

enabling/disabling a button in column of salv table

former_member192818
Active Participant
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71...

Edited by: gvsastry on Jul 6, 2011 2:16 PM

former_member192818
Active Participant
0 Kudos

Thanks Gvsastry.

Appreciate the links a lot. I am just going over them. Hopefully I can find what I am looking for.

Best Wishes.

Sumit.

Answers (1)

Answers (1)

former_member199125
Active Contributor
0 Kudos

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

former_member192818
Active Participant
0 Kudos

Hey Sanasrinivas,

That is exactly that code I was looking for. Thanks for help. I am trying it out at the moment. Will get back to you soon.

Thank You.

Sumit.

former_member192818
Active Participant
0 Kudos

Hey Guys,

I was able to solve the issue with the articles. The code is similar to what is mentioned in the articles.

Thanks a lot.