on 03-01-2013 5:04 PM
Hi All,
I must admit I'm stuck and feeling rather lame. We are on ECC 6, Basis release 701. I am making some requested customization in Dispute Case creation/change and have implemented BADI Customer-Specific Validation of Cases (class CL_IM_SCMG_VALIDATE_C).
Within the code I am validating several attributes; if they are invalid two export parameters must be populated and returned. The second one is EX_MESSAGES - type SCMG_T_ATTR_RETURN_VALUE. The first component of this structure is 'ATTR_VALUE' which is type IF_SRM_EDIT_ATTRIBUTE_VALUE. This is a reference type to class IF_SRM_EDIT_ATTRIBUTE_VALUE.
I am not as up to speed on OO techniques as I'd like to be, and do not know how to populate this field. Any help would be greatly appreciated; I've been banging my head on the wall for too long now; getting a headache.
Thanks much in advance,
mike
Hi All,
I found the solution and will outline it in case it helps anyone else:
* local structures:
DATA: ls_messages TYPE scmg_attr_return_value.
* local variables
DATA: lv_srmadid TYPE srmadid,
lv_att_val TYPE REF TO if_srm_edit_attribute_value.
CALL METHOD im_case->get_single_attribute
EXPORTING
im_srmadid = lv_srmadid
RECEIVING
re_value_object = lv_att_val.
MOVE: lv_att_val TO ls_messages-attr_value,
...
APPEND ls_messages TO ex_messages.
However, when an invalid entry is encountered, I get the proper message text but the type is 'A' even though I sent type 'E' which terminates the process. I am checking for SAP Notes but does anyone have any insight?
thanks,
mike
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vinny,
Sorry it has been some years since I've been into this code; I can't remember what resolved the issue and it was never documented as it should have been; we were seriously resource challenged at the time. If I had to guess, I would say that we were likely not setting the ch_is_valid parameter. here's the code from our BAdI; hope it helps.
METHOD if_ex_scmg_vldt_bfr_str_c~validate.
*&---------------------------------------------------------------------*
*& Implementation Name : ZSCMG_VLDT_BFR_STR_C
*& Implementation Short Text : QSI: Custom Validations before saving in F_DM
*& Definition name : SCMG_VLDT_BFR_STR_C
*& Interface name : IF_EX_SCMG_VLDT_BFR_STR_C
*& Name of implementing class : ZCL_IM_SCMG_VLDT_BFR_STR_C
*&
*&---------------------------------------------------------------------*
*& Description: This method is validate the Reason (field REASON_CODE) and
* Case Type (field CASE_TITLE) during the change process; all
* other QSI custom validation have already occured prior to
* this BAdI call
*
* Available parameters:
* IM_CASE Importing Type Ref To IF_SCMG_CASE "Case Interface
* FLT_VAL Importing Type SCMGPROCESS "Supported Process
* CH_IS_VALID Changing Type SRMBOOLEAN "Boolean: Possible Values IF_SRM=>TRUE / FALSE
* CH_MESSAGES Changing Type SCMG_T_ATTR_RETURN_VALUE "Case Attributes: Value with Message for Feedback
*======================================================================*
* M O D I F I C A T I O N L O G 146
*
* Date Issue No. Transport Person Changes
* -------- ---------- ---------- --------------- --------------------
* 03/18/13 148314 DE0K907128 mhammond Initial implementation
* 04/03/13 148314 DE0K907586 mhammond Add validation of field CASE_TITLE
* 10/21/13 173416 DE0K909696 sarveti new workflow
*======================================================================*
* local structures
DATA: ls_messages TYPE scmg_attr_return_value,
ls_tvarvc TYPE tvarvc,
ls_reason_txt TYPE scmgattr_reasont,
ls_dm TYPE zzf_dm_validate. "ticket 173416
* local variables
DATA: lv_srmadid TYPE srmadid,
lv_attr_value TYPE string,
lv_reason TYPE scmg_reason_code,
lv_case_title TYPE scmg_case_title,
lv_case_title_db TYPE scmg_case_title,
lv_fld_name TYPE rvari_vnam,
lv_reason_txt TYPE text80.
* local reference variables
DATA: lv_attribute TYPE REF TO if_srm_edit_attribute_value.
* check that this is a F_DM action
CHECK flt_val = 'F_DM'.
* first check the Case Type - get the current value
CLEAR: lv_srmadid, lv_attr_value.
MOVE 'CASE_TITLE' TO lv_srmadid.
CALL METHOD im_case->get_single_attribute_value
EXPORTING
im_srmadid = lv_srmadid
RECEIVING
re_value = lv_attr_value.
MOVE lv_attr_value TO lv_case_title.
* check that the case type is valid in z table
SELECT SINGLE zz_f_dm_case_ty
FROM zzf_dm_casety
INTO lv_case_title_db
WHERE zz_f_dm_case_ty = lv_case_title.
IF sy-subrc <> 0.
* get the attribute required for the error messaging...
CLEAR lv_attribute.
CALL METHOD im_case->get_single_attribute
EXPORTING
im_srmadid = lv_srmadid
RECEIVING
re_value_object = lv_attribute.
MOVE: lv_attribute TO ls_messages-attr_value,
'E' TO ls_messages-type,
'ZZ_FDM' TO ls_messages-id,
'001' TO ls_messages-number,
lv_case_title TO ls_messages-message_v1,
'Case Type' TO ls_messages-message_v2.
APPEND ls_messages TO ch_messages.
CLEAR ls_messages.
ch_is_valid = if_srm=>false.
ENDIF.
* validate the reason code
CLEAR: lv_srmadid, lv_attr_value.
MOVE 'REASON_CODE' TO lv_srmadid.
CALL METHOD im_case->get_single_attribute_value
EXPORTING
im_srmadid = lv_srmadid
RECEIVING
re_value = lv_attr_value.
MOVE lv_attr_value TO lv_reason.
* Start of Insert 173416
* validate the Reason code
CLEAR ls_dm.
SELECT SINGLE *
FROM zzf_dm_validate
INTO ls_dm
WHERE case_type = lv_case_title
AND reason_code = lv_reason.
* End of Insert 173416
* Start of Delete 173416
** ensure that the reason code is valid for the case type (confusingly stored in field CASE_TITLE)
* CONCATENATE 'ZFDM' lv_case_title 'RC' INTO lv_fld_name SEPARATED BY '_'.
* CONDENSE lv_fld_name NO-GAPS.
* TRANSLATE lv_fld_name TO UPPER CASE.
*
* SELECT SINGLE *
* FROM tvarvc
* INTO ls_tvarvc
* WHERE name = lv_fld_name
* AND low = lv_reason.
* End of Delete 173416
IF sy-subrc <> 0.
* get the attribute required for the error messaging...
CLEAR: lv_srmadid, lv_attribute.
MOVE 'REASON_CODE' TO lv_srmadid.
CALL METHOD im_case->get_single_attribute
EXPORTING
im_srmadid = lv_srmadid
RECEIVING
re_value_object = lv_attribute.
* get the reason code text...
SELECT SINGLE *
FROM scmgattr_reasont
INTO ls_reason_txt
WHERE langu = sy-langu
AND case_type = flt_val
AND reason_code = lv_reason.
* format the message...
IF sy-subrc = 0.
CONCATENATE '(' ls_reason_txt-description ')' INTO lv_reason_txt.
CONCATENATE lv_reason lv_reason_txt INTO lv_reason_txt SEPARATED BY space.
ELSE.
SELECT SINGLE *
FROM scmgattr_reasont
INTO ls_reason_txt
WHERE langu = 'E'
AND case_type = flt_val
AND reason_code = lv_reason.
IF sy-subrc = 0.
CONCATENATE '(' ls_reason_txt-description ')' INTO lv_reason_txt.
CONCATENATE lv_reason lv_reason_txt INTO lv_reason_txt SEPARATED BY space.
ELSE.
MOVE lv_reason TO lv_reason_txt.
ENDIF.
ENDIF.
MOVE: lv_attribute TO ls_messages-attr_value,
'E' TO ls_messages-type,
'ZZ_FDM' TO ls_messages-id,
'003' TO ls_messages-number,
lv_reason_txt TO ls_messages-message_v1,
'Reason Code' TO ls_messages-message_v2,
lv_case_title TO ls_messages-message_v3.
APPEND ls_messages TO ch_messages.
CLEAR ls_messages.
ch_is_valid = if_srm=>false.
ENDIF.
ENDMETHOD.
Hi Mike,
I am also having some what similar requirement.
If there is any attachment exists in the folder under 'Linked Objects' then the latest date of the attached document that was created/updated should be updated to the custom field attribute which is appended to the table: UDMCASEATTR00.
I implemented BADI SCMG_CHNG_BFR_STR_C & this is triggering during SAVE process of change document but not able to retrieve/fulfill the requirement as i am not familiar to OO Technics.
And during creation of Case ID also the above requirement should work, may be i should implement the same logic using BADI: FDM_AR_DISP_COMPLETE.
Please let me know how to achieve this requirement. Thanks in advance!!!
Thanks
Kishroe
User | Count |
---|---|
7 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.