cancel
Showing results for 
Search instead for 
Did you mean: 

Error in RAISE do_not_save

Former Member
0 Kudos
184

Hi all,

I'm trying to restrict the user to save without entering some values in crm webui by using 'RAISE do_not_save'  , but i'm getting dump ,

help me..!

I found that when i give the condition as " if ls_orderadm_h_wrk-OBJECT_ID is NOT INITIAL" it will give dump without this condition it will work fine.

my code is ...!

CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'

     EXPORTING

       iv_orderadm_h_guid = iv_guid

     IMPORTING

       es_orderadm_h_wrk  = ls_orderadm_h_wrk

     EXCEPTIONS

       OTHERS             = 1.



if ls_orderadm_h_wrk-object_type = 'BUS2000108'.


if ls_orderadm_h_wrk-OBJECT_ID is NOT INITIAL.

       wa_header_guid = iv_guid.

       APPEND wa_header_guid TO lt_header_guid.

       CALL FUNCTION 'CRM_ORDER_READ'

         EXPORTING

           it_header_guid       = lt_header_guid

           it_requested_objects = lt_requested_objects

         IMPORTING

           et_orderadm_h        = lt_orderadm_h

           et_opport_h          = it_opportunity

           et_partner           = lt_partner

           et_status            = it_status

           et_status_h          = lt_status_h

           et_lead_h            = lt_lead_h

*         et_text              = lt_text

*         et_doc_flow          = lt_doc

*         et_survey            = lt_survey

         EXCEPTIONS

           document_not_found   = 1

           error_occurred       = 2

           document_locked      = 3

           no_change_authority  = 4

           no_display_authority = 5

           no_change_allowed    = 6

           OTHERS               = 7.

       .

       DESCRIBE TABLE lt_partner LINES LV_COUNT .



if LV_COUNT <= 1.

*        lr_core = cl_crm_bol_core=>get_instance( ).

*        lr_core->start_up( 'ALL' ).

*        lr_mess_cont = lr_core->get_global_message_cont( ).

         CV_OWN_MESSAGE = 'X'.

*        lr_mess_cont->add_message(

*          EXPORTING

*           iv_msg_type = 'E'

*           iv_msg_id = 'ZRAS_LEAD'

*           iv_msg_number = '000'

*           iv_msg_v1 = 'Information message'

*           iv_show_only_once = 'X').

                 MESSAGE E000(ZRAS_LEAD) WITH 'error in save ' RAISING DO_NOT_SAVE.

*   Please enter the required values...!

*do_not_save  = 1.

*        RAISE do_not_save.

       Endif.


ENDIF.

     ENDIF.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for your reply ..!

I removed the condition which was giving error ..!

Now its working fine...!

Former Member
0 Kudos

Hi Raghu,

Try to use the changing parameter CV_OWN_MESSAGE = 'X' as it would tell the system that there is a custom message available.

Regards,

Karthik

former_member186543
Active Contributor
0 Kudos

Hi Raghu,

I read your message but you missed to mention that is this code written in webui or I am guessing the ORDER_SAVE badi.

In case this is order_Save badi , then you cant use the message keyword there else it will not show message.

You rather have to follow the process : 1. Add error message and 2. Raise DO_NOT_SAVE.

For adding error message please use class : cl_bsp_wd_message_service.

Code will look like:

If check > 1.

     cl_bsp...... -> add message(  ). " Add error message to display in webui

     RAISE DO_NOT_SAVE.          " Stop the save process

endif.