删除SAP CRM one order和pricing的链接关系

REPORT zremove_price_data.

PARAMETERS: id TYPE crmd_orderadm_h-object_id OBLIGATORY.

START-OF-SELECTION.
  DATA: lt_guid TYPE STANDARD TABLE OF crmd_orderadm_h-guid,
        lv_guid LIKE LINE OF lt_guid,
        lt_link TYPE STANDARD TABLE OF crmd_link.

  SELECT guid INTO TABLE lt_guid FROM crmd_orderadm_h WHERE object_id = id.

  IF sy-subrc <> 0.
    WRITE: / 'the id you have specified is not valid' , id.
    RETURN.
  ENDIF.

  SELECT * INTO TABLE lt_link FROM crmd_link FOR ALL ENTRIES IN lt_guid
     WHERE objtype_hi = '05' AND objtype_set = '18' AND guid_hi = lt_guid-table_line.

  IF sy-subrc <> 0.
     WRITE: / 'no pricing document link for this order.'.
     RETURN.
  ENDIF.

  LOOP AT lt_guid INTO lv_guid.
    DELETE FROM crmd_link WHERE objtype_hi = '05' AND objtype_set = '18'
     AND guid_hi = lv_guid.
    IF sy-subrc = 0.
      WRITE: / 'pricing link for document:' , lv_guid,  ' deleted successfully.'.
    ELSE.
      WRITE: / 'pricing link for document:' , lv_guid,  ' deleted failed.'.
    ENDIF.
  ENDLOOP.

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

汪子熙 CSDN认证博客专家 前端框架 Node.js SAP
JerryWang,2007年从电子科技大学计算机专业硕士毕业后加入SAP成都研究院工作至今。Jerry是SAP社区导师,SAP中国技术大使。2020年5月下旬,Jerry做了脑部肿瘤的开颅切除手术,对编程和人生又有了新的感悟。
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 博客之星2020 设计师:CY__ 返回首页