cancel
Showing results for 
Search instead for 
Did you mean: 

Mandatory Fields error with attribute name in the error message

former_member252723
Participant
0 Kudos

Hi,

I have to display the mandatory fields error as ' Fill in all required fields - field name' (Attribute name).

how can I get the attribute name using the standard error message?

Message was edited by: Mustafa Shareef

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Mustafa,

Try below code:

call method cl_wd_dynamic_tool=>check_mandatory_attr_on_view

       exporting

         view_controller  = lo_view_controller

         display_messages = abap_false    " to hide message display

       importing

         messages         = lt_messages.


here all message will come to itab lt_messages.


then by looping lt_messages to wa and changing message text to appropirate then you can pass as blow.



CALL METHOD lo_message_manager->report_element_error_message

               EXPORTING

                 message_text = msg

                 element      = ls_messages-context_element

                 attributes   = lt_attributes.