Sunteți pe pagina 1din 2

Root Cause valid for Reason Code

Implement Change Cases before Validation - Business Add-In SCMG_BEFORE_VALID_C. This allows case attributes to be changed after data is changed on a dispute case. Prerequisite: Setup the first two characters of the Reason Code = first two characters of the Root Cause Code in the config tables for reason and root cause. Validate that the root cause code is valid for the reason (cause) code.

SCMG_BEFORE_VALID_C for Change Cases before Validation. Implementation Name : ZCLF_U_CHANGE_CASES method IF_EX_SCMG_BEFORE_VALID_C~CHANGE. *- Using the first 2 characters of the root cause code, compare it with the with the same first characters of the reason code *- and raise an error if these values do not match. data: zcase_type type string. data: zroot_ccode type string. data: zroot_ccode_old type string. data: zcause_code type string. data: zitattr type SRM_LIST_EDIT_ATTRIBUTE_VALUE. data: zis_changed type srmboolean. *----------------------------------------------------------clear: zis_changed. try. *--First make sure a change was made to the screen; enter key will *--invoke this routine CALL METHOD im_case->is_changed RECEIVING RE_RESULT = zis_changed. check: zis_changed = 'X', sy-ucomm = space. "Enter or Save pressed

*----------------------------------------------------------------------------*--Read values of CASE ATTRIBUTES - use field name from tables *--SCMG_T_CASE_ATTR or UDMCASEATTR00, wrong name will cause runtime exception *----------------------------------------------------------------------------CALL METHOD im_case->get_single_attribute_value EXPORTING im_srmadid = 'CASE_TYPE' RECEIVING re_value = zcase_type. CALL METHOD im_case->get_single_attribute_value EXPORTING im_srmadid = 'FIN_ROOT_CCODE' RECEIVING re_value = zroot_ccode. CALL METHOD im_case->get_single_attribute_value EXPORTING im_srmadid = 'REASON_CODE' RECEIVING re_value = zreason_code. CALL METHOD im_case->get_single_old_attr_value EXPORTING im_srmadid = 'FIN_ROOT_CCODE' RECEIVING re_value = zroot_ccode_old. catch cx_srm_framework. catch cx_scmg_case_attribute. endtry.

Root Cause valid for Reason

Page 1

3/17/2012

Root Cause valid for Reason Code


try. *- Using the first 2 characters of the root cause code do a compare with the *- reason code to see if it has the same first 2 characters if zroot_ccode <> zroot_ccode_old and zreason_code+0(2) <> zroot_ccode+0(2).

concatenate 'Invalid Root code: zroot_ccode for Cause:' zreason_code 'Contact admin to fix' into ztext separated by space.
*----- Popup with error message CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT_LO' EXPORTING TITEL = 'USER ACTION REQUIRED' TEXTLINE1 = ztext TEXTLINE2 = 'Pick a new code, Update not possible until resolved.' TEXTLINE3 ='' START_COLUMN = 15 START_ROW = 8. *-----Reset Root Cause back to original state (old) CALL METHOD im_case->set_single_attribute_value EXPORTING im_srmadid = 'FIN_ROOT_CCODE' im_value = zroot_ccode_old. endif. catch : cx_srm_framework, cx_scmg_case_attribute. endtry. endmethod.

Root Cause valid for Reason

Page 2

3/17/2012

S-ar putea să vă placă și