how to show report from form withou press PREVIEW button?

hi all i want to ask

how to show report without click preview button?

so for example i create sales order no 1001

then after i create it, i klik button Print

and then i want it directly to show the report

thanks

Set CurrReport.PREVIEW to TRUE.

i put it on dataitem, failed

where should i put that code?

thanks

You have to set it, I believe, in the OnPreReport trigger. It has to be set before any data processing begins. You could also set it in a function before you run the report. This is useful if you have a report that is printed sometimes and previewed other times.

You can also look into the USEREQUESTFORM property if you are unfamiliar with it. That way they don’t even see the filter screen.

USEREQUESTFORM??

sorry… i never use it

can you give me a sample using that?

i really unfamiliar using USEREQUESTFORM

even i already see the F1 help file

thanks

Well, say you have a report variable named Rep. It could refer to any report. You would start with the following code in your OnPush method (or somewhere else, where ever you want to call the report from).

Rep.USEREQUESTFORM := FALSE;

That will prevent the request form, which contains the data item tabs (filters) and option tab from displaying. It will be just like the user clicked print or preview with the default options.

Now, if you wanted to preview this report (but print it other times) you would need to add a function to the report. Something like SetPreview that takes in a boolean. The code in that function would be:

CurrReport.PREVIEW := PreviewParameter;

Now when you call the report you have:

Rep.USEREQUESTFORM := FALSE;
Rep.SetPreview(TRUE);
Rep.RUN;

If the report is always preview only you can set the code in the OnPreReport trigger.

Make sense?

hmmmmm sorry a little bit confusing for me

i have code to execute the report is just like this

btnPreview - OnPush()
GET(“No.”);
CurrForm.SETSELECTIONFILTER(SalesInvHeader);
REPORT.RUN(50001,TRUE,FALSE,SalesInvHeader);

so I add to become like this?

btnPreview - OnPush()
Rep.USEREQUESTFORM := FALSE;
GET(“No.”);
CurrForm.SETSELECTIONFILTER(SalesInvHeader);
REPORT.RUN(50001,TRUE,FALSE,SalesInvHeader);

so where should i put this

Rep.USEREQUESTFORM := FALSE;
Rep.SetPreview(TRUE);
Rep.RUN;

is it still in the form or report?

Instead of doing REPORT.RUN you need to define a Report variable with a subtype of 50001. Then use that variable to run your report and set the properties.

okay then Maxx

i get it

thanks a lot for the explanation :slight_smile:

by the way…

it only print to printer or pdf…

how about if i want to send parameter

but it only processing only?

how to set that?