‎2016 Jan 26 7:56 AM
I have successfully created attachments to a po/pr using these fm's
OPEN DATASET
SO_FOLDER_ROOT_ID_GET
SO_OBJECT_INSERT
BINARY_RELATION_CREATE_COMMIT.
I can see the attachments with particular invoice number i have passed in these fm's problems is now i want to delete these attachments i have used
BINARY_RELATION_DELETE_COMMIT passing same paramters .
DATA: lp_key TYPE swo_typeid,
ls_object TYPE borident,
ls_note TYPE borident.
DATA: ls_fol_id TYPE soodk,
ls_obj_id TYPE soodk,
ls_obj_data TYPE sood1,
ls_folmem_k TYPE sofmk,
lv_ep_note TYPE borident-objkey,
lv_offset TYPE i.
ls_note-objkey = '7100000160'.
ls_object-objtype = 'BUS2012'.
ls_folmem_k-foltp = 'FOL'.
ls_folmem_k-folyr = '33'.
ls_folmem_k-folno = '000000000004'.
ls_folmem_k-doctp = 'EXT'.
ls_folmem_k-docyr = '41'.
ls_folmem_k-docno = '000000000063'.
lv_ep_note = ls_folmem_k.
ls_note-objtype = 'MESSAGE'.
ls_note-objkey = lv_ep_note.
ls_note-objkey = lp_key.
ls_note-objtype = 'MESSAGE'.
CALL FUNCTION 'BINARY_RELATION_DELETE_COMMIT' "
EXPORTING
obj_rolea = ls_object " borident
obj_roleb = ls_note
relationtype = 'ATTA' " breltyp-reltype
EXCEPTIONS
entry_not_existing = 1 "
internal_error = 2 "
no_relation = 3 "
no_role = 4 ".
It doesnt give any error program run successfully but still i can see the attachments in me22 transaction and also is srgtbel table. need help guys whats wrong why attachments are still available ?
‎2016 Jan 26 8:27 AM
‎2016 Jan 26 8:27 AM
‎2016 Jan 26 9:38 AM
Sure i will try this can. SO_ATTACHMENT_DELETE takes
object_id =
attach_id =
as input can you guide me for some sample values ? for both of this i am looking in tables but dont know which values to pass and is this fm enough to delete attachment or we need to use it with some other fms too.
‎2016 Jan 26 11:47 AM
‎2016 Jan 26 1:46 PM
Hello
Please document the complete solution here so that someone else can take help from it.
Thanks
Nabheet
‎2016 Jan 27 9:50 AM
for linking and uploading attachments you can refer to this blog . http://friendlyabaper.blogspot.com/2008/07/oh-my-gos.html.
Secondly if you want to remove link to attachments for that i have use fm
CALL FUNCTION 'BINARY_RELATION_DELETE_COMMIT' "
EXPORTING
obj_rolea = ls_object " borident
obj_roleb = ls_note
relationtype = 'ATTA' " breltyp-reltype
EXCEPTIONS
entry_not_existing = 1 "
internal_error = 2 "
no_relation = 3 "
no_role = 4 "
feel free to contact me if someone needs help
‎2016 Jan 27 10:42 PM
This would delete the relationship (i.e. "the link to attachment", as you've mentioned), not the attachment itself. If the goal is to delete the attachment as well (so that it doesn't take up space, for example), then most likely SO_ATTACHMENT_DELETE would help. For OBJECT_ID I'd guess you'd have to read the attachments first.
Anyways, if this has been resolved, kindly close the discussion.
Thank you.
‎2016 Jan 28 5:33 AM
yes exactly if you have attached the document to a purchase order it will delete links in srgtbel table but you will still be able to see the attachments in sood table .
‎2016 Jan 28 1:33 PM
i have used 2 fms to delete attachments
SO_ATTACHMENT_DELETE . it does nothing .
and
BINARY_RELATION_DELETE_COMMIT'. it delete attachments but i can still find data in internal tables i.e sood and srgtbel how i can remove entreies from these tables ?