‎2010 Jan 14 1:58 PM
Dear Experts,
i'm using below code to close the ticket but its giving me dump when that particular ticket is in change mode if it is in display mode its working fine, how to solve this.
FUNCTION ZTEST_AUTO_CLOSURE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(LV_HEADER_GUID) TYPE CRMD_ORDERADM_H-GUID
*"----------------------------------------------------------------------
TYPES : BEGIN OF TY_CRM_JCDS,
STAT TYPE CRM_JCDS-STAT,
UDATE TYPE CRM_JCDS-UDATE,
UTIME TYPE CRM_JCDS-UTIME,
END OF TY_CRM_JCDS.
DATA : LT_CRM_JCDS TYPE TABLE OF TY_CRM_JCDS,
WA_CRM_JCDS_1 TYPE TY_CRM_JCDS.
DATA : LV_USER_STATUS TYPE CRM_JCDS-STAT VALUE 'E0010'.
SELECT STAT UDATE UTIME FROM CRM_JCDS INTO TABLE LT_CRM_JCDS
WHERE STAT LIKE 'E%' AND INACT = '' AND OBJNR = LV_HEADER_GUID..
IF SY-SUBRC = 0.
sort lt_crm_jcds DESCENDING by udate utime.
ENDIF.
READ TABLE LT_CRM_JCDS INTO WA_CRM_JCDS_1 INDEX 1.
IF SY-SUBRC = 0.
IF WA_CRM_JCDS_1-STAT = 'E0008'.
CALL METHOD cl_ai_sdk_sp_tools_helper=>set_status
EXPORTING
iv_user_status = lv_user_status
iv_header_guid = lv_header_guid
iv_commit = 'X'.
ENDIF.
ENDIF.
ENDFUNCTION.
Thanks and Regards,
Thirukumaran. R
Edited by: Rob Burbank on Jan 14, 2010 10:11 AM
‎2010 Jan 14 1:59 PM
‎2010 Jan 14 1:59 PM
‎2010 Jan 14 2:08 PM
The exception 'CX_SOCM_PRECONDITION_VIOLATED' was raised, but it was not caught
anywhere along
the call hierarchy.
Since exceptions represent error situations and this error was not
adequately responded to, the running ABAP program
'CL_HF_HELPER==================CP' has to be
terminated.
Edited by: Rob Burbank on Jan 14, 2010 10:12 AM
‎2010 Jan 14 2:15 PM
It seems the exception CX_SOCM_PRECONDITION_VIOLATED but it's not managed in the call
If this exception is of method cl_ai_sdk_sp_tools_helper=>set_status u should check the exceptions in your calling, if it's of method called by cl_ai_sdk_sp_tools_helper=>set_status it could mean some data are missing.
The standard code doesn't usually managed an exception if the error shouldn't occur.
Max
‎2010 Oct 07 8:58 AM
I ran into the same dump last week and solved it by catching the exeption myself:
Change status of linked document
TRY.
CALL METHOD cl_ai_sdk_sp_tools_helper=>set_status
EXPORTING
iv_user_status = lv_user_status
iv_header_guid = ls_orderadm_h-guid.
iv_commit = 'X'.
one of the linked documents could be somewhere in changemode
check for open linked documents first in before_save
CATCH cx_socm_precondition_violated into lv_exception.
if lv_exception is NOT INITIAL.
this should not happen ........
lv_text = lv_exception->get_text( ).
message e001(zssm) with lv_text.
exit.
endif.
CLEANUP.
ENDTRY.
The other option I used at the end was checking for locked documents in advance:
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
gclient = sy-mandt
gname = lv_gname
garg = lv_garg
GUNAME = SY-UNAME
LOCAL = ' '
FAST = ' '
IMPORTING
NUMBER =
SUBRC =
TABLES
enq = lt_enq.
EXCEPTIONS
COMMUNICATION_FAILURE = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
if 1 (or more) locked object found, raise message
DESCRIBE TABLE lt_enq LINES lv_lines.
IF lv_lines NE 0.
etc. etc.
Kind regards,
Tom