最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

dynamics al - Report.SaveAs(Report::MyReport, RequestPageParameters, Format, Stream); in blob storage - Stack Overflow

programmeradmin8浏览0评论

I'm trying to save a Salesinvoice object in CompanyA Business central as a pdf file in blob storage and afterward save it as a attached document on a purchase order in CompanyB.

I have made a table which is visible for all company, and I try to save the pdf from CompanyA in blobfield.

This is my code:

procedure GetSalesOrderDocumentFromHB(var PurchaseHeader: Record "Purchase Header"): Boolean
    var
        PostedSalesInvoiceNo: Code[20];
        inss: InStream;
        outss: OutStream;
        Parameters: Text;
        Blob: record "TableBlob";


    begin
        PostedSalesInvoiceNo := PurchaseHeader."Vendor Invoice No.";
        if PostedSalesInvoiceNo <> '' then 
        begin
            postedSalesInvoice.ChangeCompany('CompanyA');
            if postedSalesInvoice.GET(PostedSalesInvoiceNo) then 
            begin
                                
                TempBlob.CreateOutStream(outss);
                    Blob.INIT;
                    //Rec.ID := 12;   
                    blob.ID := PostedSalesInvoiceNo;
                    blob.MyBlob.CREATEOUTSTREAM(outss);
                    Parameters := StrSubstNo('<?xml version="1.0" standalone="yes"?><ReportParameters name="NN Salgs - Faktura" id="50000"><DataItems><DataItem name="Sales Invoice Header">VERSION(1) SORTING(Field3) WHERE(Field3=1(%1))</DataItem></DataItems></ReportParameters>', PurchaseHeader."Vendor Invoice No.");
                
                Report.SaveAs(50000, Parameters, ReportFormat::Pdf, outss);
                
                    CopyStream(outss, inss);
                    blob.MyBlob.CREATEOUTSTREAM(outss);
                    
                    Blob.Insert(true);
           End;

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论