Customer Statement button from Customer Card

Dear All,

Can anyone help me with this query?

I need to add a button on Customer Card so that on click it should display the Customer statement for that customer.

The customer statement that I am using is a custom report that accepts only the customer number (No.) field as a parameter.

Thanks,

Vinod

Hi Vinod,

In the On-push-trigger of the button, define Customer table as local var, and also your report.

Put some code like this…
CLEAR(MyReport),
l_CustRec.setrange(“No.”,“No.”);
MyReport.SETTABLEVIEW(l_CustRec);
MyReport.RUNMODAL;

Hi Alex,

Thanks for this.

But, there is another issue here. The above code takes me to the screen where we input the parameter (Customer number). Still, I have to click on the “Preview” button to view the report. Is there any way to automate this.

ie; Once the user clicks on the custom Statement button on the Customer Card, the Navision should display the report preview.

I’m using Navision 4 SP 3.

Thanks,

Vinod

To call a report you just have to see the REPORT help on C/AL Symbol Menu, the call is this way:

REPORT.RUNMODAL(Number [, ReqWindow] [, SystemPrinter] [, Record])

Number = Number of the report you want to run, better use Report::nameOfTheReport
ReqWindow = allows you to non-display the request form, as you want, so it will be FALSE
SystemPrinter = (you don’t need it)
Record = this would be the record variable with the current Customer, so it could be Rec on your case

Hope it helps

Hi,

I don’t think REPORT.RUNMODAL(…) allows for running in preview-mode.

Neither does defining the report, and calling the var modally, as i suggested.

As i know it (i might be wrong) print-preview can only happen by user interaction (pressing the preview-button)

Is this report also used elsewhere, where the user must be able to put filters on Customer No.?

If not, then you can remove the Customer-Tab from the request window of the report (by defining DataItemTableView-property, and no define any ReqFilterFields).
This way the user can not change the filter set on Customer No., but still have to press the preview-button.

This sends the report to the Printer directly.

My code is as per below. It’s In the OnPush trigger.

CLEAR(GetCustomerReport);
GetCustomerNo.SETRANGE(“No.”,“No.”);
REPORT.RUNMODAL(50093,FALSE,FALSE,GetCustomerNo);

where GetCustomerNo. is the record variable.

I’m getting the below error if I replace the last line with REPORT.RUNMODAL(50093,FALSE,GetCustomerNo);

Type conversion is not possible because 1 of the operators contains an invalid type.

Boolean := Record

Yes, I’m using the same report as a stand alone report as well. Here the user can input a customer number and preview/print the report.

I’m sorry but i don’t think you can automate the preview-thing.

Any help on this query?

The error is obviously displayed because the third parameter of RUNMODAL function is not a record (GetCustomerNo) but a boolean (SystemPrinter). I can’t believe the previous code send the report to the printer, even if you set parameter to FALSE. Did you even try with RUN function?

Yes, I tried both of them (RUN and RUNMODAL).

RUN takes me to the report’s request form section where I can see the “No.” parameter field populated with the Customer number.

RUNMODAL send the report directly to the printer.

Today I’m out office, let me try next week but, as Alexander said, it doesn’t seem to be possible. Sorry [:S]