cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to get service order errors

Former Member
0 Kudos

Hi,

My requirement is to terminate service order from saving if there are duplicate and convert the warning to error message,  I wrote a code in the order_save badi implementation.

I tried using CRM_MESSAGES_Search, display and collect,  I am getting the loghandle from crm_order_read (with requested objects Messages)  but not able to retrieve the messages from all this function module,  its retrieving nothing,  I tried passing header guid, item guid and handle

its not returning anything.  can any one guide me, how to get all the service order errors saved in Web ui.

thanks

dinesh

Accepted Solutions (0)

Answers (4)

Answers (4)

kapilpatil
Active Contributor
0 Kudos

Hello Dhinesh,

I am not aware of complete background of your development.

Just a suggestion, why not prevent the service order creation by checking duplicate at the start of the process. This will save time and effort for the user for entering data into service order.

Thanks,

Kapil

Former Member
0 Kudos

Hi Madhinesh,

Please find the reference code for the same.

METHOD get_order_errors.

   DATA:

         lt_msg_handle     TYPE bal_t_msgh,

         ls_msg_handle     TYPE balmsghndl,

         ls_msg_info       TYPE bal_s_msg.

   CHECK iv_order_guid IS NOT INITIAL.

   CALL FUNCTION 'CRM_MESSAGES_DISPLAY'

     EXPORTING

*     iv_show_all_logs          = 'X'

       iv_document_number        = iv_order_guid

       iv_surpress_output        = 'X'

       iv_amodal                 = ''

       iv_subscreen_set_data     = ''

       iv_in_transaction         = 'X'

       iv_amodal_control         = 'X'

       iv_amodal_control_refresh = 'X'

       iv_initialize             = ''

     IMPORTING

       et_msg_handle             = lt_msg_handle

     EXCEPTIONS

       not_found                 = 1

       display_error             = 2

       invalid_level             = 3

       OTHERS                    = 4.

   LOOP AT lt_msg_handle INTO ls_msg_handle.

     CLEAR ls_msg_info.

     "reading message information

     CALL FUNCTION 'CRM_MESSAGES_GET_MSG_INFO'

       EXPORTING

         is_msg_handle = ls_msg_handle

       IMPORTING

         es_msg        = ls_msg_info

       EXCEPTIONS

         OTHERS        = 1.

     IF ls_msg_info-msgty = 'E'.

       APPEND ls_msg_info TO ct_error.

       cv_error = 'X'.

     ENDIF.

   ENDLOOP.


Reward if helpful.

ENDMETHOD.

Former Member
0 Kudos

HI,

Thank you for the response,  But could not retrieve the error message..  Can you tell why the CRM_MEssages* function modules or the sbal * function group function modules don't return the messages

I tried passing the message handle retrieved from crm_order_read to BAL_GLB_SEARCH_MSG in the log_handle table and retrieved the message handle

then passed the message handle to BAL_LOG_MSG_READ it returned only 1 message (success) there are four message in the order/transaction (3 warning and 1 success)

can anyone tell me,  how to get the entire message log.

thanks

dhinesh

Former Member
0 Kudos

Hi,

Got that solved, the CRM_MESSAGES_SEARCH worked fine,  I did a mistake by passing the application log.  It needs message log.  and also message log can be retrieved from the function module crm_message_register.

thanks

Dhinesh.

Former Member
0 Kudos

Hi all,

I'm facing the same requirement with my report:

INPUT -> order GUID

OUTPUT -> error message

I want to use CRM_MESSAGES_SEARCH but the fm returns no values (i've also tried other fm of CRM_MESSAGES_* unsuccessfully).

I've tried the following import parameter:

CRM_MESSAGES_SEARCH

  IV_REF_OBJECT = GUID of the oneorder object

  IV_REF_KIND = A (for header) or B (for item)

  IV_ONLY_ERRORS_ON_OBJECT = abap_true

-> no result

[suggested by Shiromani]

Please, can anybody provide a more detailed description for using CRM_MESSAGES_SEARCH? Or should I use the SBAL_TOOLBOX? I'm looking for a smart solution

Thanks in advance

danmoe


abdulkalam_a
Participant
0 Kudos

Hi All,

The Function Module 'CRM_MESSAGES_SEARCH' is not working while executing directly from SE37, But its working fine at runtime and i have used it in my Web UI (GETTER/SETTER Methods).

First check the error message in CRMD_ORDER for any transaction and then pass the same message number in the Web UI Code..

      lw_msg_idno-sign = 'I'.

       lw_msg_idno-option = 'EQ'.

       lw_msg_idno-low-msgid = 'ZCRSRVCL_MSG'.

       lw_msg_idno-low-msgno = '017'.

       APPEND lw_msg_idno TO lt_msg_idno.

       CALL FUNCTION 'CRM_MESSAGES_SEARCH'

         EXPORTING

           it_r_msgidno   = lt_msg_idno

           iv_ref_object  = lv_item_guid

           iv_ref_kind    = 'B'

         IMPORTING

           et_msg_info    = lt_msg_info

         EXCEPTIONS

           appl_log_error = 1

           error_occurred = 2

           OTHERS         = 3.


if lt_msg_info[] is not initial.

**---- Error message (ZCRSRVCL_MSG/017) found in order item.

endif.

former_member158363
Active Contributor
0 Kudos

Hi Dinesh,

I think there are several ways but I usually use function modules from function group SBAL or SBAL_TOOLBOX (they have also very good documentation). The log is created for object CRM_DOCUMENT, subobject SINGLE and external identifier is a header guid. For saved documents, you can find these messages using transaction SLG1.

I am not sure whether function modules from group CRM_MESSAGES are used in WebUI (at least some of them - *DISPLAY - will only work in SAPgui).

Regards,

Dawood.