cancel
Showing results for 
Search instead for 
Did you mean: 

Program exits when message manager capture an error

clark_min
Advisor
Advisor
0 Kudos

Hi Buddies,

I am new to web dynpro for ABAP and now I am doing some exercises.

In method check_input, I coded to capture an error using message manager. However, I find method FLIGHTTAB_FILL continue to run. I am wondering if there are some indicators (I find sy-subrc is still initial...any other indicators??) I could use to stop the program when an error is captured? Please advice. Thanks.

---------------------------------------------------------------

method FLIGHTTAB_FILL .

  wd_this->check_input(

  ).

........

endmethod.

    .

Kind Regards,

Clark

Accepted Solutions (1)

Accepted Solutions (1)

former_member197475
Active Contributor
0 Kudos

Hello Clark,

You have a parameter CANCEL_NAVIGATION in message manager methods, but am sure it will not stop the program code from further navigation.(I never realized that CANCEL_NAVIGATION = X works)

So always prefer to raise the message in DOBEFOREACTION. Else once you raise a message, set a flag value in an attribute and check the condition in FLIGHTTAB_FILL method.

BR,

RAM.

clark_min
Advisor
Advisor
0 Kudos

Hello Ram,

Thanks a lot for the quick response. As you propose, I raise the message in DOBEFOREACTION and it works perfectly.

I do not set the flag value when raising the message and do not check in FLIGHTTAB_FILL method. However, the program stops to go into method FLIGHT_FILL. I guess in DOBEFOREACTION, when message manager works, the program stops to execute the action. Is this understanding correct?

Kind Regards,

Clark

clark_min
Advisor
Advisor
0 Kudos

Hello Ram,

I do a search in the SCN and find the following thread answering my question.

I will close this thread. Thanks for the help again.

Kind Regards,

Clark

Answers (1)

Answers (1)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

If you use is_empty method, you can identify.

ABAP_TRUE if Message List Is Empty. So in your case, if messages are populated, space will be the value of the Boolean.

** get message manager

DATA lo_api_controller     TYPE REF TO if_wd_controller.

DATA lo_message_manager    TYPE REF TO if_wd_message_manager.

data lv_bool type abap_bool.

data lt_messages type if_wd_message_manager=>ty_t_messages.

lo_api_controller ?= wd_this->wd_get_api( ).



CALL METHOD lo_api_controller->get_message_manager

  RECEIVING

    message_manager = lo_message_manager

    .DATA lv_message            TYPE string.

DATA lv_message_type       TYPE i.



lv_message_type = if_wd_message_manager=>co_type_standard.

* report message

CALL METHOD lo_message_manager->report_success

  EXPORTING

    message_text              =  'Success'.



* report message

"ABAP_TRUE if Message List Is Empty