Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Validating questionnaries in compliant

Hi All,

While creating compliant if I save it without entering any data it's giving some default error messages but it's saving the compliant..

One of those error's is 'Details Survey Quality or Non-quality is not completed'  which will come if user does not fill the questionnaires section of the compliant  as shown in attachment.

If I get this message I shouldn't not allow complaint to save but not sure where this message is getting populated in complaint component..I searched 

in  cl_bsp_wd_message_service class but it doesn't have that message in save event of BT120H_CPL/OVViewset..

does any one have any idea how to check that error is there or not before save If I can read that error in save event i can use EXIT without saving that complaint..

I appreciate your help on this.

Thanks,

Sanjana.

Questionary.PNG (47770 B)
Former Member replied

Hi.

As I thought this only works for mandatory fields on screen.

My suggestion is that you implement ORDER_SAVE Badi Method CHECK_BEFORE_SAVE as described in note: 1519171 - How to prevent saving the document in CRM

I made an implementation which verifies if there is a message error and does not allows the document to be saved, try to implement something similar to see if it solves your issue. 

I am the functional consultant so I just copied the code here. Sorry if something is missing.

method IF_EX_ORDER_SAVE~CHECK_BEFORE_SAVE.

  DATA: tl_msd_handle TYPE BAL_T_MSGH,

        tl_msg_info   TYPE CRMT_MSG_INFO_TAB.

  DATA: el_msd_handle TYPE BALMSGHNDL,

        el_msg_info   TYPE CRMT_MSG_INFO.

  DATA : el_result       TYPE REF TO BSP_WD_MESSAGE_TAB.

  DATA : vl_check    .

  DATA : ol_msg_serv      TYPE REF TO cl_bsp_wd_message_service.

  ol_msg_serv = cl_bsp_wd_message_service=>get_instance( ).

**

*  el_result = ol_msg_serv->get_messages( iv_msg_type = 'E' ).

  vl_check = ol_msg_serv->ERROR_NAVIGATION_SUPPORT.

  CALL FUNCTION 'CRM_MESSAGES_SEARCH'

    EXPORTING

*     IT_R_MSGID               =

*     IT_R_MSGIDNO             =

      IV_REF_OBJECT            = iv_guid

*     IV_REF_KIND              =

*     IV_CALLER_NAME           =

*     IT_LOGICAL_KEYS          =

*     IV_PROBCLASS             =

*     IV_DETLEVEL              =

*     IV_LOG_HANDLE            =

*     IV_DOCNUMBER             =

*     IV_FRAME_LOG             = FALSE

*     IV_ONLY_ACTUAL_LEVEL     = FALSE

*     IV_ONLY_ERRORS_ON_OBJECT = FALSE

*     IT_MSGH                  =

    IMPORTING

      ET_MSG_HANDLE            = tl_msd_handle

      ET_MSG_INFO              = tl_msg_info

    EXCEPTIONS

      APPL_LOG_ERROR           = 1

      ERROR_OCCURRED           = 2

      OTHERS                   = 3.

  IF SY-SUBRC <> 0.

* Implement suitable error handling here

  ENDIF.

  DATA:

  el_ES_INFO      TYPE CRMT_MSG_INFO,

  el_ES_MSG       TYPE BAL_S_MSG,

  el_REF_OBJECT   TYPE CRMT_REF_OBJ_TEXT.

  LOOP AT tl_msd_handle INTO el_msd_handle.

    CLEAR : el_ES_INFO,

            el_ES_MSG,

            el_REF_OBJECT.

    CALL FUNCTION 'CRM_MESSAGES_GET_MSG_INFO'

      EXPORTING

        IS_MSG_HANDLE           = el_msd_handle

        IV_GET_CALLER_NAME      = ' '

      IMPORTING

        ES_INFO                 = el_ES_INFO

        ES_MSG                  = el_ES_MSG

        EV_REF_OBJECT           = el_REF_OBJECT

      EXCEPTIONS

        NOT_FOUND               = 1

        WRONG_CONTEXT_STRUCTURE = 2

        DATA_ERROR              = 3

        OTHERS                  = 4.

    IF SY-SUBRC <> 0.

* Implement suitable error handling here

    ENDIF.

    IF   el_es_msg-msgty = 'E'.

      RAISE do_not_save.

    ENDIF.

  ENDLOOP.

endmethod.

Regards.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question