SAP CRM Service Request subject storage design

For example I have a service request with the following two level’s category maintained:

I use the following code to print out its subject value:

PARAMETERS: id TYPE crmt_object_id OBLIGATORY DEFAULT '8000000010'.

DATA: lv_guid  TYPE crmt_object_guid,
      ls_osset TYPE crmt_srv_osset_wrk.

SELECT SINGLE header_guid INTO lv_guid FROM crms4d_serv_h WHERE object_id = id.

IF sy-subrc <> 0.
  WRITE:/ 'No service request found for id:', id.
  RETURN.
ENDIF.

CALL FUNCTION 'CRM_SERVICE_OS_READ_OB'
  EXPORTING
    iv_ref_guid      = lv_guid
    iv_ref_kind      = 'A'
  IMPORTING
    es_srv_osset_wrk = ls_osset.

LOOP AT ls_osset-osset ASSIGNING FIELD-SYMBOL(<osset>).
  LOOP AT <osset>-subject ASSIGNING FIELD-SYMBOL(<subject>).
    WRITE:/ |sort: { <subject>-sort }, ASP id: { <subject>-asp_id }, CAT id: { <subject>-cat_id }| COLOR COL_NEGATIVE.
  ENDLOOP.
ENDLOOP.

Result:

Why CA_4?
Only leaf value for category is stored for SERVICE_OS, which makes sense since all its parent in the hierarchy tree could anyway be derived.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

展开阅读全文
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值