溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

使用代碼刪除SAP CRM的附件(attachment)數據

發布時間:2020-08-10 09:47:47 來源:ITPUB博客 閱讀:178 作者:i042416 欄目:互聯網科技

In the beginning I consider it is very easy to delete attachments via code, just like below. I have defined one method with following two importing parameters and one returning parameter:

(1) iv_bor_type type string – the BOR type of your business object (2) iv_uuid type raw16 – the guid of your business object instance (3) rv_successful type abap_bool – indicates whether the deletion is successful

DATA:     ls_bo          TYPE SIBFLPORB,
          lt_loios    TYPE SKWF_IOS,
          ls_loios    TYPE SKWF_IO,
          ls_error    TYPE SKWF_ERROR,
          lt_badios   TYPE SKWF_IOERRS,
          lv_del_flag TYPE ABAP_BOOL.
    ls_bo-instid = iv_uuid.
    ls_bo-typeid = iv_bor_type.
    ls_bo-catid  = 'BO'.
    rv_successful = abap_false.
    CALL METHOD cl_crm_documents=>get_info
      EXPORTING
        business_object = ls_bo
      IMPORTING
        loios           = lt_loios.
    LOOP AT lt_loios INTO ls_loios.
      CALL METHOD cl_crm_documents=>lock
        EXPORTING
          is_bo    = ls_bo
          is_loio  = ls_loios
        IMPORTING
          es_error = ls_error.
      IF ls_error IS NOT INITIAL.
         RETURN.
      ENDIF.
    ENDLOOP.
    CALL METHOD cl_crm_documents=>delete
      EXPORTING
         business_object = ls_bo
         ios             = lt_loios
      IMPORTING
         bad_ios         = lt_badios
         error           = ls_error.
    IF ls_error IS INITIAL. " deletion failed       rv_successful = abap_true.
    ENDIF.

Through testing I found it works perfectly well with most of BOR type like product, IBASE, BP, and one order.

However, it does not work for my new BOR type CRMSOCPOST in CRM7.0 EHP3 – the relationship between my BO and the attachments is not really deleted until an explicit call COMMIT WORK is written in the report. However, for any other standard CRM BOR type, the COMMIT WORK is not needed. Why? After some debugging finally I find answer. Have you already observed the comments below? It is written quite clearly: if the business object exists in the database, the COMMIT WORK is not needed.


使用代碼刪除SAP CRM的附件(attachment)數據


Back to my case, since CRMSOCPOST is a new BOR type created in CRM7.0 EHP3, the function module does not recognize it, so the code reached line 225, and then the BO instance is regarded as non-exist in DB. So an explicit COMMIT WORK is always necessary to make deletion work.


使用代碼刪除SAP CRM的附件(attachment)數據


要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":

使用代碼刪除SAP CRM的附件(attachment)數據

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女