Rtc-Print Excel

Lamba
Member Posts: 263
Hi Experts,
There is a customized report, having code on OnPreSection() of the dataitem's body trigger.
The code is given below which does the insertion of data in excel:
IF COMPANYNAME = 'XYZ' THEN
SalesAmt :=SalesCrMemoLineAmount;
NetAmt := 0;
IF Customer.GET("Sales Cr.Memo Header"."Sell-to Customer No.") THEN
IF (CRSalesAmt <> 0) AND (Customer."Net Amount %" <> 0) THEN
NetAmt := (CRSalesAmt / Customer."Net Amount %") * 100;
IF CurrReport.SHOWOUTPUT AND ExportToXL THEN BEGIN
EnterCell(i,1,FORMAT("Document No."),FALSE,FALSE);
EnterCell(i,2,FORMAT("Sales Cr.Memo Header"."Posting Date"),FALSE,FALSE);
EnterCell(i,3,FORMAT("Sell-to Customer No."),FALSE,FALSE);
EnterCell(i,4,FORMAT("Sales Cr.Memo Header"."Sell-to Customer Name"),FALSE,FALSE);
EnterCell(i,5,FORMAT("No."),FALSE,FALSE);
EnterCell(i,6,FORMAT(Description),FALSE,FALSE);
EnterCell(i,7,FORMAT("Item Category Code"),FALSE,FALSE);
EnterCell(i,8,FORMAT(CRItemCatDesc),FALSE,FALSE);
EnterCell(i,9,FORMAT("Product Group Code"),FALSE,FALSE);
EnterCell(i,10,FORMAT("Sales Cr.Memo Header"."Ship-to Code"),FALSE,FALSE);
EnterCell(i,11,FORMAT("Sales Cr.Memo Header"."Ship-to Name"),FALSE,FALSE);
EnterCell(i,12,FORMAT(CRCountry),FALSE,FALSE);
IF COMPANYNAME = 'PMI' THEN
EnterCell(i,13,FORMAT(SalesCrMemoLineAmount),FALSE,FALSE)
ELSE
EnterCell(i,13,FORMAT(CRSalesAmt),FALSE,FALSE);
EnterCell(i,14,FORMAT(CRValueAmt),FALSE,FALSE);
EnterCell(i,16,FORMAT("Unit of Measure Code"),FALSE,FALSE);
EnterCell(i,15,FORMAT(CMQty * -1),FALSE,FALSE);
QuantityKL := 0;
ItemUnitMeasure.RESET;
ItemUnitMeasure.SETRANGE("Item No.","No.");
ItemUnitMeasure.SETRANGE(Code,'KL');
IF ItemUnitMeasure.FINDFIRST THEN BEGIN
QuantityKL := CMQtyBase / ItemUnitMeasure."Qty. per Unit of Measure" * -1;
END;
QuantityNo := 0;
ItemUnitMeasure.RESET;
ItemUnitMeasure.SETRANGE("Item No.","No.");
ItemUnitMeasure.SETRANGE(Code,'NOS');
IF ItemUnitMeasure.FINDFIRST THEN BEGIN
QuantityNo := CMQtyBase / ItemUnitMeasure."Qty. per Unit of Measure" * -1;
END;
EnterCell(i,17,FORMAT(QuantityNo),FALSE,FALSE);
EnterCell(i,18,FORMAT(QuantityKL),FALSE,FALSE);
EnterCell(i,19,FORMAT(NetAmt),FALSE,FALSE);
i+=1;
END;
I have tried:
1. Moving code to the dataitem's OnAftergetrecord() with the following
IF ISSERVICETIER THEN
code...
still i getting the data in the excel,excel is getting generated. But without any data.
There is a customized report, having code on OnPreSection() of the dataitem's body trigger.
The code is given below which does the insertion of data in excel:
IF COMPANYNAME = 'XYZ' THEN
SalesAmt :=SalesCrMemoLineAmount;
NetAmt := 0;
IF Customer.GET("Sales Cr.Memo Header"."Sell-to Customer No.") THEN
IF (CRSalesAmt <> 0) AND (Customer."Net Amount %" <> 0) THEN
NetAmt := (CRSalesAmt / Customer."Net Amount %") * 100;
IF CurrReport.SHOWOUTPUT AND ExportToXL THEN BEGIN
EnterCell(i,1,FORMAT("Document No."),FALSE,FALSE);
EnterCell(i,2,FORMAT("Sales Cr.Memo Header"."Posting Date"),FALSE,FALSE);
EnterCell(i,3,FORMAT("Sell-to Customer No."),FALSE,FALSE);
EnterCell(i,4,FORMAT("Sales Cr.Memo Header"."Sell-to Customer Name"),FALSE,FALSE);
EnterCell(i,5,FORMAT("No."),FALSE,FALSE);
EnterCell(i,6,FORMAT(Description),FALSE,FALSE);
EnterCell(i,7,FORMAT("Item Category Code"),FALSE,FALSE);
EnterCell(i,8,FORMAT(CRItemCatDesc),FALSE,FALSE);
EnterCell(i,9,FORMAT("Product Group Code"),FALSE,FALSE);
EnterCell(i,10,FORMAT("Sales Cr.Memo Header"."Ship-to Code"),FALSE,FALSE);
EnterCell(i,11,FORMAT("Sales Cr.Memo Header"."Ship-to Name"),FALSE,FALSE);
EnterCell(i,12,FORMAT(CRCountry),FALSE,FALSE);
IF COMPANYNAME = 'PMI' THEN
EnterCell(i,13,FORMAT(SalesCrMemoLineAmount),FALSE,FALSE)
ELSE
EnterCell(i,13,FORMAT(CRSalesAmt),FALSE,FALSE);
EnterCell(i,14,FORMAT(CRValueAmt),FALSE,FALSE);
EnterCell(i,16,FORMAT("Unit of Measure Code"),FALSE,FALSE);
EnterCell(i,15,FORMAT(CMQty * -1),FALSE,FALSE);
QuantityKL := 0;
ItemUnitMeasure.RESET;
ItemUnitMeasure.SETRANGE("Item No.","No.");
ItemUnitMeasure.SETRANGE(Code,'KL');
IF ItemUnitMeasure.FINDFIRST THEN BEGIN
QuantityKL := CMQtyBase / ItemUnitMeasure."Qty. per Unit of Measure" * -1;
END;
QuantityNo := 0;
ItemUnitMeasure.RESET;
ItemUnitMeasure.SETRANGE("Item No.","No.");
ItemUnitMeasure.SETRANGE(Code,'NOS');
IF ItemUnitMeasure.FINDFIRST THEN BEGIN
QuantityNo := CMQtyBase / ItemUnitMeasure."Qty. per Unit of Measure" * -1;
END;
EnterCell(i,17,FORMAT(QuantityNo),FALSE,FALSE);
EnterCell(i,18,FORMAT(QuantityKL),FALSE,FALSE);
EnterCell(i,19,FORMAT(NetAmt),FALSE,FALSE);
i+=1;
END;
I have tried:
1. Moving code to the dataitem's OnAftergetrecord() with the following
IF ISSERVICETIER THEN
code...
still i getting the data in the excel,excel is getting generated. But without any data.
0
Answers
-
Is this code generating data in classic client?0
-
Mohana,
Yes, it is.
And the companies in both classic and Rtc are also same.0 -
Can you add message statements in different places under If Conditions and check whether the code is executing in RTC or not..0
-
Yes it is working on Rtc, after generating the preview, Message pops up, with the corresponding values0
-
But the data is not flowing to the Excel.0
-
I have tried transferring the code to OnPostReport(),still the data is not moving to the Excel in Rtc. ](*,)0
-
probably the EnterCell function is working with file in some local path. In RTC, local path means a path on the machine that run the Service. Try to run the report on the machine that runs the NAVService to see if the function is actually do what it should.-Mihail- [MCTS]0
-
Hi Lamba
Section Level coding will not work on RTC reports You have to write the code at
onpredataitemtriger or on aftergetrecords
Regards
Akhilesh0 -
HI Mihail,
Can u please, tell me how can i identify the nav service in a machine.
Is it the service Named Microsoft Dynamics Nav server, running with my login id.0 -
HI Mihail,
Can u please, tell me how can i identify the nav service in a machine.
Is it the service Named Microsoft Dynamics Nav server, running with my login id.0 -
yes, this is the name of the service, but I'm talking about the service that RTC is connected to. You can check this in the RTC - Microsoft Dynamics NAV->Select Server-Mihail- [MCTS]0
-
Mihail,
It shows like localhost:7046/DynamicsNAV in RTC-> Microsoft Dynamics Nav-> Select server..
I think this is not the concern, its something related to code.0 -
well, let's say that the EnterCell function use some Automations. The CREATE method in RTC should be called with additional parameters like CREATE(xlAutomation,FALSE,ISSERVICETIER);-Mihail- [MCTS]0
-
well, let's say that the EnterCell function use some Automations. The CREATE method in RTC should be called with additional parameters like CREATE(xlAutomation,FALSE,ISSERVICETIER);
Mihail,
How could that be done.
as i have the Entercell code is on most of the section for Excel data entry.0 -
EnterCell looks like a single function (View->C/AL Globals->Functions tab, select the function and press F9). It's possible to use some Automation OR the Automation can be a Global variable. Check it where this automation is created, or post the code of the EnterCell function.-Mihail- [MCTS]0
-
Simple CurrReport.SHOWOUTPUT doesn't works for Rtc. I removed that part from the code.
And now the data is flowing into the excel for Rtc0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions