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

Checking for Attachments with GOS?

former_member393151
Participant
0 Likes
1,676

I have sucessfully used GOS to create my own object type, and have used the functionality to add attachments. Is there anyway of checking to see if a particular object has any attachments (i.e. - returning a flag that tells you if the object has documents attached or not?)

Thanks for any suggestions.

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
940

1. Check for relation ship table SRGBTBREL

or

2. pl. check the following code for counting number of attachment in a object


 i_object1-typeid = 'YBUS2012'.
  i_object1-catid  = 'BO'.
  i_object1-instid = i_ybus2012-docno.
  call method cl_gos_attachment_query=>count_for_object
    exporting
     is_object = i_object1
     ip_arl    = space
    receiving
     rt_stat   = i_stat1.
  read table i_stat1 into wa_stat1 index 1.
  if sy-subrc eq c_0.
     move wa_stat1-counter to v_attno1.
  endif.

Here v_attno1 contains the no of attachment found in the object id

a®

1 REPLY 1
Read only

former_member194669
Active Contributor
0 Likes
941

1. Check for relation ship table SRGBTBREL

or

2. pl. check the following code for counting number of attachment in a object


 i_object1-typeid = 'YBUS2012'.
  i_object1-catid  = 'BO'.
  i_object1-instid = i_ybus2012-docno.
  call method cl_gos_attachment_query=>count_for_object
    exporting
     is_object = i_object1
     ip_arl    = space
    receiving
     rt_stat   = i_stat1.
  read table i_stat1 into wa_stat1 index 1.
  if sy-subrc eq c_0.
     move wa_stat1-counter to v_attno1.
  endif.

Here v_attno1 contains the no of attachment found in the object id

a®