SLA (service level agreement)#
How to get object attributes and relations?#
Go into debugging mode with an external breakpoint and use the tool "Data Explorer". This tool is dereferenzing also data references. To get to the real object data drill down to CONTAINER_PROXY > DATA_REF. There you can find general fields about the object and two important containers:
ATTRIBUTE_REF | attribute list |
RELATIONS | related objects |
Structure of an order#
An order has one header and one or more items.t.CRMD_ORDERADM_H | Header |
t.CRMD_ORDERADM_I | Item |
In the EIC there is generally only one item under the header, which is the ticket itself.
How to get an ORDER object?#
The functions CRM_ORDER_* (CRM_ORDER_READ, CRM_ORDER_MAINTAIN, etc.) are using an internal buffer. If the used GUID (generally a header guid) is in the buffer, the buffer is used. Otherwise it is filled from the database first.How to get header/item-guids and transaction type through the object relations?#
1. via function:DATA: lr_bol_entity TYPE REF TO cl_crm_bol_entity, lr_order_header TYPE REF TO cl_crm_bol_entity, lr_order_item TYPE REF TO cl_crm_bol_entity, iv_header_guid TYPE crmt_object_guid, iv_item_guid TYPE crmt_object_guid. "note: bol_entity is the order object lr_order_header = bol_entity->get_related_entity( 'BTOrderHeader' ). lr_order_header->get_property_as_value( EXPORTING iv_attr_name = 'PROCESS_TYPE' IMPORTING ev_result = lv_proc_type ). lr_bol_entity = lr_order_header->get_related_entity( 'BTHeaderItemsExt' ). lr_order_item = lr_bol_entity->get_related_entity( 'BTOrderItemAll' ). lr_order_item->get_property_as_value( EXPORTING iv_attr_name = 'GUID' IMPORTING ev_result = iv_item_guid ).2. via object relation/attributes (compare above)
DATA: lr_bol_entity_collection TYPE REF TO if_bol_entity_col, lr_iterator TYPE REF TO if_bol_entity_col_iterator, lr_due_date TYPE REF TO cl_crm_bol_entity. lr_bol_entity_collection ?= lr_bol_entity->get_related_entities( iv_relation_name = 'BTDatesAll' ). lr_iterator = lr_bol_entity_collection->get_iterator( ). lr_due_date ?= lr_iterator->find_by_property( iv_attr_name = 'APPT_TYPE' iv_value = lv_appt_type ). IF lr_due_date IS BOUND. lr_due_date->get_property_as_value( EXPORTING iv_attr_name = 'TIMESTAMP_TO' IMPORTING ev_result = lv_due_date ). ENDIF.
How to get any (see importing parameters) details from the order?#
DATA: lt_header_guid TYPE crmt_object_guid_tab, lt_orderadm_i TYPE crmt_orderadm_i_wrkt. APPEND iv_header_guid TO lt_header_guid. CALL FUNCTION 'CRM_ORDER_READ' EXPORTING it_header_guid = lt_header_guid IMPORTING et_orderadm_i = lt_orderadm_i ... EXCEPTIONS ...
Work Schedule Rules (Bereitschaftsschema)#
t.CRMD_SERWI | Service-Bereitschaftsschema |
t.CRMD_SERWI_T | Bereitschaftszeiten Texte |
x.CRMD_SERV_SLA | Bereitschaftsschema Übersicht |
t.CRMD_ESCAL | Service-Reaktionszeitschema |
t.CRMD_ESCAL_T | Service-Reaktionszeitschema Texte |
t.SCRULES | Regel periodischer Termine |
fb.APPT_RULE_READ | Ließt eine Regel von der Datenbank |
fp.SAPLSSC_RULES | Function Pool |
Compare include LSSC_RULESF01 > Form check_empty_rule
DATA: service_rule_id TYPE crmd_serwi-srv_rule_id, lit_rule TYPE rule_tab, lwa_rule LIKE LINE OF lit_rule, ls_times TYPE scrule_w, lv_srv_time_to TYPE t, " real service time (aus Bereitschaftsschema) lv_srv_timestamp_to TYPE crmt_timestamp, lv_tmp_date TYPE d, lv_tmp_time TYPE t. FIELD-SYMBOLS: <fs_times> TYPE any. [...] " convert time stamp into date and time. CONVERT TIME STAMP lv_timestamp_cre TIME ZONE sy-zonlo INTO DATE lv_tmp_date TIME lv_tmp_time. " get real service end time from attendance quota (work schedule rule) SELECT SINGLE srv_rule_id FROM crmd_serwi INTO service_rule_id WHERE srv_serwi = ls_escal_item-serwi. IF sy-subrc = 0. CALL FUNCTION 'APPT_RULE_READ' EXPORTING rule_id = service_rule_id IMPORTING rule = lit_rule EXCEPTIONS no_rule = 1 OTHERS = 2. READ TABLE lit_rule INDEX 1 INTO lwa_rule. ASSIGN lwa_rule-rule TO <fs_times> CASTING TYPE scrule_w. ls_times = <fs_times>. " create service end timestamp with original time zone " get end time for Monday as default for whole week CONVERT DATE lv_tmp_date TIME ls_times-monday_to INTO TIME STAMP lv_srv_timestamp_to TIME ZONE ls_appointment-timezone_from. " convert that timestamp into ticket creation time zone CONVERT TIME STAMP lv_srv_timestamp_to TIME ZONE sy-zonlo INTO DATE lv_tmp_date TIME lv_srv_time_to. " is creation time after working hours ? then add a day at the start SLA calculation IF lv_tmp_time > lv_srv_time_to. CALL FUNCTION 'TIMECALC_MOVE' EXPORTING timestamp = lv_timestamp_cre duration = 86400 " plus one day in seconds timezone = sy-zonlo IMPORTING result = lv_timestamp_cre. ENDIF. [...]