删除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的原创文章,请关注公众号"汪子熙":

发布了6437 篇原创文章 · 获赞 623 · 访问量 103万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览