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

BINARY_RELATION_DELETE_COMMIT doesnt delete attachements

Former Member
0 Likes
2,404

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 ?

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,835

Look at FM HRHAP_DOC_ATTACHMENT_DELETE for sample.

(SO_ATTACHMENT_DELETE + BINARY_RELATION_DELETE_COMMIT)

Regards,

Raymond

8 REPLIES 8
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,836

Look at FM HRHAP_DOC_ATTACHMENT_DELETE for sample.

(SO_ATTACHMENT_DELETE + BINARY_RELATION_DELETE_COMMIT)

Regards,

Raymond

Read only

0 Likes
1,835

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.

Read only

0 Likes
1,835

i have solved it myself .

Read only

0 Likes
1,835

Hello

Please document the complete solution here so that someone else can take help from it.

Thanks

Nabheet

Read only

0 Likes
1,834

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

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,834

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.

Read only

0 Likes
1,834

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 .

Read only

0 Likes
1,834

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 ?