Developer forum

Forum » Integration » Integrate an order PDF in other format

Integrate an order PDF in other format

Tomas Gomez
Reply

Hi,

On a BC integration, we use the Integration Customer Center to get the PDFs of the orders in a standar format. These PDFs are located in table code 1306 in BC.

Our users need to get a custom format for the orders, that is other PDFs located at 50027 in BC.

How can we get these custom PDFs from BC? Is it possible to get them modifying the request to BC? Or is it neeeded to modify something else?

Regards,
Tomas


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Tomas,
not sure what you mean about the 1306/50027 numbers in BC, I was able to find 50027 table, and 1306 Record opens a "User preferences" table which is
not directly used anywhere in our code. If needed I can send you a pdf generation source code from the app.
Also if you want to implement a custom "pdf" request then you can subscribe to the event:
CustomerCenterPublisher.OnBeforeExecuteGetCustomerStatementPfRequest
and set a flag: stopExecution := true
and set the "response" variable with yours pdf 64bit string from BC.
The request format is:
<GetCustomerStatementPDF />
You can read the parameters from the input request using the code like that in your custom subscriber:
XmlHelper.GetTextFromNode(XMLdocIn.AsXmlNode(), '/GetCustomerStatementPDF/@customerID')
So unless you do not use this request in your system, you can override it with your custom subscriber and return your pdf.

In our pdf generation we use this:
ReportSelection: Record "Report Selections";
recordReference: RecordRef;

oStream: OutStream;
tempBlob: codeunit "Temp Blob";

SalesHeader.SETRANGE(SalesHeader."Document Type", SalesHeader."Document Type"::Order);
SalesHeader.SETRANGE("No.", DocumentNo);
SalesHeader.SETRANGE("Sell-to Customer No.", customer."No.");
recordReference.GetTable(SalesHeader);
tempBlob.CreateOutStream(oStream);
REPORT.
SaveAs(ReportSelection."ReportId", '', ReportFormat::Pdf, oStream, recordReference);

BR, Dmitrij

 
Tomas Gomez
Reply

Hi Dmitrij,

Let me clarify the question.

At this moment DW get the invoice PDF in the standard format, which is the 1306 report. But it is necessary to get the PDF in a different format, which is the format requested by the tax service of our country. In our case this format is the 50027 report, but it could have any other number upon the tax service.

How could we get the PDF in this different format?

Regards,
Tomas

 

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Tomas,
maybe you need to update the 1306 standard report with yours new template somehow.
We do not use any "formatting" in the codeunit, so it acts as how BC does.
Maybe you need to look for a solution somewhere else, fx:
https://github.com/microsoft/AL
https://community.dynamics.com/business/f/dynamics-365-business-central-forum/275569/customizing-the-datasets-in-report-layouts?pifragment-109331=2#responses
https://www.yammer.com/dynamicsnavdev
BR, Dmitrij

 

You must be logged in to post in the forum