I have just tested this on my test environment with the exact same error you mentioned, only the "sa" user is able to attach documents while all other users are failing to do so, getting the same error
Following this issue on the SQL level, I can clearly see that this is not a permission issue since I granted the test user a "Sysadmin" role, tried the Grant.sql script and still getting this error.
As retrieved from the SQL profiler, the 'sa' user is getting the attachment ID properly, and then getting it inserted into the CO00100 (procedure zDP_CO00101SI ),
-- The code below is retrieving the Attachment ID
EXEC sp_executesql N'INSERT INTO coAttachmentItems (Attachment_ID, fileName, BinaryBlob) VALUES (@Attachment_ID, @fileName, 0x0) ',
N'@Attachment_ID nvarchar(36),@fileName nvarchar(6)',
@Attachment_ID = N'7e063e4d-4d5c-4c14-9337-70d0a15a337a',
@fileName = N'12.mac'
go
-- The code below is inserting the record into CO00100 including the attachmentID
BEGIN
DECLARE @num INT
EXEC FIVER.dbo.zDP_CO00101SI '7e063e4d-4d5c-4c14-9337-70d0a15a337a',
'12.mac', '', 'sa', '2017.04.12', '03:12:37', 'IC', 0, 0, 0, '', 0, 0,
@num OUT
SELECT @num
END
On the other hand, the other test user is not retrieving any attachmentID, and the field is blank as shown below:
BEGIN
DECLARE @num INT
EXEC FIVER.dbo.zDP_CO00101SI '', '12.mac', '', 'USER15', '2017.04.12',
'03:07:48', 'IC', 0, 0, 0, '', 0, 0, @num OUT
SELECT @num
END
As you see, the first parameter which is the AttachmentID is blank, and that's why the error is poping on the screen.
This shall be reported to Microsoft in order to check and provide a relevant solution.
Meanwhile, I will be testing different scenarios trying to get a work around solution (if possible)
Derek Albaugh Would you take a look at this issue in 2015 R2 ? It seems as a quality issue.
Your feedback is highly appreciated,