2015 Jun 09 3:09 PM
Hi Friends,
I am trying to attach document at PO header level using the belwo FMs but at ME23 the document list is not getting populated ,
SO_FOLDER_ROOT_ID_GET
SO_OBJECT_INSERT
ls_object-objkey = '4500000509'.
ls_object-objtype = 'BUS2012'.
ls_note-objkey = 'MESSAGE'.
CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT' " Call the Function Module For Commit the Object
EXPORTING
obj_rolea = ls_object
obj_roleb = ls_note
relationtype = 'ATTA'
EXCEPTIONS
OTHERS = 1.
i am getting SY_SUBRC = 0 even though not able to see the files at PO header level.
Regards,
Vinodkumar,.
2015 Jun 09 3:59 PM
HI Vinod,
You need to call BAPI_TRANSACTION_COMMIT after the FM BINARY_RELATION_CREATE_COMMIT. It worked for me. Hence if sy-subrc eq 0. call the below commit bapi.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Regards,
Tanmay.
2015 Jun 09 8:24 PM
Instead of SO_OBJECT_INSERT try with SO_DOCUMENT_INSERT_API1. I wrote a blog about GOS attachments long time ago (there is also one on SCN), but later when I tried using the same code in another system it didn't work. I don't remember what the issue was exactly but just checked the program and it has a different FM.
There might even be some classes available or better FMs, keep in mind many posts on this were written over 5 years ago and a lot has changed since.
2015 Jun 09 8:26 PM
Tanmay, there should be no additional commit needed. If you look at the FM code it already has COMMIT in it (at least in our EHP4 version).
2015 Jun 09 8:36 PM
Hi Jelena,
I agree the FM code has commit work but i remember facing a similar issue with this Fm and adding this extra commit. It worked for me then.
Thanks.
Tanmay.
2015 Jun 10 10:00 AM
Thanks Jelena , your blog rockzzz,
Actually my problem was in linking the Document ID with FM BINARY_RELATION_CREATE_COMMIT.
Could you pls confirm is there any way to Name the files that are getting attached.
Regards,
Vinodkumar.