Get Attachments from GOS


DATA: lv_infnr            TYPE eine-infnr,
      ls_object           TYPE sibflporb,
      lt_links            TYPE obl_t_link,
      lt_relation_options TYPE obl_t_relt,


field-symbols: <fs_relation_options> TYPE obl_s_relt.


lv_infnr = '0000032031'.

ls_object-instid  = lv_infnr.
ls_object-typeid  = 'BUS3003'. " -> Purchase Info Record
ls_object-catid   = 'BO'.

" We want the attachements ( ATTA ); for notes use 'NOTE'
APPEND INITIAL LINE TO lt_relation_options ASSIGNING <fs_relation_options>.
<fs_relation_options>-sign    = 'I'.
<fs_relation_options>-option  = 'EQ'.
<fs_relation_options>-low     = 'ATTA'.


TRY.
    CALL METHOD cl_binary_relation=>read_links
      EXPORTING
        is_object           = ls_object
        it_relation_options = lt_relation_options
      IMPORTING
        et_links            = lt_links.
  CATCH cx_obl_parameter_error .
  CATCH cx_obl_internal_error .
  CATCH cx_obl_model_error .
ENDTRY.

No comments:

Post a Comment