2014 Apr 17 5:09 PM
Hello,
the standard PDF "Root Cause Investigation" (EHHSS_INC_AIF_INV_ROOTCAUSE) has a section with "Planned action to Prevent Future Incident' and when this PDF goes to SAP...It modifies the incident. SAP did not code the section "Planned action..." which refer to the tab 'Task' in the incident...we opened an OSS message but SAP said it is delivered like that....
The PDF use the BOPF with business object EHHSS_INCIDENT and there is a "Business Object Representation Node" for EHHSS_INCIDENT_ACTION. I need to add an action(BO EHHSS_INCIDENT_ACTION) to the incident(BO EHHSS_INCIDENT) in the method "STORE_DATA" of the inbound persister CL_EHHSS_INC_AIF_INV_ROOTC_INB.
When I executed this code...I get a short dump and I think the problem is the association but I am new to BOPF...Can someone help me to get through this please?
FIELD-SYMBOLS: <ls_mod> LIKE LINE OF lt_mod.
DATA: lr_s_root TYPE REF TO ehfnds_act_root,
mo_svc_mngr TYPE REF TO /bobf/if_tra_service_manager.
lo_change TYPE REF TO /bobf/if_tra_change.
lo_message TYPE REF TO /bobf/if_frw_message.
"Obtain a reference to the BOPF service manager:
mo_svc_mngr =
/bobf/cl_tra_serv_mgr_factory=>get_service_manager(
if_ehhss_inc_c=>sc_bo_key ).
CREATE DATA lr_s_root.
lr_s_root->key = /bobf/cl_frw_factory=>get_new_key( ).
lr_s_root->root_key_ref = ls_inc_root-db_key. "Key of the current incident
lr_s_root->node_key_ref = /bobf/cl_frw_factory=>get_new_key( ).
lr_s_root->bo_key_ref = if_ehhss_inc_c=>sc_bo_key. "BO Incident key
lr_s_root->category = '001'. " Action
lr_s_root->priority = '5'. " Normal
lr_s_root->purpose = 'INC_ACTION'. " Incident Action
lr_s_root->ehsm_component = 'HSS'.
lr_s_root->variant = 'STANDARD'.
lr_s_root->status = if_ehfnd_bo_status_c=>gc_transaction-new. "'01'. " New
lr_s_root->title = 'test'.
lr_s_root->resp_id = 'USER123'.
lr_s_root->implem_id = 'USER123'.
lr_s_root->appr_id = 'USER123'.
lr_s_root->due_timestamp = '20140418'.
GET TIME STAMP FIELD lv_cur_timestmp.
lr_s_root->datetime_cr = lv_cur_timestmp.
lr_s_root->datetime_ch = lv_cur_timestmp.
APPEND INITIAL LINE TO lt_mod ASSIGNING <ls_mod>.
<ls_mod>-node = if_ehhss_iac_c=>sc_node-root. "Incident action
<ls_mod>-change_mode = /bobf/if_frw_c=>sc_modify_create.
<ls_mod>-source_node = if_ehhss_inc_c=>sc_node-root. "Incident
<ls_mod>-association = if_ehhss_inc_c=>sc_association-root-ehhss_incident_action.
<ls_mod>-source_key = ls_inc_root-db_key. "Incident
<ls_mod>-key = lr_s_root->key.
<ls_mod>-data = lr_s_root.
CALL METHOD mo_svc_mngr->modify
EXPORTING
it_modification = lt_mod
IMPORTING
eo_change = lo_change
eo_message = lo_message.
Thank you!
Marie-Josée
2014 Apr 21 7:25 AM
Hi Marie-Josee,
I tried the same thing, what you have done in the above program. But it gave me the dump.
To resolve this problem I wrote following code.
DATA: LO_ACT_SERVICE_MNGR TYPE REF TO CL_EHFND_ENA_SERVICE_MNGR,
LR_S_ROOT TYPE REF TO EHFNDS_ACT_ROOT,
LO_ROOT_NODE TYPE REF TO CL_EHFND_ENA_NODE,
ls_party_key TYPE ehfnds_party_key.
DATA: LT_INST_KEY TYPE /BOBF/T_FRW_KEY, LS_INST_KEY TYPE /BOBF/S_FRW_KEY.
CREATE DATA LR_S_ROOT.
LO_ACT_SERVICE_MNGR = CL_EHFND_ENA_SERVICE_MNGR=>INSTANCEV2( IF_EHHSS_IAC_C=>SC_BO_KEY ).
LO_ROOT_NODE = LO_ACT_SERVICE_MNGR->GET_ROOT( ).* * CREATE EMPTY ROOT NODE INSTANCE OF BO ACTION.
LR_S_ROOT ?= LO_ROOT_NODE->CREATE_EMPTY_ROW( ).
LR_S_ROOT->PURPOSE = 'INC_ACTION'.
LR_S_ROOT->STATUS = '01'.
LR_S_ROOT->TITLE = 'Test'.
LR_S_ROOT->DESC_TEXT = 'test'.
LR_S_ROOT->CATEGORY = '001'.
LR_S_ROOT->VARIANT = 'STANDARD'.
LR_S_ROOT->EQU_ID ='?1234555'.
LR_S_ROOT->FUNC_LOC_ID = 'ABC_DEF'.
LR_S_ROOT->PRIORITY = '5'.
LS_PARTY_KEY = CL_EHFND_PARTY_PROXY=>GET_PARTY_FROM_USER( SY-UNAME ).
LR_S_ROOT->RESP_ID = LS_PARTY_KEY-ID_COMBINED.
LR_S_ROOT->IMPLEM_ID = LS_PARTY_KEY-ID_COMBINED.
LR_S_ROOT->EXT_NOTIF_TYPE = 'M1'. * Set BO and Node Reference of Action to the Incident Root instance.
LR_S_ROOT->BO_KEY_REF = IF_EHHSS_INC_C=>SC_BO_KEY.
LR_S_ROOT->ROOT_KEY_REF = <inc_ROOT_KEY>.
LR_S_ROOT->KEY_REF = <investigation_key>.
LR_S_ROOT->EHSM_COMPONENT = IF_EHFND_COMN_C=>GC_EHSM_COMPONENT-HSS.
LR_S_ROOT->NODE_KEY_REF = '8FBB304923FFBB00E10000000A1555E1'.
CONVERT TIME STAMP lr_s_root->ea_st_timestamp TIME ZONE lr_s_root->ea_st_ti_zo INTO DATE lr_s_root->ea_st_date TIME lr_s_root->ea_st_time.
CONVERT TIME STAMP lr_s_root->due_timestamp TIME ZONE lr_s_root->due_ti_zo INTO DATE lr_s_root->due_date TIME lr_s_root->due_time.
LO_ROOT_NODE->INSERT( LR_S_ROOT ).
LS_INST_KEY-KEY = LR_S_ROOT->KEY.
APPEND LS_INST_KEY TO LT_INST_KEY.
LW_FLAG = 'X'.
EXPORT LW_FLAG FROM LW_FLAG TO MEMORY ID 'ABC'.********* flag is exporting to class **CL_EHFND_ACT_ROOT_A_STATUS in method /BOBF/IF_FRW_ACTION~EXECUTE
LO_ACT_SERVICE_MNGR->EXECUTE_ACTION( EXPORTING IV_ACT_KEY = IF_EHFND_ACT_C=>SC_ACTION-ROOT-SET_IN_PROCESS_ROOT IT_KEY = LT_INST_KEY ).
*********************In class CL_EHFND_ACT_ROOT_A_STATUS, in Implicit enhancement at last
IMPORT LW_FLAG to LW_FLAG from memory id 'ABC'.
If LW_FLAG is not initial.
lr_s_root->status = if_ehfnd_bo_status_c=>gc_transaction-new.
lo_root_node->update( lr_s_root ).
endif.
*******************************************************************************
In the above code, I have called standard Action SET_IN_PROCESS_ROOT. This Action you can see in EHHSS_INCIDENT_ACTION BO.
Now to set the Action Status is New, we need to Export some flag from wherever you are updating this BO. After that when you call that Action at that time check the value of that flag if it is not initial then set the status New. Kindly refer above code for same.
This trick helps me. Hope it helps you.
Thanks and regards,
Chetan P. Patil
2014 Apr 21 7:25 AM
Hi Marie-Josee,
I tried the same thing, what you have done in the above program. But it gave me the dump.
To resolve this problem I wrote following code.
DATA: LO_ACT_SERVICE_MNGR TYPE REF TO CL_EHFND_ENA_SERVICE_MNGR,
LR_S_ROOT TYPE REF TO EHFNDS_ACT_ROOT,
LO_ROOT_NODE TYPE REF TO CL_EHFND_ENA_NODE,
ls_party_key TYPE ehfnds_party_key.
DATA: LT_INST_KEY TYPE /BOBF/T_FRW_KEY, LS_INST_KEY TYPE /BOBF/S_FRW_KEY.
CREATE DATA LR_S_ROOT.
LO_ACT_SERVICE_MNGR = CL_EHFND_ENA_SERVICE_MNGR=>INSTANCEV2( IF_EHHSS_IAC_C=>SC_BO_KEY ).
LO_ROOT_NODE = LO_ACT_SERVICE_MNGR->GET_ROOT( ).* * CREATE EMPTY ROOT NODE INSTANCE OF BO ACTION.
LR_S_ROOT ?= LO_ROOT_NODE->CREATE_EMPTY_ROW( ).
LR_S_ROOT->PURPOSE = 'INC_ACTION'.
LR_S_ROOT->STATUS = '01'.
LR_S_ROOT->TITLE = 'Test'.
LR_S_ROOT->DESC_TEXT = 'test'.
LR_S_ROOT->CATEGORY = '001'.
LR_S_ROOT->VARIANT = 'STANDARD'.
LR_S_ROOT->EQU_ID ='?1234555'.
LR_S_ROOT->FUNC_LOC_ID = 'ABC_DEF'.
LR_S_ROOT->PRIORITY = '5'.
LS_PARTY_KEY = CL_EHFND_PARTY_PROXY=>GET_PARTY_FROM_USER( SY-UNAME ).
LR_S_ROOT->RESP_ID = LS_PARTY_KEY-ID_COMBINED.
LR_S_ROOT->IMPLEM_ID = LS_PARTY_KEY-ID_COMBINED.
LR_S_ROOT->EXT_NOTIF_TYPE = 'M1'. * Set BO and Node Reference of Action to the Incident Root instance.
LR_S_ROOT->BO_KEY_REF = IF_EHHSS_INC_C=>SC_BO_KEY.
LR_S_ROOT->ROOT_KEY_REF = <inc_ROOT_KEY>.
LR_S_ROOT->KEY_REF = <investigation_key>.
LR_S_ROOT->EHSM_COMPONENT = IF_EHFND_COMN_C=>GC_EHSM_COMPONENT-HSS.
LR_S_ROOT->NODE_KEY_REF = '8FBB304923FFBB00E10000000A1555E1'.
CONVERT TIME STAMP lr_s_root->ea_st_timestamp TIME ZONE lr_s_root->ea_st_ti_zo INTO DATE lr_s_root->ea_st_date TIME lr_s_root->ea_st_time.
CONVERT TIME STAMP lr_s_root->due_timestamp TIME ZONE lr_s_root->due_ti_zo INTO DATE lr_s_root->due_date TIME lr_s_root->due_time.
LO_ROOT_NODE->INSERT( LR_S_ROOT ).
LS_INST_KEY-KEY = LR_S_ROOT->KEY.
APPEND LS_INST_KEY TO LT_INST_KEY.
LW_FLAG = 'X'.
EXPORT LW_FLAG FROM LW_FLAG TO MEMORY ID 'ABC'.********* flag is exporting to class **CL_EHFND_ACT_ROOT_A_STATUS in method /BOBF/IF_FRW_ACTION~EXECUTE
LO_ACT_SERVICE_MNGR->EXECUTE_ACTION( EXPORTING IV_ACT_KEY = IF_EHFND_ACT_C=>SC_ACTION-ROOT-SET_IN_PROCESS_ROOT IT_KEY = LT_INST_KEY ).
*********************In class CL_EHFND_ACT_ROOT_A_STATUS, in Implicit enhancement at last
IMPORT LW_FLAG to LW_FLAG from memory id 'ABC'.
If LW_FLAG is not initial.
lr_s_root->status = if_ehfnd_bo_status_c=>gc_transaction-new.
lo_root_node->update( lr_s_root ).
endif.
*******************************************************************************
In the above code, I have called standard Action SET_IN_PROCESS_ROOT. This Action you can see in EHHSS_INCIDENT_ACTION BO.
Now to set the Action Status is New, we need to Export some flag from wherever you are updating this BO. After that when you call that Action at that time check the value of that flag if it is not initial then set the status New. Kindly refer above code for same.
This trick helps me. Hope it helps you.
Thanks and regards,
Chetan P. Patil
2014 Apr 21 2:36 PM
Hello Chetan,
thank you very much for your help! The action is created in the incident 🙂
Marie-Josée
2014 Apr 22 5:37 AM
2014 Dec 17 8:55 AM
Hi chetan,
LR_S_ROOT->ROOT_KEY_REF = <inc_ROOT_KEY>.
LR_S_ROOT->KEY_REF = <investigation_key>.
what are investigation_key and inc_root_key.
I tried to do the same but I got dump Error. ''The ASSERT condition was violated.''
can you please help me the same
Thanks,
Shakeel
2014 Dec 17 9:25 AM
Hi Shakeel,
<inc_root_key> is the root key of the incident
<investigation_key> is the key of the investigation of the incident.
Regards,
Sanket.
2014 Dec 17 9:53 AM
Thanks Sanket,
Actually I am facing a problem to create the incident using function module SO_CREATE_INCIDENT.
I getting a runtime error ''message_type_X''.
when I debug I got to know that there is an ROOT authorization. problem.
please can you help me on the issue
Here I am attaching my code for reference:
Report ZTEST123.
DATA:
ls_basic_info TYPE SSSO_INC_BASIC_INFO_ALL,
ls_person_involved TYPE SSSO_INCIDENT_PER_INV,
ls_person_involved2 TYPE SSSO_INC_PER_INVOLVED,
lt_person_involved TYPE STSO_INC_PER_INVOLVED,
ls_person_involved_role TYPE SSSO_PERSON_ROLE.
DATA : iv_category TYPE EHHSS_INC_CATEGORY_CODE.
iv_category = '003'.
ls_basic_info-title = 'SHAKTEST' .
ls_basic_info-desc_text = 'TEST'.
ls_basic_info-ima_desc_text = 'Shakeel test'.
ls_basic_info-start_date = sy-datlo. "'20141214'.
ls_basic_info-start_time = sy-timlo.
ls_basic_info-start_time_zone = sy-zonlo.
ls_basic_info-time_not_det_ind = 'X'.
ls_basic_info-plant_id = '3000'.
* ls_basic_info-loc_type = is_basic_info-loc_type.
* ls_basic_info-loc_desc_text = is_basic_info-loc_desc_text.
* ls_basic_info-latit_meas = is_basic_info-latit_meas.
* ls_basic_info-long_meas = is_basic_info-long_meas.
* ls_basic_info-altit_meas = is_basic_info-altit_meas.
* ls_basic_info-altit_unit = is_basic_info-altit_unit.
"assign roles to corresponding person
* LOOP AT it_person_involved INTO ls_person_involved.
* MOVE-CORRESPONDING ls_person_involved TO ls_person_involved2.
* LOOP AT it_person_involved_role INTO ls_person_involved_role.
* IF ls_person_involved_role-id = ls_person_involved2-id.
* APPEND ls_person_involved_role-role TO ls_person_involved2-role.
* ENDIF.
* ENDLOOP.
* APPEND ls_person_involved2 TO lt_person_involved.
* CLEAR ls_person_involved.
* CLEAR ls_person_involved2.
* ENDLOOP.
*
*
data : it_inc_group type STSO_INC_GROUP_CODE,
it_nm_group type STSO_NM_GROUP_CODE,
it_so_group type STSO_GROUP_CODE,
lt_return TYPE BAPIRETTAB,
is_circumstances TYPE SSSO_INC_CIRCUMSTANCES,
is_attachment TYPE /BOBF/S_ATF_A_CREATE_FILE.
is_attachment-NAME = 'C:\Users\test.v\Desktop\images.jpg'.
*is_attachment-ALTERNATIVE_NAME = ' C:\Users\durai.v\Desktop'.
is_attachment-DESCRIPTION_LANGUAGE_CODE = 'E'.
*is_attachment-DESCRIPTION_CONTENT = 'FMTEST'.
is_attachment-MIME_CODE = '/SAP/PUBLIC/EHMS/Product_and_REACH_Compliance/PRC_LOGO'.
is_attachment-FILE_NAME = 'FMTEST'.
is_attachment-ATTACHMENT_TYPE = '1002'.
CALL FUNCTION 'SO_INCIDENT_CREATE'
EXPORTING
iv_category = iv_category
it_person_involved = lt_person_involved
is_basic_info = ls_basic_info
it_inc_group = it_inc_group
it_nm_group = it_nm_group
it_so_group = it_so_group
is_circumstances = is_circumstances
is_attachment = is_attachment
IMPORTING
et_return = lt_return.
BREAK-POINT.
Thanks,
Shakeel
2015 Dec 12 7:06 AM
Hi experts,
I want to enhance the EHHSS_INCIDENT_ACTION ,Here i want to check the status of action changed to '02' to '03' . while iit changed status from '02' to '03' i want to trigger a set of code .
Please help me, I m new in BOBF.
Regards,
Surya N Padhy