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

Overwrite doument SO_OJECT_INSERT

0 Likes
1,106

Hi,

How do I use  SO_OBJECT_INSERT to overwrite document which has exact same name.

Shruti

It does accept file with same name. But even though file name is same it does not overwrite and create new attachment with same name.

3 REPLIES 3
Read only

Sandra_Rossi
Active Contributor
0 Likes
997

Sorry, but you shouldn't use this function module as SAP never released it. If you want to attach a file to a business object (?), you could use SO_DOCUMENT_INSERT_API1. But I don't understand why it wouldn't accept a file with same name, could you tell us more?

Read only

0 Likes
997

It does accept file with same name. But even though file name is same it does not overwrite and create new attachment with same name.

Read only

0 Likes
997

Oh sorry. No, it's for creation, not for overwriting, it's not like file upload/download in a file system, every SAPoffice document has its own unique ID, which is a kind of auto-incremented number, its unique ID is not its name. Consequently, you must do it differently: read all attachments of the business object (search SCN to get examples, for instance search CL_BINARY_RELATION), get the ID of the one with same file name, delete it (SO_DOCUMENT_DELETE_API1), and insert the new document.