Options

Different wordlayout at runtime

RogerRoger Member Posts: 57
Hi,

Is there a possibility to change the wordlayout of a nav report before the report is printed? Could do that with C/AL Code?

Thanks for all hints, Roger
Many thanks, Roger

Answers

  • Options
    amaama Member Posts: 15
    Depending on how complicated the layout change is, you could just make two copies of the report and selectively run either A or B copy depending on whatever layout you want to use in the code. Would probably be the easiest / fastest way without over thinking / complicating it.
  • Options
    JuhlJuhl Member Posts: 724
    To use this, the report has to go through Report Selection table.
    Change the report id in Report Selection table (77), for examble Invoice.
    Create you extra layouts in table 9651.
    In tabel 9657 you can set layout per customer, there is an action on Customer Card for this. Here you can also specific an alternative email address for this report, so if the customer wants Invoices sent to a different email, than the one on the customer card, it will use that in Document Send function.

    If you need it from C/AL then you use the SetTempLayoutSelected function in table 9651.
    You set the layout before run, and then set it back afterwards.
    ReportLayoutSelection.SetTempLayoutSelected("Custom Report Layout Code");
    REPORT.RUNMODAL("Report ID",IsGUI,FALSE,RecordVariant)
    ReportLayoutSelection.SetTempLayoutSelected('');

    This i use on 2017, but should work in 2016 as well.
    Follow me on my blog juhl.blog
Sign In or Register to comment.