How to get information of all attachments belonging to a given appointment

110 阅读1分钟

This requirement is raised from customer, they would like to get information of all attachments belonging to a given appointment by ABAP code.

clipboard1

输入appointment description:

clipboard2
clipboard3

The source code of ABAP code is attached here:
source code:

*&---------------------------------------------------------------------*

*& Report ZAPPOINTMENT_DIS_ATTACHMENT

*&---------------------------------------------------------------------*

*&

*&---------------------------------------------------------------------*

REPORT zappointment_dis_attachment.


PARAMETERS: desc TYPE crmd_orderadm_h-description OBLIGATORY DEFAULT 'Jerry 2015-07-20 13:17PM'.


START-OF-SELECTION.

  DATA: ls_header TYPE crmd_orderadm_h,

        lt_link   TYPE STANDARD TABLE OF skwg_brel,

        lt_result TYPE string_table,

        lv_guid   TYPE crmorderloiot-loio_id,

        lv_text   TYPE crmorderloiot-descript.


  SELECT SINGLE * INTO ls_header FROM crmd_orderadm_h WHERE description = desc.

  IF sy-subrc <> 0.

    WRITE: / 'appointment: ' , desc, ' not found'.

    RETURN.

  ENDIF.


  SELECT * INTO TABLE lt_link FROM skwg_brel WHERE instid_a = ls_header-guid.

  LOOP AT lt_link ASSIGNING FIELD-SYMBOL(<link>).

    SPLIT <link>-instid_b AT skwfc_key_separator INTO TABLE lt_result.

    CHECK lines( lt_result ) = 3.

    READ TABLE lt_result INTO lv_guid INDEX 3.

    SELECT SINGLE descript INTO lv_text FROM crmorderloiot WHERE langu = sy-langu AND loio_id = lv_guid.

    CHECK sy-subrc = 0.

    CONDENSE lv_text.

    WRITE: / 'lv_text', lv_text(20), ' created on: ', <link>-utctime.

  ENDLOOP.

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