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: 

Retreive GOS Attachment to

Former Member
0 Kudos
1,215

Hi Experts,

I am using the following code to retrieve GOS Attachment.

lo_is_object_a-instid = '0000000015'.

lo_is_object_a-typeid = 'ZBO_DOC'.

lo_is_object_a-catid = 'BO'.

wa_rel-sign = 'I'.

wa_rel-option = 'EQ'.

wa_rel-low = 'ATTA'.

APPEND wa_rel TO lt_rel.

*TRY.

CALL METHOD cl_binary_relation=>read_links

   EXPORTING

     is_object = lo_is_object_a

*   IP_LOGSYS =

*   IT_ROLE_OPTIONS =

     it_relation_options = lt_rel

     ip_no_buffer = space

   IMPORTING

     et_links = lt_links.

But the table it_links is always having 0 entries.

Also the table SRGBTBREL is not getting updated. I think that's why lt_links is not getting filled.

Kindly help me resolve it.

Regards,

Reng.

   .

8 REPLIES 8

Former Member
0 Kudos
176

There are multiple methods for creating a GOS object.  Which one did you use?

Neal

martin_roldan
Participant
0 Kudos
176

Try using this FM

BDS_GOS_CONNECTIONS_GET

Martin

0 Kudos
176

Thanks Martin,

The method that I mentioned and the FM BDS_GOS_CONNECTIONS_GET works fine, but it is not working for all the documents I attach. What I came to know from R&D is that it works fine only for those documents which gets updated in the table SRGBTBREL. Not every document gets updated in this table. If I pass an object key which is not there in this table (SRGBTBREL-TYPEID_A) both the method and the FM fails.

Reng

Former Member
0 Kudos
176

Hi,

Refer below link. It may be helpful for you.

http://it.toolbox.com/wiki/index.php/GOS_Finding_Attachments_or_Links_to_an_Object_in_SAP/ABAP

Thanks,

Jayshree.

former_member196490
Active Participant
0 Kudos
176

try the FM GOS_ATTACHMENT_LIST_POPUP' as below

   refresh lt_objects.
        clear lf_object2.
        lf_object2-instid =
'0000000015'.
        lf_object2-typeid  =
'ZBO_DOC'.
        lf_object2-catid  = 'BO'.



        call function 'GOS_ATTACHMENT_LIST_POPUP'
          exporting
            is_object      = lf_object2
            ip_check_arl   = co_x
            ip_check_bds   = co_x
            ip_notes       = co_x
            ip_attachments = co_x
            ip_urls        = co_x
            ip_mode        = 'D'
          tables
            it_objects     = lt_objects.

0 Kudos
176

Neha,

This FM pop ups the list of all attachments corresponding to the document. But my requirement is to get the attachment either in binary or xstring format so that I can use it in the FM SAP_WAPI_ATTACHMENT_ADD to add this attachment to my workitem.

0 Kudos
176

Not sure if it will help, but try using the FM 'SO_DOCUMENT_READ_API1' . the table content_hex should give the binary format

0 Kudos
176

Hello Neha,

The FM SO_DOCUMENT_READ_API1 works fine. In this FM, I need to pass the DOCUMENT_ID.

I'll get this detail from the method cl_binary_relation=>read_links (ET_LINKS-INSTID_B).

But this links table ET_LINKS is not getting filled for all object key (is_object-instid = '000000015',  is_object-typeid = 'ZBO_DOC', is_object_a-catid = 'BO'). sy-subrc is  always 0 but the table ET_LINKS is empty.

Is there anything to do with the table SRGBTBREL, because the table ET_LINKS is non-empty, only if the object key is there in the field INSTID_A of this table.

Once if this links table is filled, I can continue with the FM you mentioned.

Thanks,

Reng