Application Development 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: 

Attachments with GOS ???

joan_ayala
Participant
0 Kudos

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.

4 REPLIES 4

joan_ayala
Participant
0 Kudos

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

Former Member
0 Kudos

Hello Joan ,

have a look at this

Prepare list for Deletion.


*Handle TEMP Doc Links.
  try.
      clear: role,relation ,rol,rel.
      rol-sign   = 'I'.
      rol-option = 'EQ'.
      rol-low    = 'GOSAPPLOBJ'.
      append rol to role.
      rel-sign   = 'I'.
      rel-option = 'EQ'.
      rel-low    = 'ATTA'.
      append rel to relation.
      object-instid = 'PRABHU'----->i want to delete attachement named PRABHU
      object-typeid = 'YFIE_00016'.--->object name
      object-catid  = 'BO'.
      call method cl_binary_relation=>read_links
        exporting
          is_object           = object
          it_role_options     = role
          it_relation_options = relation
          ip_no_buffer        = 'X'
        importing
          et_links            = et_links.
    catch cx_obl_parameter_error .
    catch cx_obl_internal_error .
    catch cx_obl_model_error .
  endtry.

*Deletion part.


    loop at et_links into links.
      object-instid = links-instid_a.
      object-typeid = links-typeid_a.
      object-catid  = links-catid_a.
      object_b-instid = links-instid_b.
      object_b-typeid = links-typeid_b.
      object_b-catid  = links-catid_b.
      try.
          call method cl_binary_relation=>delete_link
            exporting
              is_object_a = object
              is_object_b = object_b
              ip_reltype  = links-reltype.
        catch cx_obl_parameter_error .
        catch cx_obl_internal_error .
        catch cx_obl_model_error .
      endtry.
    endloop.

hope u got some idea how to delete themmm... let me know if u need more info on this.

regards

Prabhu

former_member183990
Active Contributor
0 Kudos

hey you can delete attachments in this way also

SRGBTBREL has the details

pass the busineess object as well as key instid_a field i guess to delete the objects under that

and SOOD table has the attachment details also

hope it will help

with regards

s.janagar

joan_ayala
Participant
0 Kudos

sorry for the delay.

I'm not sure if you understood me, what i want is making the popup

windows not appearing...

thanks