Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

delete GOS attachments ?

joan_ayala
Participant
0 Likes
1,279

Hi friends,

I will write my question in 2 posts due to the length limitation.

In my program i create different attachments like this:


  CONCATENATE 'UPC' ordendpago INTO is_object-objkey
                    SEPARATED BY space.
* Indicamos el tipo de objeto URL
  is_object-objtype  = 'FMPSO'.
  rel_doc-objkey  = document_id.
  rel_doc-objtype = 'MESSAGE'.
* Creamos la relación entre la op y el objeto enlazado
  CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'
       EXPORTING
            obj_rolea      = is_object
            obj_roleb      = rel_doc
            relationtype   = 'URL'
       EXCEPTIONS
            no_model       = 1
            internal_error = 2
            unknown        = 3
            OTHERS         = 4.

Hi friends,

I will write my question in 2 posts due to the length limitation.

In my program i create different attachments like this:


  CONCATENATE 'UPC' ordendpago INTO is_object-objkey
                    SEPARATED BY space.
* Indicamos el tipo de objeto URL
  is_object-objtype  = 'FMPSO'.
  rel_doc-objkey  = document_id.
  rel_doc-objtype = 'MESSAGE'.
* Creamos la relación entre la op y el objeto enlazado
  CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'
       EXPORTING
            obj_rolea      = is_object
            obj_roleb      = rel_doc
            relationtype   = 'URL'
       EXCEPTIONS
            no_model       = 1
            internal_error = 2
            unknown        = 3
            OTHERS         = 4.

1 REPLY 1
Read only

joan_ayala
Participant
0 Likes
573

At some point later, i want to delete some of these attachments created, and i do it like this:


  DATA: lo_list   TYPE REF TO CL_GOS_ATTACHMENT_LIST,
        lt_output TYPE TRL_BRLNK,
        ls_output TYPE SRL_BRLNK,
        lo_bor_item TYPE REF TO CL_SREL_BOR_ITEM,
        lo_bor_browser TYPE REF TO CL_SREL_BROWSER_ITEM,
        ls_bor_obj  TYPE borident,
        ls_folderid TYPE soodk,
        ls_objectid TYPE soodk.

        CONCATENATE 'UPC' i_ops-lotkz INTO lv_objkey SEPARATED BY space.
        ls_object-objkey = lv_objkey.
        ls_object-objtype = 'FMPSO'.

        create object lo_list
          exporting
            is_object        = ls_object
            .
        IF sy-subrc <> 0.
        ENDIF.

        lt_output = lo_list->GO_LIST_VIEWER->gt_output.
*       in lt_output i have all the attachments for this document
        LOOP AT lt_output INTO ls_output.

          lo_bor_browser = ls_output-objref.
          lo_bor_item ?= lo_bor_browser.
          ls_bor_obj  = lo_bor_item->gs_bor_object.
          ls_folderid = ls_bor_obj-objkey(17).
          ls_objectid = ls_bor_obj-objkey+17(17).

          CALL FUNCTION 'SO_OBJECT_DELETE'
           EXPORTING
             folder_id                        = ls_folderid
*            FORWARDER                        = ' '
*            F_UNREAD_DELETE                  = ' '
             object_id                        = ls_objectid
*            OWNER                            = ' '
*            PUT_IN_WASTEBASKET               = 'X'
                    .

I do delete them, but my problem is that for every attachment deleted, a popup window with the attachment list is opened. Does anyone know how could I avoid that ?

Thanks