Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to disable button after error ?

Hello all
My program save data in table , when i have error. I upload excel file ,  then press Upload button ,it check the date in rows and if it incorrect print message. And if it found error, the save button must be disabled.How can i make this?


I create WDY_BOOLEAN in CONTEXT and bind it in button in enabled row. Pls help ,where i must write code, in WDINIT and how this code look like, maybe i need add something more in CONTEXT or write code with abap_true, abap_false ?

Tags:
replied

Hi,

Follow the below steps which will help to resolve your issue.

1)As you are doing validation on click of Upload button and checking of the date in rows are valid or not.

2)

IF ( LV_DATE is not valid).

     "show the error message & set the attribute which you have binded to the visiblity property

      of button to ABAP_FALSE(here button will be disabled)

data : lo_element type ref to if_wd_context_element.

       lo_element = wd_context->get_element( ).

      CHECK lo_element is not initial.

     lo_element->set_attribute(
     exporting
     value    = 'ABAP_FALSE'
      name  = '<ATTRIBUTE_NAME>'.

        RETURN.

ELSE.

     lo_element->set_attribute(

     exporting

     value    = 'ABAP_TRUE'

      name  = '<ATTRIBUTE_NAME>'.

    "Proceed further as per your requirement.

ENDIF.

Below is the code for your reference only.

Hope this helps you.

Thanks

KH

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question