cancel
Showing results for 
Search instead for 
Did you mean: 

How to display error message on the screen

Former Member
0 Kudos

I am new to WD world and need all possible steps to resolve the following issue.

I need to display the error message on the screen if any required field is empty when user click on SAVE button.

I have set the attribute GO_MESSAGE_MANAGER and check the both box for PUBLIC and REFTO and set the associated type IF_WD_MESSAGE_MANAGER under COMPONENTCONTROLLER.

Under the method of COMPONENTCONTROLLER set the value WD_THIS-GV_NAV_FORBIDDEN = IV_NAV_FORBIDDEN. Which is type IMPORTING of associated type WDY_BOOLEAN.

GV_NAV_FORBIDDEN has been set to attribute WDY_BOOLEAN in the COMPONENTCONTROLLER.

Under the ACTION (on SAVE button) of my default view (VW_DEFAULT) I am doing the following.

IF lv_f_name IS INITIAL

CALL FUNCTION 'BALW_BAPIRETURN_GET2'

EXPORTING

type = 'E'

cl = 'HRRCF0002'

number = '020'

IMPORTING

return = ls_return.

lv_message = ls_return-message.

  • NEED TO PUT CODE TO PASS IT ON

ENDIF.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The thing I can not figure out is the input parameter of this call. My CONTEXT has a node1->node2->node3->f_name.

CALL METHOD lo_message_manager->report_attribute_error_message

EXPORTING

message_text = lv_message

element = HOW WIILL YOU FIND THE VALUE OF THIS

attribute_name =

  • params =

  • msg_user_data =

  • is_permanent = ABAP_FALSE

  • scope_permanent_msg = CO_MSG_SCOPE_CTXT_ELEMENT

  • msg_index =

  • cancel_navigation =

  • is_validation_independent = ABAP_FALSE .

wd_comp_controller->set_navigation_forbidden( iv_nav_forbidden = abap_true ).

Former Member
0 Kudos

you dont need those other extra inputs those are optionals, you are fine with only lv_message or you can do 'ENTER THE MESSAGE AS TEXT MESSAGE' either way is correct.

for future reference, the element name is your attribute name, if you used the wizard to read the CONTEXT node it will be the Context node Name and the Attribute will be the Attribute inside the NODE that you are trying to read.

but you need to validate if is empty and they try to save then give an error, so you dont need the other inputs.

Try it that way, if you have more question just let me know!

Jason P-V

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi JperezVelez,

Thanks for all your help. Just to refresh you about input parameter (element), it is an obligatory field. I did able to find the value of that node ELEMENT.

Former Member
0 Kudos

sap_learner -

you only need to go to your onACTION event (SAVE button) and when you have your IF statement that you want to display the error you only need to go to the WIZARD

WIZARD is to the left of PATTERN (button) and right of EXTERNAL DEBUGGER (button)

Click the tab General (if you have 7.0 webdynpro) if not just try to find the radio button for GENERATE MESSAGE

Message Manager - IF_WD_MESSAGE_MANAGER

and in the method click the pull up button, if you want error message select REPORT MESSAGE or if you want warning message select REPORT_WARNING then GREEN ARROW (continue) and wizard will populate the code for you and in the message text area you just write whatever you want to display in your error message.

hope this help

Jason P-V