cancel
Showing results for 
Search instead for 
Did you mean: 

Display error

former_member215781
Active Participant
0 Kudos

I need to display an err message related to blank field in the table.

How do I achieve this?

I have used get_static_attributes_table to get table entries and READ the table to check for desired field is blank.

If sy-subrc is 0, i try to raise an err message using report_element_error_message but it doesn't seem to work.

There is no dump or anything....just the err message does not get displayed and the program continues normally where it is expected to stop and display the err

Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member215781
Active Participant
0 Kudos

I was able to achieve this using REPORT_MESSAGE and then EXIT to display the error on the same page.

      IF sy-subrc EQ 0.
*" Display Error message
        DATA: lo_api_controller  TYPE REF TO if_wd_controller,
              lo_message_manager TYPE REF TO if_wd_message_manager.

        lo_api_controller ?= wd_this->wd_get_api( ).

        CALL METHOD lo_api_controller->get_message_manager
            RECEIVING
              message_manager = lo_message_manager.

*" Report message
        CALL METHOD lo_message_manager->report_message
            EXPORTING
              message_text   = 'Name cannot be BLANK'.
              
        EXIT.  
        
       ENDIF.