Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Export Customer Account Statement to XML File using X++

Posted on by 505

Good day.

i am hoping that somebody could help me and point me in the right direction.

i am looking for a way to run customer account statements to XML file in bulk.

i know that i can run an individual statement to XML but there doesn't seem to be a way to run multiple accounts.

i have looked around the web and have only come across exporting to .PDF.

is this possible to export to XML files.

any help would be appreciated.

*This post is locked for comments

  • B.W Profile Picture
    B.W 505 on at
    RE: Export Customer Account Statement to XML File using X++

    Good day Paul.

    the code is on this post mid way down. you should just be able to change the SRSReportFileFormat to PDF.

    Kind regards.

    B.A

  • RE: Export Customer Account Statement to XML File using X++

    Hi Sir, I just want to ask if you still have the codes or the steps you've done for this. I'm facing the similar issue. We want to generate into pdf file. Thank you so much in advance.

    Regards,

    Paul

  • Verified answer
    B.W Profile Picture
    B.W 505 on at
    RE: Export Customer Account Statement to XML File using X++

    Hi Martin.

    I created a 'Save' method in the CustAccountStatementExtController class and call that to do the actual saving/exporting of the report.

  • Martin Dráb Profile Picture
    Martin Dráb 230,056 Most Valuable Professional on at
    RE: Export Customer Account Statement to XML File using X++

    Can you share the solution with others? It's possible that somebody will run into a similar problem, find this thread and will like to know what was the underlying cause in your case.

  • B.W Profile Picture
    B.W 505 on at
    RE: Export Customer Account Statement to XML File using X++

    Good day Martin.

    i have resolved my issue. Thank you so much for all your help.

  • Martin Dráb Profile Picture
    Martin Dráb 230,056 Most Valuable Professional on at
    RE: Export Customer Account Statement to XML File using X++

    It seems to me that you don't have print management used at all, but I don't know your setup. If you believe it's correct, I suggest you debug how your report gets printer settings.

  • B.W Profile Picture
    B.W 505 on at
    RE: Export Customer Account Statement to XML File using X++

    Hi Martin.

    thank you for your reply.

    how do we setup so that the user uses print management and not last used settings?

  • Martin Dráb Profile Picture
    Martin Dráb 230,056 Most Valuable Professional on at
    RE: Export Customer Account Statement to XML File using X++

    Okay, but if you say that then all subsequent prints go to XML instead of to screen, it must mean they don't use your print management setup and what you have configured there is irrelevant.

  • B.W Profile Picture
    B.W 505 on at
    RE: Export Customer Account Statement to XML File using X++

    Good day Martin.

    Thank you for your reply.

    this is what i have under print management (random Customer Account)

    3580.pm.png

    this is the code that i am using to generate the statement to xml.

    CustAccountStatementExtController      controller = new CustAccountStatementExtController();
        SRSPrintDestinationSettings            printSettings;
        CustAccountStatementExtContract        Contract;
        MapEnumerator                          enumerator;
        Query                                  query;
        TransDate                              Fromdate;
        Str1260                                XmlFile;



        Fromdate = str2Date("2003/01/15",321);
         CurrentTodate = _CustAccountStatementExtPDFParameters.Todate;
            if(CurrentTodate == dateNull())
            {
                CurrentTodate = today();
            }

        XmlFile = _CustAccountStatementExtPDFParameters.XMLFilePath + '\\' + _CustTable.AccountNum + '.xml';

       // controller.parmReportName(PrintMgmtDocType::construct(PrintMgmtDocumentType::CustAccountStatement).getDefaultReportFormat());
        controller.parmReportName( ssrsReportStr( CustAccountStatementExt, Report ));

        //controller.parmLoadFromSysLastValue(true);
        controller.parmShowDialog(false);

        printSettings = controller.parmReportContract().parmPrintSettings();
        


        printSettings.printMediumType(SRSPrintMediumType::File);
        printSettings.fileFormat(SRSReportFileFormat::XML);
        printSettings.overwriteFile(true);
        printSettings.fileName(XmlFile);

        Contract = controller.parmReportContract().parmRdpContract() as CustAccountStatementExtContract;

        enumerator = controller.parmReportContract().parmQueryContracts().getEnumerator();
        enumerator.moveNext();
        query = enumerator.currentValue();
        query.dataSourceTable(tableNum(CustTable)).addRange(fieldNum(CustTable, AccountNum)).value(queryValue(_custTable.AccountNum));

        Contract.parmAgingBucket(_CustAccountStatementExtPDFParameters.AgingDefn);
        Contract.parmAgingBucketPrintDescription(NoYesCombo::Yes);
        Contract.parmAgingPeriod(true);

        Contract.parmFromDate(fromDate);


        Contract.parmOnlyOpen(_CustAccountStatementExtPDFParameters.BalanceOtherThanZero);
        Contract.parmPrintAging(true);
        Contract.parmPrintingDirection(ForwardBackwardPrinting::Backward);
        Contract.parmPrintNonZero(_CustAccountStatementExtPDFParameters.BalanceOtherThanZero);
        Contract.parmToDate(CurrentTodate);

        controller.parmShowDialog(false);

        controller.startOperation();

  • Martin Dráb Profile Picture
    Martin Dráb 230,056 Most Valuable Professional on at
    RE: Export Customer Account Statement to XML File using X++

    What you're describing doesn't sound like Print management. It seems that your users are getting their last used print settings; therefore it's not coming from print management. If your intention was using print management, you'll have to review your setup. Or maybe you didn't actually meant print management.

    I'm going to wait for your clarification.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans