cancel
Showing results for 
Search instead for 
Did you mean: 

Validating questionnaries in compliant

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

navn_metts
Active Participant
0 Kudos

Hello Sanjana,

Instead of searching for the error message use below approach.

you can use order_save badi for this. write your code in check_before_save method.

Read value of the " questionnaires section of the compliant" in this method. if it is not filled then raise exception do_not_save.

Raise do_not_save.

this will not save the transaction.

Br,

Navn

Former Member
0 Kudos

Naveen,

But standard is already doing validation and giving the error message..it's just that it's not stopping the compliant from saving...so if I do additional validation it will be duplicate right..

and that to questionnaire is not a single field so not sure how to validate that..

Thanks,

Sanjana.

Former Member
0 Kudos

Hi,

To prevent saving a document with error messages try to set following parameter in R3AC6 transaction:

Key: CRMORDER

Parameter name: NO_SAVE_MAND_FIELDS

Parameter value: X

I know this works for mandatory fields on screen, I do not know if it works for that error message related with survey.

Regards.

Former Member
0 Kudos

Hi Susana,

The parameter is already set in our system..but it's not working in my scenario..

Thanks,

Sanjana..

Former Member
0 Kudos

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.

Former Member
0 Kudos

Thanks Susana,

This seems to be working solution I have written some test code it's working..now I will validate my data according to that.

Thanks for your help on this.

Thanks,

Sanjana.

Answers (0)