a month ago
Hello everyone:
I need to add "n" number of attachments to my Purchase order, I'm using B1 DI Server API by creating XML files andt then send them to a DIServer Client.
I see a field in oPurchaseQuotations "AttachmentEntry", should I write my attachments in this field? how?
These are my xml files
For oPurchaseQuotations:
<?xml version=\"1.0\" encoding=\"utf-16\"?>
<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\">
<env:Header>
<SessionID>idSession</SessionID>
</env:Header>
<env:Body>
<AddObject xmlns=\"http://127.0.0.1/SAP/\">
<BOM>
<BO>
<AdmInfo>
<Object>oPurchaseQuotations</Object>
</AdmInfo>
<Documents>
<row>
<CardCode>aCardcode</CardCode>
<CardName>aCardName</CardName>
<NumAtCard>aNumAtCard</NumAtCard>
<RequriedDate>aDate</RequriedDate>
<DocDueDate>aDocDuedate</DocDueDate>
<SalesPersonCode>-1</SalesPersonCode>
<AttachmentEntry>WHAT SHOULD I WRITE HERE</AttachmentEntry>
</row>
</Documents>
<Document_Lines>
<row>
<ItemCode>anItemCode</ItemCode>
<Quantity>aQuantity</Quantity>
<Price>aPrice</Price>
<FreeText>aText</FreeText>
<ShipDate>aDate</ShipDate>
<RequiredQuantity>aQuantity()</RequiredQuantity>
<RequiredDate>aDate</RequiredDate>
<UnitPrice>aPrice</UnitPrice>
</row>
</Document_Lines>
<Document_SpecialLines>
<row>
<AfterLineNumber>aNumber</AfterLineNumber>
<LineType>aLineType</LineType>
<LineText>aText</LineText>
</row>
</Document_SpecialLines>
</BO>
</BOM>
</AddObject>
</env:Body>
</env:Envelope>
For oAttachments2:
<?xml version="1.0" encoding="UTF-16" ?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<SessionID>idSession</SessionID>
</env:Header>
<env:Body>
<AddObject xmlns=\"http://127.0.0.1/SAP/\">
<BOM>
<BO>
<AdmInfo>
<Object>oAttachments2</Object>
</AdmInfo>
<Attachments2 />
<Attachments2_Lines>
<row>
<SourcePath>fileSourcePath</SourcePath>
<FileName>fileName</FileName>
<FileExtension>fileExtension</FileExtension>
</row>
<row>
<SourcePath>fileSourcePath</SourcePath>
<FileName>anotherFileName</FileName>
<FileExtension>fileExtension</FileExtension>
</row>
</Attachments2_Lines>
</BO>
</BOM>
</dis:AddObject>
</env:Body>
</env:Envelope>
Thanks in advance for your response
Hi SAP_Check,
AttachmentEntry accepts integer value only. Also, it will accept the existing value from OATC table.
It is required to have the entry related to the attachment in the OATC table first. Then only, it can be referred to attach.
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ankit:
I just executed this oAttachment2 XML file:
<?xml version="1.0" encoding="UTF-16" ?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<SessionID>5GA1fP7hfApH8vTWL1ukllN/OJOZVoU/dXcUGMxRlL4D1QsUBTq/Q6wdBtqVPsrs</SessionID>
</env:Header>
<env:Body>
<AddObject xmlns="http://127.0.0.1/SAP/">
<BOM>
<BO>
<AdmInfo>
<Object>oAttachments2</Object>
</AdmInfo>
<Attachments2_Lines>
<row>
<SourcePath>\\myURL\aFolder</SourcePath>
<FileName>fileName</FileName>
<FileExtension>pdf</FileExtension>
</row>
<row>
<SourcePath>\\myURL\aFolder</SourcePath>
<FileName>anotherFileName</FileName>
<FileExtension>pdf</FileExtension>
</row>
</Attachments2_Lines>
</BO>
</BOM>
</AddObject>
</env:Body>
</env:Envelope>
These files were uploaded by a different process (only the physical files using a web apllication, ACT1 is not update yet, these files will be part of the attachments for my purchase order), the response from DI server:
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<env:Fault>
<env:Code>
<env:Value>env:Receiver</env:Value>
<env:Subcode>
<env:Value>-10</env:Value>
</env:Subcode>
</env:Code>
<env:Reason>
<env:Text xml:lang="en">A file with this name already exists. [ATC1.FileName][line: 1] , '\\myURL\aFolder\fileName.pdf'</env:Text>
</env:Reason>
<env:Detail>
<Object>221</Object>
<ObjectIndex>1</ObjectIndex>
<Command>AddObject</Command>
<SessionID>77AD6292-9C3B-41ED-B34F-3A1BC35AC07A</SessionID>
</env:Detail>
</env:Fault>
</env:Body>
</env:Envelope>
Then I renamed the files to avoid the previous error and the response from DI Server is:
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<env:Fault>
<env:Code>
<env:Value>env:Receiver</env:Value>
<env:Subcode>
<env:Value>-5002</env:Value>
</env:Subcode>
</env:Code>
<env:Reason>
<env:Text xml:lang="en">Source file does not exist , ''\\myURL\aFolder\fileName.pdf'</env:Text>
</env:Reason>
<env:Detail>
<Object>221</Object>
<ObjectIndex>1</ObjectIndex>
<Command>AddObject</Command>
<SessionID>F1609CD3-F5A5-485A-B39C-5F98B4532F81</SessionID>
</env:Detail>
</env:Fault>
</env:Body>
</env:Envelope>
I tested your response in another question in the community and it didn't work:
"Select the option Do Not Overwrite Attachments with the Same File Name under Administration → System Initialization → Document Settings → General as per your requirement and test the issue again."
What I'm missing here?
User | Count |
---|---|
98 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.