cancel
Showing results for 
Search instead for 
Did you mean: 

Raising Error messages

Former Member
0 Kudos

Hi all,

We are using SAP ABAP Web Dynpro Component: RPLM_QIMT_NOTIF_COMP to create notification(IW21). After entering data to create notification screen and press save, we want to do some validations and trough error message to screen and stop saving notifications until errors are fixed. I am able to raise error message but not able to stop further processing. Notification is geting saved even after trowing error message. could some one give us clue or Rather sample code to stop further processing. Notification is created via portal.

Rgds,

Harish

Edited by: Harish Aginati on Jul 19, 2009 2:25 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

You can use Report Error message. ( control wizard ).

Use below mentioned code :

  • get message manager

DATA lo_api_controller TYPE REF TO if_wd_controller.

DATA 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_error_message

EXPORTING

message_text = ' Error messge Text'

  • params =

  • msg_user_data =

  • is_permanent = ABAP_FALSE

  • scope_permanent_msg = CO_MSG_SCOPE_CONTROLLER

  • view =

  • show_as_popup =

  • controller_permanent_msg =

  • msg_index =

  • cancel_navigation = ' X'

receiving

message_id =

.

Give Cancel navigation X.

I hope it works.

Former Member
0 Kudos

Hi,

Collect all the error messges in the global table of type bbpt_er_bapiret2.

Then,check for table is not initial.Then save the record.Else dont save.

U can also control navigation like this.

Hope this helps u!!!

Thanks,

Divya.S

Former Member
0 Kudos

Hi,

I tried with Cancel navigation = 'X' when raising error message, but still its not stoping to save notification. I raised error message in pre-exit ONACTIONSAVE event. Do you have any suggestion. is it possible to stop a navigation by raising error message with out binding to a attribute?

Former Member
0 Kudos

Hell Harish,

I had the same problem and used the following statement, maybe it will help you.

CALL METHOD wd_this->mr_message_manager->report_attribute_message

EXPORTING

message_text = lv_line

  • message_type = CO_TYPE_ERROR

element = <fs_pos>

attribute_name = 'REC_DATE'

  • params = params

  • msg_user_data = msg_user_data

is_permanent = ABAP_true

  • scope_permanent_msg = CO_MSG_SCOPE_CTXT_ELEMENT

  • msg_index = msg_index

cancel_navigation = 'X'

  • is_validation_independent = ABAP_FALSE

  • enable_message_navigation = enable_message_navigation

  • view = view

RECEIVING

message_id = lv_id

.

Parameter is_permanent makes sure you can not perform any action anymore. You can't even delete a row in the alv in case you have an error generated by the statement above.

Cheers and good luck!

Laurens

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I think the problem may be the location you choose to enhance. By the time you reach ONACTIONSAVE, you are already beyond the normal validation event - WDDOBEFOREACTION. If you want to stop further actions, shouldn't you place your enhancement there?

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

Use REPORT_ERROR_MESSAGE, and set IS_PERMANENT SCOPE_PERMANENT_MSG to controller

If the component is FPM managed then you can also use

CALL METHOD wd_this->mr_message_manager->report_T100_MESSAGE

EXPORTING

IV_MSGID = 'MSGID'

IV_MSGNO = 001

IO_COMPONENT = wd_this

IV_SEVERITY = if_fpm_message_manager=>GC_SEVERITY_ERROR

IV_LIFETIME = if_fpm_message_manager=>GC_LIFE_VISIBILITY_AUTOMATIC

Where the mr_message_manager is a reference to of IF_FPM_MESSAGE_MANAGER.

I hope it works

Abhi