‎2009 May 28 1:34 PM
Hello everyone,
I'm using functions SWU_OBJECT_PUBLISH and SWU_OBJECT_REFRESH, using an object key concatenation of ZDOCUMENT-ID + ZDOCUMENT-YEAR + ZDOCUMENT+BUKRS.
This means that i allready created in my Z table that document, and those functions are uses to toggle between showing in the upper left corner the standard button for options in attaching documents to my rows of the ZDOCUMENT table.
Everything works fine, but i also wanted to verify in runtime, internally, if some object allready has attachments. Is there another function to do this ?
Thank you all,
Santi
‎2009 May 28 1:41 PM
Hi ,
try this way to get the attachment avaialble for the object..
SELECT * FROM sww_contob
WHERE objtype = 'ZBUS2032' "your business object
AND objkey = wa_vbak-vbeln. "and the object key..
SELECT * FROM swwwihead WHERE wi_id EQ sww_contob-wi_id.
if swwwihead- NOTE_COUNT ge 0.
"it contains attachments for theObject ..
endif.
Regards,
Prabhduas
‎2009 May 28 4:52 PM
Thank you for your reply, Prabhu. I tryed selecting values from table sww_contob only with objtype = 'ZPAGS', my type of object, but the result is 0. I think it's not here where my attachments and/or notes are kept.
‎2009 May 28 5:20 PM
You need to try this way
clear v_attno1.
i_object1-typeid = 'YTEST'. " Your Object ID name
i_object1-catid = 'BO'.
i_object1-instid = i_yitem-docnumber. " Your document number
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.
endif.
if v_attno1 ge 1.
" You have attachments in against the document number
endif.
a®