mibuso.com

Microsoft Business Solutions online community
It is currently Wed May 22, 2013 6:11 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [Solved] Rtc-Print Excel
PostPosted: Mon Feb 13, 2012 10:46 am 
Offline

Joined: Fri Jul 30, 2010 8:17 am
Posts: 227
Country: India (in)
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.


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Mon Feb 13, 2012 10:55 am 
Online
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
Is this code generating data in classic client?

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Mon Feb 13, 2012 10:57 am 
Offline

Joined: Fri Jul 30, 2010 8:17 am
Posts: 227
Country: India (in)
Mohana,

Yes, it is.
And the companies in both classic and Rtc are also same.


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Mon Feb 13, 2012 11:07 am 
Online
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
Can you add message statements in different places under If Conditions and check whether the code is executing in RTC or not..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Mon Feb 13, 2012 11:22 am 
Offline

Joined: Fri Jul 30, 2010 8:17 am
Posts: 227
Country: India (in)
Yes it is working on Rtc, after generating the preview, Message pops up, with the corresponding values


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Mon Feb 13, 2012 11:41 am 
Offline

Joined: Fri Jul 30, 2010 8:17 am
Posts: 227
Country: India (in)
But the data is not flowing to the Excel.


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Mon Feb 13, 2012 1:20 pm 
Offline

Joined: Fri Jul 30, 2010 8:17 am
Posts: 227
Country: India (in)
I have tried transferring the code to OnPostReport(),still the data is not moving to the Excel in Rtc. ](*,)


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Mon Feb 13, 2012 4:05 pm 
Offline

Joined: Thu Jan 29, 2009 5:06 pm
Posts: 351
Location: Sofia
Country: Bulgaria (bg)
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]


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Mon Feb 13, 2012 4:17 pm 
Offline

Joined: Tue Nov 17, 2009 10:30 am
Posts: 22
Location: Cochin
Country: India (in)
Hi Lamba
Section Level coding will not work on RTC reports You have to write the code at
onpredataitemtriger or on aftergetrecords


Regards
Akhilesh


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Tue Feb 14, 2012 4:01 pm 
Offline

Joined: Fri Jul 30, 2010 8:17 am
Posts: 227
Country: India (in)
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.


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Tue Feb 14, 2012 4:14 pm 
Offline

Joined: Fri Jul 30, 2010 8:17 am
Posts: 227
Country: India (in)
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.


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Tue Feb 14, 2012 5:41 pm 
Offline

Joined: Thu Jan 29, 2009 5:06 pm
Posts: 351
Location: Sofia
Country: Bulgaria (bg)
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]


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Wed Feb 15, 2012 7:06 am 
Offline

Joined: Fri Jul 30, 2010 8:17 am
Posts: 227
Country: India (in)
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.


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Wed Feb 15, 2012 12:46 pm 
Offline

Joined: Thu Jan 29, 2009 5:06 pm
Posts: 351
Location: Sofia
Country: Bulgaria (bg)
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]


Top
 Profile E-mail  
 
 Post subject: Re: Rtc-Print Excel
PostPosted: Thu Feb 16, 2012 10:32 am 
Offline

Joined: Fri Jul 30, 2010 8:17 am
Posts: 227
Country: India (in)
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.


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: mohana_cse06 and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: