title: How to display list of attachments from Generic Object Services
body: <p>I have a report that should display an attachment list from an object. </p>
  
  <p>For instance, in transaction <code>FI02</code> (maintenance of banks), the GOS toolbar has the menu Attachment List:</p>
  
  <p><a href="https://i.stack.imgur.com/4M0ss.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4M0ss.png" alt="GOS toolbar as context menu"></a></p>
  
  <p><a href="https://i.stack.imgur.com/F15f0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F15f0.png" alt="GOS attachment list popup"></a></p>
  
  <p>I want to display this list. What is the best way to display it?</p>
  
  <pre><code>REPORT zay_gos_demo.
  
  DATA ls_appl_object     TYPE gos_s_obj.
  DATA lo_gos_api         TYPE REF TO cl_gos_api.
  DATA lt_attachment_list TYPE gos_t_atta.
  DATA lt_role_filter     TYPE gos_t_rol.
  
  DATA ls_attachment   TYPE gos_s_atta.
  DATA ls_attachm_cont TYPE gos_s_attcont.
  DATA ls_atta_key     TYPE gos_s_attkey.
  
  ls_appl_object-typeid = 'KNA1'.
  ls_appl_object-instid = '0000000001'.
  ls_appl_object-catid  = 'BO'. "BO - BOR Object
  "CL - Persistent Class
  
  START-OF-SELECTION.
  
  * create instance of GOS API providing unique application object
    TRY.
    lo_gos_api = cl_gos_api=&gt;create_instance( ls_appl_object ).
  *   get attachment list for this object (if needed restrict selection
  *   by adding certain roles to filter table; initial table means: get
  *   attachments in all roles)
    APPEND cl_gos_api=&gt;c_attachment TO lt_role_filter.
    APPEND cl_gos_api=&gt;c_annotation TO lt_role_filter.
    APPEND cl_gos_api=&gt;c_website TO lt_role_filter.
    lt_attachment_list = lo_gos_api-&gt;get_atta_list( lt_role_filter ).
  CATCH cx_gos_api.
  *   error handling
    ENDTRY.
  </code></pre>
  
  <p>I found other example and I want to test it:</p>
  
  <pre><code>REPORT zay_attachment_list_display.
  
  DATA: go_attachments  TYPE REF TO cl_gos_attachments,
    g_att_container TYPE REF TO cl_gui_custom_container,
    ls_object       TYPE borident,
    lo_bitem        TYPE REF TO cl_sobl_bor_item.
  
  
  ls_object-objtype = 'KNA1'.
  
  ls_object-objkey = '0000000001'.
  
  
  IF NOT go_attachments IS INITIAL.
  
    CLEAR go_attachments.
  
  ENDIF.
  
  CREATE OBJECT g_att_container
    EXPORTING
     container_name              = 'ATTS'
    EXCEPTIONS
     cntl_error                  = 1
     cntl_system_error           = 2
     create_error                = 3
     lifetime_error              = 4
     lifetime_dynpro_dynpro_link = 5.
  
  IF sy-subrc NE 0.
  
  *    ADD your handling
  
  ENDIF.
  
  CREATE OBJECT lo_bitem
   EXPORTING
    is_bor = ls_object.
  
  IF go_attachments IS INITIAL.
  
  CREATE OBJECT go_attachments
    EXPORTING
      io_object      = lo_bitem
      ip_check_arl   = 'X'
      ip_check_bds   = 'X'
      io_container   = g_att_container
  *       is_layout      = ls_layout
  *       ip_mode        = wf_mode
      ip_notes       = 'X'
      ip_attachments = 'X'
      ip_urls        = 'X'.
  
  ELSE.
  
    go_attachments-&gt;set_container( g_att_container ).
  
  ENDIF.
  
    go_attachments-&gt;display( ).
  </code></pre>
  
  <p>I created a custom control in dynpro <code>0100</code> and I named it <code>ATTS</code>. I still can't get the attachment list of GOS. Did I miss something?</p>