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

GOS Document Attachment Issue

vinodkumar_thangavel
Participant
0 Likes
2,328

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,.

5 REPLIES 5
Read only

TanmayVerma
Active Participant
0 Likes
1,522

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.

Read only

0 Likes
1,522

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.

Read only

0 Likes
1,522

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).

Read only

0 Likes
1,522

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.

Read only

0 Likes
1,522

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.