cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Business One - Upload Attachment (to remote service location) - Internal Error (-43)

vinayhatwal
Participant

Hi Experts,

I'm having an issue uploading an attachment into SAP B1 via the Service Layer. I am able to upload an attachment using the SAP client without issue. I'm using Postman to test sending the request before I embed this into a real application.

Here's what my request looks like.

{
    "odata.metadata": "https://129.159.XXX.XXX:50000/b1s/v1/$metadata#Attachments2/@Element",
    "Attachments2_Lines": [
        {
            "LineNum": 1,
            "SourcePath": "C:\\BK1",
            "FileName": "ABC1",
            "FileExtension": "docx",
            "AttachmentDate": "2022-05-27",
            "Override": "tYES",
            "FreeText": null,
            "CopyToTargetDoc": "tNO"
        }
    ]
}

Here's the error that I'm getting which doesn't make sense to me. I can't find anything on this error and I was wondering if anyone had seen something like this before?

<code>{
    "error": {
        "code": -43,
        "message": {
            "lang": "en-us",
            "value": "Internal error (-43) occurred"
        }
    }
}

Note: It is working fine from the local network but when I am calling this from an external network, I am able to get and send the data as expected but File is not being uploaded.

Can you please help in it?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member260921
Participant
0 Kudos

Vinay,

This code below worked for me to add an entry to Attachments2 but it did not copy the file itself.

I think you may have to copy the file separately in this case to the locally mounted shared Linus attachments folder. Once I did this the file was available and could be added to a document by updating AttachmentEntry for the document.

POST https://hanab1vm2:50000/b1s/v2/Attachments2

{
"Attachments2_Lines": [
{
"SourcePath": "C:\\temp\\TEST06262002.txt",
"FileName": "TEST06262002",
"FileExtension": "txt",
"Override": "tYES",
"CopyToTargetDoc": "tYES"
}
]
}

RESULT:

{ "@odata.context": "https://hanab1vm2:50000/b1s/v2/$metadata#Attachments2/$entity", "AbsoluteEntry": 5, "Attachments2_Lines": [ { "AbsoluteEntry": 5, "LineNum": 1, "SourcePath": "C:\\temp\\TEST06262002.txt", "FileName": "TEST06262002", "FileExtension": "txt", "AttachmentDate": "2022-06-26", "Override": "tYES", "FreeText": null, "CopyToTargetDoc": "tYES" } ]}

"CopyToTargetDoc" seems to have no effect.

I hope this helps.

See my similar question at

https://answers.sap.com/questions/13665467/attachments2-b1-service-layer-internal-error-47-oc.html where I am getting -47 in trying to upload the file directly.


Regards,

Mel

vinayhatwal
Participant
0 Kudos

Thank you Mel, Problem is resolved. It was having some kind of rights issues on the app server.

Answers (2)

Answers (2)

former_member260921
Participant
0 Kudos

correction: to read and write to the shared folder.

former_member260921
Participant
0 Kudos

The shared folder for attachments must be mounted in Linux with correct credentials to read to the shared folder.

If the shared folder is a Windows share, then the network user used by Linux to connect must be specifically enabled in Windows.