How to show the current record in print report automatically..??

Hi,

Go to the design of the report which you want to run, and check what is the data item of that report , create that table as a variable and create the report which you want to run as a variable.these variable should be created at the form/page which have the print button to run your report. and modify the above code based on your variable. above code will not directly match for your requirement its just an example. or else please let me know the report name, and name of the data item of the report

Hi,

Thank you for your reply,

Andri: I have added another button in the print menu option as this is completely new report “Buyer covering letter”, will I still be able to run it as standard button. I guess not as it is not working or may I am missing something.

Marsha>> I am using “Sales Header” “Sales LIne” and “Payment Export Terms” as tables/ data items to fetch data from.

I am not to create variable at form level. I went to form where my print button is present, and there I have gone in design part using ctrl + f2 but I am not able to go anywhere to create variable …!! Please help.

Thanks to both of you and all the helper’s tried helping me earlier…:slight_smile:

Nav 2009 R2 is the version I am using if this helps…

Regards,

Fahim.

If this helps…!! This is what I am trying to do…

Another trick:

Use standard button, and menu item.

Let’s assume that you will use Print Invoice button, then in Report Selection, after Invoice report, add a new line (no. 2) your report ID.

So, you can print your report by clicking on the Print (Invoice) button, and then click Cancel, then your report will go out, and you could print your one.

You can debug and learn the process of it then.

Hi…

"====================================================

Let’s solve that using basic application solution:

  1. I assume that the form/page you are want to print is Posted Sales Invoice.
  2. Go to Administration | Application Setup | Sales & Marketing | Report Selection (Sales)
  3. Choose: Invoice
  4. Change the Standard Default Report ID there, into your New Custom Report ID
  5. Try to print from the standard button in Posted Sales Invoice form, your report will be run

If you want to know, how could your report be called, and directly to the current record, now try to debug it when you push the Print button.

Hope it helps.

"====================================================

it did not help me…!! any other solution if possible.
Thanks

Hi

Which Report you are printing from which Form you are printing,

Hi,

I have created a new letter called buyer covering letter, which need to be printed with a new button in print menu. I have linked the letter or report infact to that button and want to show the current record in the report. I am using “Sales Header” “Sales LIne” and “Payment Export Terms” as tables/ data items to fetch data from.

Nav 2009 R2

Also, I am printing it at export invoice level. It is sort of acknowledgement of the order with invoice no, perfoma invoice no, payment terms etc. Hope this helps to make you understand. If required please ask.:…-)

Regards,

Fahim

With reference to your question I am sending code to print particular record from multiple it’s useful for you at the time of attaching your reports. Depends on situation code should be changed. This is inbuilt code but here I was added one line

ReportSelection.SETFILTER(Sequence,‘2’); //WIN 275

Because in Table Report Selections (77) the Usage fields having same name i.e. S.Quote with Sequence ID 1, 2, 3 that’s why I was added this line. This is my own created steps

Code to show the current record in print report automatically---- FOR SALES QUOTATION

(//WIN 275 CODE TO SELECT PERTICULAR RECORD FROM MULTIPLE RECORD AT THE TIME OF ATTACHING REPORTS)

STEP 1. Run page—{Report Selection – Sales (306)}-----Enter following details

Sequence Report ID Report Caption

2 50000 Sales Quote-Tool Assembly

3 50001 Sales Quote-Machine Assembly

(the above rows are inserted into Table {Report Selections (77)})

STEP 2. Go to Page {Sales Quotes (9300)}—Page Action— Add actions

Action Sales Quote-Tool Assembly

Action Sales Quote-Machin Assembly

STEP 3. Go to Code-Unit—{Document-Print (229)} --Add functions —C/AL/GLOBAL for print Quotations

PrintSalesQuoteToolAssembly(RecSalesHeader : Record “Sales Header”)

//WIN 275 CODE TO SELECT PERTICULAR RECORD FROM MULTIPLE RECORD

RecSalesHeader.SETRANGE(“No.”,RecSalesHeader.“No.”);

ReportSelection.SETRANGE(Usage,ReportSelection.Usage::“S.Quote”);

ReportSelection.SETFILTER(“Report ID”,’<>0’);

ReportSelection.SETFILTER(Sequence,‘2’); //WIN 275

ReportSelection.FIND(’-’);

REPEAT

REPORT.RUNMODAL(ReportSelection.“Report ID”,TRUE,FALSE,RecSalesHeader);

UNTIL ReportSelection.NEXT = 0;

PrintSalesQuoteMachineAssembly(RecSalesHeader : Record “Sales Header”)

//WIN 275 CODE TO SELECT PERTICULAR RECORD FROM MULTIPLE RECORD

RecSalesHeader.SETRANGE(“No.”,RecSalesHeader.“No.”);

ReportSelection.SETRANGE(Usage,ReportSelection.Usage::“S.Quote”);

ReportSelection.SETFILTER(“Report ID”,’<>0’);

ReportSelection.SETFILTER(Sequence,‘3’); //WIN 275

ReportSelection.FIND(’-’);

REPEAT

REPORT.RUNMODAL(ReportSelection.“Report ID”,TRUE,FALSE,RecSalesHeader);

UNTIL ReportSelection.NEXT = 0;

You will get select any one record from multiple recoords and get print of selected record

Regards,

Santosh Kumbhar

Hi All,### Code to show the current record in print report automatically

Go to Page Action—>Create Action---->press F9---->Then write following code you just pass the report name in REPORT.RUNMODAL

SalesInvHeader.RESET;

SalesInvHeader.SETRANGE(“No.”,“No.”);

REPORT.RUNMODAL(REPORT::“Sales Invoice -Tax”,TRUE,TRUE,SalesInvHeader);