LV 2009 Dispose report leaves Excel in memory
Hello all,
I am hoping somebody can help, we think that the below problem is part of a larger problem where LV2009 is crashing on our server with memory is full errors.
In the attached vi which contains the excel portion of our larger vi with dummy data, it duplicates the issue where everything seems to run OK, but when you check windows task manager it appears the Excel is staying in memory after this executes. Despite the dispose report being at the end of the chain.
any help at all would be greatly appreciated.
thanks
Attachments:
test.vi 31 KB
test.xls 22 KB
See this thread.
Message Edited by PJS on 11-05-2009 12:51 PM
Paul <--Always Learning!!!
sense and simplicity.
Browse my sample VIs?
Similar Messages
-
Dispose Report.vi cannot release excel
HI.
This is my first time to use the sub vi to generate excel file.
I have used New report.vi and Dispose report.vi from the report generation kit but I can see from the Window Tast Manager, the excel .exe is stil running after the Dispose report.vi.As a result of that, I cannot see the excel file when my LabVIEW programme is running.
Actually is it normal for that ?
Thanks in advance.
IODear Brian K,
Thanks for your reply.
Actually I have used the VIs in the toolkit to generate the excel file.
My flow is : generate new excel file>make a new name to the worksheet to A>add a title to the data in sheet A>put the data in the worksheet A>save the file>select the other worksheet>name the worksheet to B>put some data to it>save the file>create graph >put data to graph>change the graph proporties>save the file>maxmize the excel window>dispose report.
I have setted the whole programme to be continously running.
What I suppposed is the excel file will be released after the first looping,then it will active again when the flow is reach to the VI to create excel file but in the real case, it doesn't behave like that.
So I don't know whether I have got anything wrong with my flow or it's normal for that in LabVIEW.
Thanks in advance,
Io Hui -
Build EXE error in excel dispose report
I have seen much discussion about path-relative-to-current vi problems when building EXE apps.
I am compiling an EXE which happens largely successfully, but when it encounters the Excel Dispose Report vi at the end of my Excel report creation section, it stops with 'error 7 at open vi reference in Dispose report ...excel quit vi ... file not found'. It works without a problem in the un-compiled version. I am just using the standard Excel Dispose Report vi out of the report generation library.
Can anyone enlighten me about how to clear this problem?
FredFred,
Did you include the dynamic VIs? See: http://digital.ni.com/public.nsf/allkb/C38CE3F30542D65B86256F0E00740DD8
More confirmation it is dynamic VI issue: http://digital.ni.com/public.nsf/allkb/8A0E6274D9BD7B1986256F62006AD402
Matthew Fitzsimons
Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison -
Dispose Report closes all Excel spreadsheets
With Report generation toolkit, I am creating an excel spreadsheet. I create a "New Report", do stuff and "Dispose Report". When I "Dispose Report", it closes ALL excel spreadsheets that are open, including ones that are not part of the LabVIEW application, with no warning. Is this correct? How do I avoid this annoying behavior?
Henry,
As Zvezdana mentioned the 1.0 version of the Report Generation Toolkit does work this way. Since that behavior isn't very desirable it has been changed in the 1.1 version of the toolkit which released in March. The new version only closes the report for the particular reference being disposed. You also have the option of not closing the report when you dispose the reference.
Kennon -
Fatal Error when exporting Report to Excel
Hi Everyone, I've been trying to export my report to excel. But I have exhausted all possible reasons and I just couldn't figure it out. Can someone please help me. Thanks in advance.
PROGRAM NAME : ZADC_PAYSUMNEW
REPORT ZADC_PAYSUMNEW
NO STANDARD PAGE HEADING
LINE-SIZE 450
LINE-COUNT 65 MESSAGE-ID zmes.
TABLE DECLARATION *
TABLES: cskt,
csks,
pa0009,
pcl1,
pcl2,
pernr,
t512t,
t549a,
t527x,
zhrprtype.
INFOTYPES DECLARATION
INFOTYPES: 0001, 0002.
INCLUDE DECLARATION
INCLUDE: rpc2rx00.
INCLUDE: rpc2rxx0.
INCLUDE: rpppxd00.
INTERNAL TABLE DECLARATION
DATA: BEGIN OF itab OCCURS 0,
khinr LIKE csks-khinr,
kostl LIKE p0001-kostl,
ltext(40),
p_date LIKE pc261-inper,
basic(7) TYPE p DECIMALS 2,
pera(7) TYPE p DECIMALS 2,
longp(7) TYPE p DECIMALS 2,
trall(6) type p decimals 2,
srvaw(6) TYPE p DECIMALS 2,
chall(7) TYPE p DECIMALS 2,
leave(7) TYPE p DECIMALS 2,
meal(7) TYPE p DECIMALS 2,
saldf(7) TYPE p DECIMALS 2,
sipps(7) TYPE p DECIMALS 2,
sipgs(7) TYPE p DECIMALS 2,
subs(7) TYPE p DECIMALS 2,
hzard(7) TYPE p DECIMALS 2,
lallw(7) TYPE p DECIMALS 2,
medps(7) TYPE p DECIMALS 2,
medgs(7) TYPE p DECIMALS 2,
pcontps(7) TYPE p DECIMALS 2,
pcontgs(7) TYPE p DECIMALS 2,
pagibps(6) TYPE p DECIMALS 2,
pagibgs(6) TYPE p DECIMALS 2,
lwop(7) TYPE p DECIMALS 2,
npay(7) TYPE p DECIMALS 2,
otime(7) TYPE p DECIMALS 2,
ec(7) TYPE p DECIMALS 2,
fr_date like sy-datum,
to_date like sy-datum,
END OF itab.
DATA: BEGIN OF jtab OCCURS 0,
khinr LIKE csks-khinr,
kostl LIKE p0001-kostl,
ltext(40),
basic(7) TYPE p DECIMALS 2,
pera(7) TYPE p DECIMALS 2,
longp(7) TYPE p DECIMALS 2,
trall(6) type p decimals 2,
srvaw(6) TYPE p DECIMALS 2,
chall(7) TYPE p DECIMALS 2,
leave(7) TYPE p DECIMALS 2,
meal(7) TYPE p DECIMALS 2,
saldf(7) TYPE p DECIMALS 2,
sipps(7) TYPE p DECIMALS 2,
sipgs(7) TYPE p DECIMALS 2,
subs(7) TYPE p DECIMALS 2,
hzard(7) TYPE p DECIMALS 2,
lallw(7) TYPE p DECIMALS 2,
medps(7) TYPE p DECIMALS 2,
medgs(7) TYPE p DECIMALS 2,
pcontps(7) TYPE p DECIMALS 2,
pcontgs(7) TYPE p DECIMALS 2,
pagibps(6) TYPE p DECIMALS 2,
pagibgs(6) TYPE p DECIMALS 2,
lwop(7) TYPE p DECIMALS 2,
npay(7) TYPE p DECIMALS 2,
otime(7) TYPE p DECIMALS 2,
ec(7) TYPE p DECIMALS 2,
END OF jtab.
DATA: it_list TYPE STANDARD TABLE OF itab WITH HEADER LINE.
CONSTANTS DECLARATION
CONSTANTS: basic TYPE pc207-lgart VALUE '0401',
basic2 TYPE pc207-lgart VALUE '0402',
basic3 TYPE pc207-lgart VALUE '0403',
PERA TYPE pc207-lgart VALUE '3104',
PERA2 TYPE pc207-lgart VALUE '3110',
longp TYPE pc207-lgart VALUE '1601',
longp2 TYPE pc207-lgart VALUE '1603',
trall TYPE pc207-lgart VALUE '3109',
srvaw TYPE pc207-lgart VALUE '2117',
leave TYPE pc207-lgart VALUE '2118',
chall TYPE pc207-lgart VALUE '3105',
chall2 TYPE pc207-lgart VALUE '3111',
chall3 TYPE pc207-lgart VALUE '3112',
meal TYPE pc207-lgart VALUE '3102',
saldf TYPE pc207-lgart VALUE '4103',
sipps TYPE pc207-lgart VALUE '/090',
sipps2 TYPE pc207-lgart VALUE '1121',
subs TYPE pc207-lgart VALUE '3101',
hzard TYPE pc207-lgart VALUE '1602',
lallw TYPE pc207-lgart VALUE '3103',
medps TYPE pc207-lgart VALUE '/313',
medgs TYPE pc207-lgart VALUE '/314',
pcontps TYPE pc207-lgart VALUE '/093',
pcontps2 TYPE pc207-lgart VALUE '1327',
pcontps3 TYPE pc207-lgart VALUE '1120',
pagibps TYPE pc207-lgart VALUE '/326',
pagibps2 TYPE pc207-lgart VALUE '1326',
lwop TYPE pc207-lgart VALUE '1102',
otime TYPE pc207-lgart VALUE '0101',
otime2 TYPE pc207-lgart VALUE '0102',
otime3 TYPE pc207-lgart VALUE '0103',
otime4 TYPE pc207-lgart VALUE '0104',
npay TYPE pc207-lgart VALUE '/559'.
DATA DECLARATION
DATA: BEGIN OF COMMON PART buffer.
INCLUDE: rpppxd10.
DATA: END OF COMMON PART buffer.
*Table data containing directory to PCL2 payroll results file DATA:
DATA: BEGIN OF rgdir OCCURS 100.
INCLUDE STRUCTURE pc261.
DATA: END OF rgdir.
DATA: BEGIN OF evpdir OCCURS 100.
INCLUDE STRUCTURE pc261.
DATA: END OF evpdir.
DATA: country LIKE t001p-molga,
lname LIKE t527x-orgtx,
filename2(128),
p_date LIKE pc261-inper,
w_basic LIKE pc207-lgart,
w_basic2 LIKE pc207-lgart,
w_basic3 LIKE pc207-lgart,
w_pera LIKE pc207-lgart,
w_pera2 LIKE pc207-lgart,
w_longp LIKE pc207-lgart,
w_longp2 LIKE pc207-lgart,
w_trall LIKE pc207-lgart,
w_srvaw LIKE pc207-lgart,
w_leave LIKE pc207-lgart,
w_chall LIKE pc207-lgart,
w_chall2 LIKE pc207-lgart,
w_chall3 LIKE pc207-lgart,
w_meal LIKE pc207-lgart,
w_saldf LIKE pc207-lgart,
w_sipps LIKE pc207-lgart,
w_sipps2 LIKE pc207-lgart,
w_subs LIKE pc207-lgart,
w_hzard LIKE pc207-lgart,
w_lallw LIKE pc207-lgart,
w_medps LIKE pc207-lgart,
w_medgs LIKE pc207-lgart,
w_pcontps LIKE pc207-lgart,
w_pcontps2 LIKE pc207-lgart,
w_pcontps3 LIKE pc207-lgart,
w_pagibps LIKE pc207-lgart,
w_pagibps2 LIKE pc207-lgart,
w_lwop LIKE pc207-lgart,
w_otime LIKE pc207-lgart,
w_otime2 LIKE pc207-lgart,
w_otime3 LIKE pc207-lgart,
w_otime4 LIKE pc207-lgart,
w_npay LIKE pc207-lgart,
tempgs(7) TYPE p DECIMALS 2,
ctr-basic(7) TYPE p DECIMALS 2,
ctr-pera(7) TYPE p DECIMALS 2,
ctr-longp(7) TYPE p DECIMALS 2,
ctr-trall(6) TYPE p DECIMALS 2,
ctr-srvaw(6) TYPE p DECIMALS 2,
ctr-leave(7) TYPE p DECIMALS 2,
ctr-chall(7) TYPE p DECIMALS 2,
ctr-meal(7) TYPE p DECIMALS 2,
ctr-saldf(7) TYPE p DECIMALS 2,
ctr-sipps(7) TYPE p DECIMALS 2,
ctr-sipgs(7) TYPE p DECIMALS 2,
ctr-subs(7) TYPE p DECIMALS 2,
ctr-hzard(7) TYPE p DECIMALS 2,
ctr-lallw(7) TYPE p DECIMALS 2,
ctr-medps(7) TYPE p DECIMALS 2,
ctr-medgs(7) TYPE p DECIMALS 2,
ctr-pcontps(7) TYPE p DECIMALS 2,
ctr-pcontgs(7) TYPE p DECIMALS 2,
ctr-pagibps(6) TYPE p DECIMALS 2,
ctr-pagibgs(6) TYPE p DECIMALS 2,
ctr-lwop(7) TYPE p DECIMALS 2,
ctr-otime(7) TYPE p DECIMALS 2,
ctr-npay(7) TYPE p DECIMALS 2,
ctr-ec(7) TYPE p DECIMALS 2.
DATA: BEGIN OF ph-version.
INCLUDE STRUCTURE pc201_pay. "XTWPH9K008656
DATA: END OF ph-version.
DATA: fr_date LIKE sy-datum,
to_date LIKE sy-datum.
SELECT-OPTIONS and PARAMETERS
SELECT-OPTIONS: p_status FOR rgdir-srtza DEFAULT 'A'.
DATA: DATE1(15),
mon(9).
DEFINITION
DEFINE rp-imp-c2-rx2.
clear:
orx-version, "OBJECTS_FOR_CLEAR
rt, rt[].
import
ph-version to orx-version "OBJECTS_FOR_IMPORT
rt
from database pcl2(ph) id rx-key using pcl2_exp_imp.
rp-imp-rx-subrc = sy-subrc.
if sy-subrc eq 0 and orx-version-number ne ph-version-number.
rp-imp-rx-subrc = 8.
endif.
END-OF-DEFINITION.
TYPE-POOLS: slis.
DATA: g_repid LIKE sy-repid,
gt_fieldcat TYPE slis_t_fieldcat_alv,
gt_events TYPE slis_t_event,
gt_top TYPE slis_t_listheader,
gt_eol TYPE slis_t_listheader,
gt_list_top_of_page TYPE slis_t_listheader,
gt_list_end_of_list TYPE slis_t_listheader,
gs_layout TYPE slis_layout_alv,
d_f2code LIKE sy-ucomm VALUE '&ETA'.
CONSTANTS: fn_top TYPE slis_formname VALUE 'TOP_OF_PAGE',
fn_eol TYPE slis_formname VALUE 'END_OF_LIST'.
DATA: it_alv_out TYPE STANDARD TABLE OF itab WITH HEADER LINE.
INITIALIZATION.
g_repid = sy-repid.
PERFORM f_fieldcat_init USING gt_fieldcat[].
PERFORM eventtab_build USING gt_events[].
START-OF-SELECTION.
START-OF-SELECTION.
fr_date = to_date = pn-endda.
fr_date+6(2) = '01'.
SELECT SINGLE * FROM t549a
WHERE abkrs = pnpxabkr.
GET PERNR.
CLEAR: itab, lname.
PERFORM get_rt_tab.
END-OF-SELECTION.
PERFORM display_grid.
INCLUDE rpppxm00.
USING DATM
FORM get_rt_tab *
FORM get_rt_tab.
rp_provide_from_last p0001 space pn-begda pn-endda.
rp_provide_from_last p0002 space pn-begda pn-endda.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = p0001-pernr
IMPORTING
molga = country
TABLES
in_rgdir = rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
IF sy-subrc = 0.
SELECT single ltext FROM cskt
INTO itab-ltext
WHERE kostl = p0001-kostl
AND datbi = '99991231'.
SELECT SINGLE * FROM csks
WHERE kostl = p0001-kostl
AND kokrs = 'GSIS'
AND datbi = '99991231'.
IF sy-subrc = 0.
MOVE: csks-kostl TO itab-kostl,
csks-khinr TO itab-khinr.
ENDIF.
p_date = pn-paper.
regular payroll run.
CALL FUNCTION 'CD_EVALUATION_PERIODS'
EXPORTING
bonus_date = '00000000'
inper_modif = t549a-permo
inper = p_date
pay_type = ' '
pay_ident = ' '
TABLES
rgdir = rgdir
evpdir = evpdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
IF sy-subrc = 0.
LOOP AT evpdir WHERE srtza IN p_status and FPPER eq pn-begda+(6).
rx-key-pernr = p0001-pernr.
rx-key-seqno = evpdir-seqnr.
rp-imp-c2-rx2.
IF rp-imp-rx-subrc = 0.
PERFORM rt_to_itab.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM.
FORM PRINT_RX *
FORM print_rx.
LOOP AT rt.
PERFORM re512t USING country rt-lgart.
ENDLOOP.
ENDFORM.
FORM RE512T *
--> VALUE(COUNTRY_GROUPING) *
--> VALUE(WTYPE) *
FORM re512t USING value(country_grouping)
value(wtype).
CHECK t512t-sprsl NE sy-langu
OR t512t-molga NE country_grouping
OR t512t-lgart NE wtype.
SELECT SINGLE * FROM t512t
WHERE sprsl EQ sy-langu
AND molga EQ country_grouping
AND lgart EQ wtype.
IF sy-subrc NE 0.
CLEAR t512t.
ENDIF.
ENDFORM.
FORM rt_to_itab *
FORM rt_to_itab.
MOVE: basic TO w_basic,
basic2 TO w_basic2,
basic3 TO w_basic3,
pera TO w_pera,
pera2 TO w_pera2,
longp TO w_longp,
longp2 TO w_longp2,
srvaw TO w_srvaw,
leave TO w_leave,
trall TO w_trall,
chall TO w_chall,
chall2 TO w_chall2,
chall3 TO w_chall3,
meal TO w_meal,
saldf TO w_saldf,
sipps TO w_sipps,
sipps2 TO w_sipps2,
subs TO w_subs,
hzard TO w_hzard,
lallw TO w_lallw,
medps TO w_medps,
medgs TO w_medgs,
pcontps TO w_pcontps,
pcontps2 TO w_pcontps2,
pcontps3 TO w_pcontps3,
pagibps TO w_pagibps,
pagibps2 TO w_pagibps2,
LWOP TO w_lwop,
otime TO w_otime,
otime2 TO w_otime2,
otime3 TO w_otime3,
otime4 TO w_otime4,
npay TO w_npay.
LOOP AT rt WHERE lgart = w_basic or lgart = w_basic2
or lgart = w_basic3.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-basic.
itab-ec = rt-betrg / 100.
if itab-ec > 100.
itab-ec = 100.
ENDIF.
ENDLOOP.
LOOP AT rt WHERE lgart = w_pera.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-pera.
ENDLOOP.
LOOP AT rt WHERE lgart = w_pera2.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-pera.
ENDLOOP.
LOOP AT rt WHERE lgart = w_longp or lgart = w_longp2.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-longp.
ENDLOOP.
LOOP AT rt WHERE lgart = w_trall.
if rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
endif.
ADD: rt-betrg TO itab-trall.
ENDLOOP.
LOOP AT rt WHERE lgart = w_srvaw.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-srvaw.
ENDLOOP.
LOOP AT rt WHERE lgart = w_leave.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-leave.
ENDLOOP.
LOOP AT rt WHERE lgart = w_chall or
lgart = w_chall2 or
lgart = w_chall3.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-chall.
ENDLOOP.
LOOP AT rt WHERE lgart = w_meal.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-meal.
ENDLOOP.
LOOP AT rt WHERE lgart = w_saldf.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-saldf.
ENDLOOP.
LOOP AT rt WHERE lgart = w_sipps or
lgart = w_sipps2.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-sipps.
itab-sipgs = itab-sipps / 9 * 12.
ENDLOOP.
LOOP AT rt WHERE lgart = w_subs.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-subs.
ENDLOOP.
LOOP AT rt WHERE lgart = w_hzard.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-hzard.
ENDLOOP.
LOOP AT rt WHERE lgart = w_lallw.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-lallw.
ENDLOOP.
LOOP AT rt WHERE lgart = w_medps.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-medps.
ENDLOOP.
LOOP AT rt WHERE lgart = w_medgs.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
MOVE: rt-betrg TO tempgs.
itab-medgs = itab-medps.
ENDLOOP.
LOOP AT rt WHERE lgart = w_pcontps OR
lgart = w_pcontps2 OR
lgart = w_pcontps3.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-pcontps.
ENDLOOP.
itab-pcontgs = itab-pcontps * 9.
LOOP AT rt WHERE lgart = w_pagibps OR
lgart = w_pagibps2.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-pagibps.
ENDLOOP.
LOOP AT rt WHERE lgart = w_pagibps.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-pagibgs.
ENDLOOP.
LOOP AT rt WHERE lgart = w_lwop.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-lwop.
ENDLOOP.
LOOP AT rt WHERE lgart = w_otime or
lgart = w_otime2 or
lgart = w_otime3 or
lgart = w_otime4.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-otime.
ENDLOOP.
LOOP AT rt WHERE lgart = w_npay.
IF rt-betrg < 0.
rt-betrg = abs( rt-betrg ).
ENDIF.
ADD: rt-betrg TO itab-npay.
ENDLOOP.
COLLECT itab.
CLEAR: itab.
REFRESH rt.
ENDFORM. " rt_to_itab
*& Form f_fieldcat_init
text
-->P_GT_FIELDCAT[] text
FORM f_fieldcat_init USING rt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 1.
ls_fieldcat-reptext_ddic = ' FXNAL Group'.
ls_fieldcat-fieldname = 'KHINR'.
ls_fieldcat-ref_tabname = 'ITAB'.
ls_fieldcat-outputlen = 12.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 2.
ls_fieldcat-reptext_ddic = ' OFFICE'.
ls_fieldcat-fieldname = 'LTEXT'.
ls_fieldcat-ref_tabname = 'ITAB'.
ls_fieldcat-outputlen = 40.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 3.
ls_fieldcat-reptext_ddic = ' RC #'.
ls_fieldcat-fieldname = 'KOSTL'.
ls_fieldcat-ref_tabname = 'ITAB'.
ls_fieldcat-outputlen = 5.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 4.
ls_fieldcat-reptext_ddic = 'Basic Salary'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'BASIC'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 5.
ls_fieldcat-reptext_ddic = 'PERA Allow'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'PERA'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 6.
ls_fieldcat-reptext_ddic = 'Longevity Pay'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'LONGP'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 7.
ls_fieldcat-reptext_ddic = 'Service Award'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'SRVAW'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 8.
ls_fieldcat-reptext_ddic = 'Child Allowance'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'CHALL'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 9.
ls_fieldcat-reptext_ddic = 'Leave Mone'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'LEAVE'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 10.
ls_fieldcat-reptext_ddic = 'Over-time'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'OTIME'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 11.
ls_fieldcat-reptext_ddic = 'Meal Subsidy'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'MEAL'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 12.
ls_fieldcat-reptext_ddic = 'Salary Diff.'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'SALDF'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 13.
ls_fieldcat-reptext_ddic = 'Subsistence'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'SUBS'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 14.
ls_fieldcat-reptext_ddic = 'Hazard Pay'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'HZARD'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 15.
ls_fieldcat-reptext_ddic = 'Laundry Allow'.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'LALLW'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
ENDFORM. " f_fieldcat_init
*& Form display_grid
text
--> p1 text
<-- p2 text
FORM display_grid.
SORT itab BY kostl khinr.
LOOP AT itab.
AT NEW khinr.
MOVE-CORRESPONDING itab TO jtab.
APPEND jtab.
ENDAT.
ENDLOOP.
PERFORM my_top USING gt_top[].
PERFORM build_layout USING gs_layout.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
TABLES
t_outtab = itab.
ENDFORM. " display_grid
*& Form eventtab_build
text
-->P_GT_EVENTS[] text
FORM EVENTTAB_BUILD USING my_events TYPE SLIS_T_EVENT.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 1
IMPORTING
et_events = my_events.
*TOP OF PAGE
READ TABLE my_events
WITH KEY NAME = slis_ev_top_of_page
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE fn_top TO ls_event-form.
APPEND ls_event TO my_events.
ENDIF.
CLEAR ls_event.
*END OF LIST
READ TABLE my_events
WITH KEY name = slis_ev_end_of_list
INTO ls_event.
IF sy-subrc = 0.
MOVE fn_eol TO ls_event-form.
APPEND ls_event TO my_events.
ENDIF. " SY-SUBRC for READ TABLE
ENDFORM. " eventtab_build
*& Form top_comment
text
-->P_MYTOP[] text
FORM top_comment USING my_top_of_page TYPE slis_t_listheader.
DATA: it_t247 LIKE t247 OCCURS 0 WITH HEADER LINE.
DATA: ls_line TYPE slis_listheader,
li_recs TYPE i,
lc_name(60) TYPE c,
lc_from(30) TYPE c,
lc_to(30) TYPE c.
CALL FUNCTION 'MONTH_NAMES_GET'
TABLES
month_names = it_t247.
Company Name
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = TEXT-001.
APPEND ls_line TO my_top_of_page.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-info = TEXT-002.
APPEND ls_line TO my_top_of_page.
Date
CLEAR lc_name.
CONCATENATE sy-datum+6(2) ',' INTO lc_name.
READ TABLE it_t247 WITH KEY mnr = sy-datum+4(2).
CONCATENATE text-003 it_t247-ltx lc_name sy-datum(4)
INTO lc_name SEPARATED BY space.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = lc_name.
APPEND ls_line TO my_top_of_page.
ENDFORM. " top_comment
*& Form build_layout
text
-->P_GS_LAYOUT text
FORM build_layout USING my_layout TYPE slis_layout_alv.
my_layout-f2code = d_f2code.
my_layout-reprep = 'X'.
my_layout-confirmation_prompt = 'X'.
my_layout-flexible_key = 'X'.
ENDFORM. " build_layout
*& Form TOP_OF_PAGE
Writes comments on top of page
FORM top_of_page.
DATA: ls_line TYPE slis_listheader,
lc_name(60) TYPE c.
IF sy-ucomm = '&RNT_PREV'.
READ TABLE gt_top INTO ls_line INDEX 2.
lc_name = ls_line-info.
WRITE 'Page:' TO lc_name+45(5).
WRITE sy-pagno TO lc_name+52(5).
ls_line-typ = 'H'.
ls_line-info = lc_name.
MODIFY gt_top FROM ls_line INDEX 2.
ENDIF.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_top.
ENDFORM. " TOP_OF_PAGE
*& Form my_top
text
-->P_GT_TOP[] text
FORM my_top USING top TYPE slis_t_listheader.
DATA: it_t247 LIKE t247 OCCURS 0 WITH HEADER LINE.
DATA: ls_line TYPE slis_listheader,
li_recs TYPE i,
lc_name(60) TYPE c,
lc_from(30) TYPE c,
lc_to(30) TYPE c.
CALL FUNCTION 'MONTH_NAMES_GET'
TABLES
month_names = it_t247.
Company Name
CLEAR lc_name.
WRITE text-001 TO lc_name.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = lc_name.
APPEND ls_line TO top.
**Report Name
CLEAR lc_name.
WRITE text-002 TO lc_name.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = lc_name.
APPEND ls_line TO top.
Range of date
CLEAR lc_name.
lc_name = p_date+4(2).
READ TABLE it_t247 WITH KEY mnr = p_date+4(2).
CONCATENATE: text-003 it_t247-ltx sy-datum(4)
INTO lc_name SEPARATED BY SPACE.
ls_line-typ = 'H'.
ls_line-info = lc_name.
APPEND ls_line TO top.
ENDFORM. " my_top
*& Form END_OF_LIST
Writes signature line at end of list
FORM end_of_list.
IF sy-ucomm = '&RNT_PREV' OR sy-ucomm = 'AUSW'.
REFRESH gt_eol.
PERFORM my_eol USING gt_eol[].
ELSE.
REFRESH gt_eol.
ENDIF.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_eol
i_end_of_list_grid = 'X'.
ENDFORM. " END_OF_LIST
*& Form my_eol
text
-->P_GT_EOL[] text
FORM my_eol USING eol TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader,
lc_name(60) TYPE c.
Signature Line
CLEAR lc_name.
lc_name = '.'.
ls_line-typ = 'H'.
ls_line-info = lc_name.
APPEND ls_line TO eol.
CLEAR lc_name.
ls_line-typ = 'H'.
ls_line-info = lc_name.
APPEND ls_line TO eol.
CLEAR ls_line.
ls_line-typ = 'H'.
WRITE 'Submitted By:' TO lc_name(28).
WRITE 'Noted By:' TO lc_name+30(28).
ls_line-info = lc_name.
APPEND ls_line TO eol.
CLEAR: lc_name, ls_line-key.
lc_name = '.'.
ls_line-typ = 'H'.
ls_line-info = lc_name.
APPEND ls_line TO eol.
CLEAR lc_name. CLEAR ls_line.
WRITE sy-uline(28) TO lc_name(28).
WRITE sy-uline(28) TO lc_name+30(28).
ls_line-typ = 'H'.
ls_line-info = lc_name.
APPEND ls_line TO eol.
ENDFORM. " my_eol1.U are not getting the data into Excel when u client Excel Buttton from the ALV display ?
2.if yes then u will get one message stating that templet is Missing like this ?
Regards
prabhu -
How to send ALV Report in excel format from SAP
Hi Gurus,
We are using SAP 4.7 and using different SAP reports.Now I want to send SAP ALV report in excel format directly from SAP in background.Now we send these reports in background weekly by using autimetic scheduling but this is PDF format.Now I want to change this pdf format to excel format.In SCOT T.Code I am able to find any excel format.Please help me out.
I am waiting for your reply.
Advance Thanks
NirmalHi Nirmal,
I have done the same in my previous organisation.For this particular solution you need to ask your basis guys to upgrade the support package so that BCS classes could be available in the system.
API interafces five some problem with attachemnts and SAP has recommended to use BCS classes.
Currently BCS classes won't be availbale in 4.7.
Once the BCS classes are available
use below code
CONSTANTS:
lc_tab TYPE c VALUE cl_bcs_convert=>gc_tab,
lc_crlf TYPE c VALUE cl_bcs_convert=>gc_crlf,
lc_codepage TYPE abap_encod VALUE '4103',
data :
lv_string TYPE string,
binary_content TYPE solix_tab,
size TYPE so_obj_len,
*" Set Heading of Excel File
CONCATENATE 'Employee DATA'
lc_crlf lc_crlf
INTO lv_string.
*" Set Header for Excel Fields
CONCATENATE lv_string
lc_header1 lc_tab
lc_header2 lc_tab
lc_header3 lc_tab
lc_header4 lc_tab
lc_header5 lc_tab
lc_header6 lc_tab
lc_header7 lc_tab
lc_header8 lc_tab
lc_header9 lc_tab
lc_header10 lc_crlf
INTO lv_string.
"lc_header1 to 10 could be your field headers
"Move Internal table data
LOOP AT gt_final1 INTO gwa_final1.
CONCATENATE lv_string
gwa_final1-field1 lc_tab
gwa_final1-field2 lc_tab
gwa_final1-field3 lc_crlf
INTO lv_string.
ENDLOOP.
*" convert the text string into UTF-16LE binary data including
*" byte-order-mark. Mircosoft Excel prefers these settings
*" all this is done by new class cl_bcs_convert (see note 1151257)
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = lv_string
iv_codepage = lc_codepage "suitable for MS Excel, leave empty
iv_add_bom = abap_true "for other doc types
IMPORTING
et_solix = binary_content
ev_size = size ).
CATCH cx_bcs.
MESSAGE e445(so).
ENDTRY.
TRY.
*" create persistent send request
send_request = cl_bcs=>create_persistent( ).
document = cl_document_bcs=>create_document(
i_type = lc_doc
i_text = main_text
i_subject = lc_sub ).
document->add_attachment(
i_attachment_type = lc_attach "#EC NOTEXT
i_attachment_subject = lc_sub "#EC NOTEXT
i_attachment_size = size
i_att_content_hex = binary_content ).
send_request->set_document( document ).
recipient = cl_cam_address_bcs=>create_internet_address( email ).
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient.
IF recipient IS NOT INITIAL.
sent_to_all = send_request->send( i_with_error_screen = abap_true ).
COMMIT WORK.
* MESSAGE text-014 TYPE gc_succ .
ENDIF.
CATCH cx_bcs INTO bcs_exception.
MESSAGE i865(so) WITH bcs_exception->error_type.
ENDTRY.
For BCS decalartion u can go to se 38 and see program BCS_EXAMPLE_1 to BCS_EXAMPLE_7.
Rewrads if helpful.
Cheers
Ramesh Bhatt -
Report in Excel format fails for huge amount of data with headers!!
Hi All,
I have developed an oracle report which fetches upto 5000 records.
The requirements is to fetch upto 100000 records.
This report fetches data if the headers are removed. If headers are given its not able to fetch the data.
Have anyone faced this issue??
Any idea to fetch huge amount of data by oracle report in excel format.
Thanks & Regards,
KP.Hi Manikant,
According to your description, the performance is slow when display huge amount of data with more than 3 measures into powerpivot, so you need the hardware requirements for build a PowerPivot to display huge amount of data with more than 3 measures, right?
PowerPivot benefits from multi-core processors, large memory and storage capacities, and a 64-bit operating system on the client computer.
Based on my experience, large memory, multiprocessor and even
solid state drives are benefit PowerPivot performance. Here is a blog about Memory Considerations about PowerPivot for Excel for you reference.
http://sqlblog.com/blogs/marco_russo/archive/2010/01/26/memory-considerations-about-powerpivot-for-excel.aspx
Besides, you can identify which query was taking the time by using the tracing, please refer to the link below.
http://blogs.msdn.com/b/jtarquino/archive/2013/12/27/troubleshooting-slow-queries-in-excel-powerpivot.aspx
Regards,
Charlie Liao
TechNet Community Support -
Dump in prodcution server while downloading ALV report to excel sheet
HI ALL,
ALV report is working fine in bother DEV and PROD servers....but in production while downloading report to excel sheet it is going to dump.
"dump is below:
Short text
Field symbol has not yet been assigned.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLKKBL" had to be terminated because it has
come across a statement that unfortunately cannot be executed. "
But in development this problem is not there, iam able to download ALV report to EXCEL sheet.
Any help experts......
Thanks in advance
RamHi,
I had the same problem,
Run a consistency check for your ALV and you will find out. See if you havent passed any unnecessary parameter to FM.
/people/rainer.hbenthal/blog/2009/09/25/sos--my-alv-report-is-not-working
Dump while printing ALV (field symbol not assigned)
Sumit -
Regarding download of the ALV report to excel
Hi experts,
I have an ALV report which took long time to extract records from various table. So while there is some restriction the report can be executed well in foreground. And the report can be extracted well to excel sheet. But while there is hudge records, i have to execute the report in backgroung. And then from spool i generally prefers to download the report to excel.
There is a field UOM where it contains value ' " ' for some records. And also there may be possiblity that other fields can also contain the same.
Now my problem is: while download to excel... When ever there is a value ' " ' from this point to the next value ' " '. It is treating as one record. and keep that in a same position in the excel sheet.
But i want to keep all the values in there respective fields. Can you please how can i do that? Please give me some solution...
regards,
charles.Actually now I think there is another way to do this, storing file on application server can create problems as sometimes the users don't have directory write access or things like that.
Instead you should export your data to a memory or database cluster and import it back using abother program.
The proposed changes would be
1: At the point you are calling your alv grid function, check if the sy-batch is 'X' for background job, if yes than export to database table INDX or you can create your own. suppose your data is in internal table ITAB than in case of background job, you will do
data: keyf like indx-srtfd.
*We just assign username, date time to this
concatenate sy-uname sy-datum sy-uzeit into keyf.
EXPORT itab TO DATABASE indx(ZZ) ID keyf.
check for subrc if export is successfull.
Now you have stored your itab in database for later processing. remember to have keyf. In case of background job you can have it write in the output so from spool output you can check what was the keyf to use.
You have to write another program to import itab from database and download it or display it.....
This program will have keyf as input parameter and you must define ITAB same as the orignal program.
parameters: p_keyf like like indx-srtfd.
import itab from database indx(ZZ) id keyf.
*Now you have itab. do whatever you want with it. download it using GUI_DOWNLOAD function or display it in an ALV grid.......
Hope you got the overall idea. -
How can i convert an alv report to excel using abap code?
Thank you very much, but how can i convert the alv list into internal table?
I am using this code but dont work
REPORT Z_SAMPLE.
TYPES tipoLinea(1024) TYPE c.
DATA: begin of TablaLinea occurs 0,
linea type tipoLinea,
END OF TablaLinea.
DATA lista LIKE abaplist OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'LIST_FREE_MEMORY'
TABLES
listobject = lista.
SUBMIT rhrhaz00
AND RETURN
EXPORTING LIST TO MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = lista
EXCEPTIONS
OTHERS = 1.
WRITE: / 'C:', SY-SUBRC.
perform save_ascii_list.
LOOP AT TablaLinea.
WRITE: / TablaLinea-linea.
ENDLOOP.
WRITE: / 'C:', SY-SUBRC.
* FUNCTION: save_ascii_list
form save_ascii_list.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = -1
TABLES listasci = TablaLinea
listobject = lista
EXCEPTIONS empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc <> 0. ENDIF.
endform.
Another question, this code is showing the alv list in the screen and i dont want to appear, just convert directly into internal table. How to do that? -
Steps to save a Query/Report as Excel file in Share folder
Hi,
I have a requirement where i need to schedule a BI report automatically on a daily basis and save it in a Sharepoint folder as a excel file. I have gone through the Forums but didnt get a clear idea on how to proceed this with. I read about RSCRM_BAPI transaction but i hope we need to do this manually to save the file each time. Also, in Broadcaster there are options only to send Email & save in Portal.
So, if anybody have idea on saving a Query/Report as excel file in a Share folder automatically, kindly help me in suggesting the steps to do this activity.
Regards,
MuraliHi
1. Create Three Floders in AL11 i.e. in Apllication Server. Eg Name it F1, F2 and F3.
2. First dump the .csv files into F1. (Name xyz.csv).
3. Then using UNIX/WINDOWS (depends on your OS) script , first check the file is there are not in F1, if yes then rename the file with date and time or date and transfer the files from F1 to F2 i.e xyz06032010.csv.
4. Then Create a small ABAP program to check the file in F2, if it is there then Trigger the Event, and using that event you execute teh PC.
5. Then using UNIX/WINDOWS (depends on your OS) script , transfer the files from F2 to F3 i.e xyz06032010.csv
6. Next day morning F1 and F2 are empty and F3 is having the backup files.
So use this method, I used the similar logic and it is working fine.
Timinings are importent i.e what time you need to dump the fule in F1 and what time you need to run UNIX/WINDOWS (depends on your OS) script , transfer the files from F1 to F2 and what time UNIX/WINDOWS (depends on your OS) script , transfer the files from F2 to F3.
OR
1. Create Two Floders in AL11 i.e. in Apllication Server. Eg Name it F1 and F2
2. First dump the .csv files into F1. (Name xyz.csv)
3. Then load the data using InfoPackage, through PC.
4. At the end of the load Attach a simple Program to Move the xyz.csv file from F1 to F2.
5. So next day the file will come to F1 and the it will load and at the end it will move to F2.
Else you can use simple one or two lines of UNIX/WINDOWS (depends on your OS) script to move the file from F1 to F2 , once you load is over.
While moving the file from F1 to F2 you can append the date at the end of the file and then move to F2, it is use full for future reference.
See Blogs and Article, similar logic...
https://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
How to transfer the Data from SAP-System to Non-SAP system without additional Cost/License
/people/surendrakumarreddy.koduru/blog/2009/03/11/how-to-transfer-the-data-from-sap-system-to-non-sap-system-without-additional-costlicense
To Check the Files/Reports in Application Server and Trigger Mail Alerts.
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/4096bf2d-bcea-2b10-4ab4-e0683830d9b2&overridelayout=true
Thanks
Reddy
Edited by: Surendra Reddy on Mar 12, 2010 6:41 AM -
Formatting problem in download report into EXCEL Sheet
I have requirement that the Column in the report have values as 1.50,1.5,3.50,when i'm downloading the report into Excel sheet,The values are rounded and appearing as 1.5,1.5,3.5.
Can anyone please let me know how to resolve this requirementhi,
1) Excel will not take zero's after decimal(1.50) it will roundup(1.5) the values.
2) you can do like in formula section use CAST(column_name as CHAR) and download it to excel then u will get the zero i think...i didn't tried
or Column properties--->Data format --> Select Number--->use 1000's Seperator for 1 decimal and save the report and download it
but it should work!
thanks,
saichand.v
Edited by: saichand on Oct 27, 2009 4:11 PM
Edited by: saichand on Oct 27, 2009 4:12 PM -
Environment:
Win 7 SP 1
Visual Studio Pro 2012 Update 4
Crystal Reports for Visual Studios Service Pack 10 (13.0.10.1385)
Report created in Crystal Reports XI Release 2 (11.5.8.826)
Targeting x86 .NET 4.0
Scenario:
We have a program that runs and creates a large number of reports before the process is ended. When running after many hours we'd get a Load report failed/Not enough memory of operation exception. I kept removing code and found i could reproduce just using the report.Load call. I simplified the report to a completely blank report to make sure it was nothing specific to a report I was loading. (Opened Crystal Reports XI Release 2, Save As, "Blank.rpt".). I then created, loaded, and disposed of this report in a loop. I was able to cause the same exception after 32,764 iterations on my machine. I also tried using .NET 3.5 same result. I added a counter to our main program and it also went through 32,764 report loads before the same exception was thrown. Main program uses 15 or so different reports with a variable number of subreports in each.
Sample Code to illustrate the problem:
I did this as a WinForms project since our main program is using winforms.
References added:
CrystalDecisions.CrystalReports.Engine
CrystalDecisions.ReportSource
CrystalDecisions.Shared
CrystalDecisions.Windows.Forms
using System;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
namespace CrystalTest
public partial class Form1 : Form
public Form1()
InitializeComponent();
int i = 0;
try
while (true)
i++;
ReportDocument report = new ReportDocument();
report.Load("Blank.rpt");
report.Close();
report.Dispose();
catch(Exception ex)
MessageBox.Show(i.ToString() + ex.Message);
Exception:
CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException (0x80041004):
Not enough memory for operation.
at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
at CrystalTest.Form1..ctor() in c:\Test Projects\CrystalTest\CrystalTest\Form1.cs:line 27int = Int32. No it's not the "counter" that's causing the problem. The max size of an int32 is far far larger than 32764.
I am disposing and cleaning up the datasets in the main app. That is why I didn't include them in this test; they aren't relevant.
I'm unsure why this test program is completely irrelevant. It throws the same exception, at the same count, as the main program. It does it in substantially less lines of code than our main program. I spent days running long tests to figure out exactly what I needed to make the problem appear so I could post a clean and precise post on these forums. I then created the test program to illustrate that.
The "real" code as I said does stuff in sections and in a certain order.
For each report I need to export based on rows in a table
1. Creates a new Report Document
2. Loads the report document with the report
3. Creates a dataset of the data to display
4. Calls SetDataSource
5. Calls Report.ExportToDisk
6. Disposes DataSets
7. Closes/Disposes Reports
To help isolate the problem I first took out the export to disk part (Step 5). The problem still occurred. I then took out everything related to our data. (Step 3, Step 4, Step 6). The problem still occurred. And yes I commented out this code in our main real program. This left me with:
1. Creates a new Report Document
2. Loads the report document with the report
7. Closes/Disposes Reports
At this point i had to prove it was not dependent on the report. This makes sure it's not a database connection, or pulling too much data into the report. The most efficient test for this is a blank report.
So my order of operations becomes...
1. Creates a new Report Document
2. Loads the report document with a blank report
7. Closes/Disposes Reports
So you'll see this is exactly why I wrote this test the way that I did.
I've had a run where it error on iteration 32761. My last runs have errored on 32764. I have had many runs over many weeks that all error with the same exception.
There are no temp files left behind, With a test running you can see the temp files being added but they are immediately removed. -
Issue while exporting report in Excel Format
Hello,
I am facing problem while exporting the report in Excel Format. After analysis, I think that it could be due to two reasons, either we are using wrong versions of Jars, or we are using wrong API. Here is the code, approaches and problems we are facing. Please help.
First approach we are using is:
// using basic API
import com.crystaldecisions.reports.sdk.ReportClientDocument;
// get client document from crystal report API and open the report by specifying the report name, with path
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open( reportPath, 0 );
// give chance to extending classes to configure the report document by POJO or by sql parameter etc, just adding the parameters infromation using ParameterFieldController
configureReportDocument( reportClientDoc, reportMetadata, reportData, reportContext );
// get data source of crystal report
Object reportSource = reportClientDoc.getReportSource();
// export the data - we have also tried with MSExcel format
ReportExportFormat exportFormat = ReportExportFormat.recordToMSExcel;
LOGGER.debug( "exportFormat[" + exportFormat + "]" );
ByteArrayInputStream byteArray = (ByteArrayInputStream) reportClientDoc.getPrintOutputController().export(
exportFormat );
Problem Faced: Specified Excel format is not supported.
Second Approach: We come to know that excel format is supported with new releases and with occa package.
Then we tried with import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument; It ask to set the ReportServer. When we are trying to set the server as
reportClientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);
Application is unable to find 'ReportClientDocument.inprocConnectionString' property. It seems like we are using some old jars. However we have downloaded the latest released jars for eclipse 2.
Please help for it. Issue is to export the report in excel format, which is currently working fine for PDF. If this problem is related to Jars, please suggest the path to download the latest jars. We also looking for the latest jars like rasapp and rascore etc. But these are not available with Crystal Report for Eclipse 2 release.
Waiting for urgent help. Thanks you..
Regards,
MohitHi,
Send me Environment Details .
Here is the code snippet for exporting report to excel format:
<%@ page import="com.crystaldecisions.sdk.occa.report.application.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.definition.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
<%@ page import="com.crystaldecisions.sdk.framework.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.managedreports.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%
String username ="Administrator";
String password ="";
String cmsname ="localhost:6400";
String Authen ="secEnterprise";
//connecting to Enterprise
IEnterpriseSession es = CrystalEnterprise.getSessionMgr().logon(username,password,cmsname,Authen);
//get the report App Factory form the Crystal Enterprise
IReportAppFactory appFactory = (IReportAppFactory) es.getService("","RASReportService");
//get the infostore service form the Crystal Enterprise
IInfoStore istore = (IInfoStore) es.getService("","InfoStore");
//get the report by name from crystal Enterprise
IInfoObjects iobjects = istore.query("Select * From CI_INFOOBJECTS Where SI_NAME = 'sampleramz2.rpt' and SI_INSTANCE = 0 ");
//open the report in the report doc object.
ReportClientDocument Doc = appFactory.openDocument((IInfoObject)iobjects.get(0), 0, Locale.ENGLISH);
// WORKING WITH THE PRINT OUTPUT CONTROLLER
//Use the report documents PrintOutputController to export the report to a ByteArrayInputStream
ByteArrayInputStream byteIS = (ByteArrayInputStream)Doc.getPrintOutputController().export(ReportExportFormat.recordToMSExcel);
// EXPORTING THE REPORT
//Create a byte[] (same size as the exported ByteArrayInputStream)
byte[] buf = new byte[2000 * 1024];
int nRead = 0;
//Set response headers to indicate pdf MIME type and inline file
response.reset();
response.setHeader("Content-disposition", "inline;filename=ramz");
response.setContentType("application/xls");
//Send the Byte Array to the Client
while ((nRead = byteIS.read(buf)) != -1)
response.getOutputStream().write(buf, 0, nRead);
//Flush the output stream
response.getOutputStream().flush();
//Close the output stream
response.getOutputStream().close();
%>
Let me know any information is needed,
Regards,
Rameez -
Need to convert AP Invoice Aging Report in Excel format
Hi,
Need to convert AP Invoice Aging Report in excel format..there was an existing Invoice Aging report in AP and that was in paper format. That we need to convert to rtf template..
There was an other concurrent program called 'Invoice Aging Report (XML) - Reserveed for future use', when i am using that rtf template..to get the report output it was taking more than 1 hr time.
1)Is there any way/patch to get that XML report to be used in 12.1.3 EBS version
2) is there any other way to get the report output faster.
Thanks..Hi,
When submitting the request, you may change the output to Excel and get the output in Excel. Otherwise as you mention if you getting the output in text format, you may download the text format and open the document in excel and use the delimitation to format in excel as per your requirement.
1)Is there any way/patch to get that XML report to be used in 12.1.3 EBS version
2) is there any other way to get the report output faster.
Is your statistics up to date, when did you last run gather schema statistics program in Sysadmin responsibility.
Also what is the record quantity that you are expecting here? Is date range parameter available in the report and if yes, did you try running the report for a day to check the output.
Thanks &
Best Regards,
Maybe you are looking for
-
I am unable to watch Youtube videos on Firefox ?
I don't know why I am unable to play Youtube videos on Firefox (this problem stated around mid Sept. 2014). I explored many solutions but in vain. Firefox/flash (I am not sure) is behaving weirdly, I found some solutions on 'Mozilla Support' when I a
-
Is there another way of connecting mail 5.1 to exchange 2003 other than DavMail?
I am using Entourage 2008 which works fine but is a bit dated now and ideally would like to use Mail 5.1 but from what I can gather DavMail only works where exchange has web access enabled unfortunately given that I have to access exchange via a VPN
-
How to distribute a form with multiple submit buttons?
I have a form that has multiple submit buttons depending on the information that is being entered and then who the information should go to. When I try to disbribute the form, I get an error message stating the following, "Acrobat is unable to distr
-
Hello, I'm in a process of upgrading R/3 4.6c system to ecc6. the upgrade is ran on windows server 2003 with sql server 2000. during the upgrade in phase - parconv_upg(already passed phase modprof_trans) the upgrade process stops with the following e
-
I am trying to apply a BPEL orchestration (11g PS2) to receive and process an outbound msg from Salesforce. Salesforce provides the wsdl for the outbound msg that Salesforce sends to my service. Alone, this is not a problem. However, circumstances re