09-08-2009 10:18 AM
Hi All,
I am using the FM "XXL_SIMPLE_API" to export the alv report ( which is done using "reuse_alv_grid_display" FM ).
In that I want to send the data which we generally show using the "top_of_page" event of the ALV.
This data I passed to the table "XMPLT_O" . but no data is coming in the Excel file.
Please help me to sort out this problem.
thanks in advance.
Rgds,
MadhuriG
09-08-2009 10:30 AM
you don't pass correct parameters to XXL_SIMPLE_API. So could you show and explain us your code. Please do a preview before you post so that it appears well formatted. Thx
09-08-2009 10:30 AM
you don't pass correct parameters to XXL_SIMPLE_API. So could you show and explain us your code. Please do a preview before you post so that it appears well formatted. Thx
09-08-2009 10:56 AM
I am using program "XXLSTEST" for reference.
XMPLT_O-LINE_NO = 1.
XMPLT_O-INFO_NAME = 'Plant'.
XMPLT_O-INFO_VALUE = T001W-NAME1..
append XMPLT_O.
XMPLT_O-LINE_NO = 2.
XMPLT_O-INFO_NAME = 'Year period'.
XMPLT_O-INFO_VALUE = S_YEAR-LOW.
append XMPLT_O.
XMPLT_P-HF = 'H'.
XMPLT_P-LCR = 'L'.
XMPLT_P-LINE_NO = 1.
XMPLT_P-TEXT = 'Periodical Report:'.
append XMPLT_P.
XMPLT_H-ROW_NO = 1.
XMPLT_H-COL_NO = 1.
XMPLT_H-COL_NAME = 'Plant'.
append XMPLT_H.
XMPLT_H-COL_NO = 3.
XMPLT_H-COL_NAME = T001W-NAME1.
append XMPLT_H.
W_CNT = W_CNT + 1.
XMPLT_V-COL_NO = W_CNT.
XMPLT_V-COL_NAME = 'Material'.
append XMPLT_V.
W_CNT = W_CNT + 1.
XMPLT_V-COL_NO = W_CNT.
XMPLT_V-COL_NAME = 'Material Description'.
append XMPLT_V.
W_CNT = W_CNT + 1.
XMPLT_V-COL_NO = W_CNT.
XMPLT_V-COL_NAME = 'Plant'.
append XMPLT_V.
call function 'XXL_SIMPLE_API'
exporting
N_KEY_COLS = 4
FILENAME = 'XMPL0002'
HEADER = XMPL_HEADER
tables
DATA = IT_GROSS_DATA_DTLS
ONLINE_TEXT = XMPLT_O
PRINT_TEXT = XMPLT_P
COL_TEXT = XMPLT_V
exceptions
DIM_MISMATCH_DATA = 71
FILE_OPEN_ERROR = 72
FILE_WRITE_ERROR = 73
INV_WINSYS = 74
INV_XXL = 75.
Edited by: madhuri sonawane on Sep 8, 2009 3:27 PM
09-08-2009 6:52 PM
09-09-2009 6:00 AM
Hi Sandra,
Can we do this using OLE objects,.
Hi,<br />
Please find the code below. My requirement is to convert the number field into "number" format from the "format cell" option,<br />
But its not working . Please help me.<br />
<br />
<pre class="jive-pre"><code class="jive-code jive-java">
REPORT YTESTMAD_002.
<font color="navy"><b>this</b></font> report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
include ole2incl.
handles <font color="navy"><b>for</b></font> OLE objects
data: h_excel type ole2_object, <font color="red">" Excel object</font>
h_mapl type ole2_object, <font color="red">" list of workbooks</font>
h_map type ole2_object, <font color="red">" workbook</font>
h_zl type ole2_object, <font color="red">" cell</font>
h_f type ole2_object, <font color="red">" font</font>
h_c type ole2_object, <font color="red">" color</font>
h_n type ole2_object. <font color="red">"numeric</font>
DATA: FILENAME LIKE RLGRAP-FILENAME.
tables: spfli.
data h type i.
table of flights
data: it_spfli like spfli occurs 10 with header line.
&----
*& Event START-OF-SELECTION
&----
start-of-selection.
read flights
tell user what is going on
call function <font color="navy">'SAPGUI_PROGRESS_INDICATOR'</font>
exporting
PERCENTAGE = 0
text = text-007
exceptions
others = 1.
start Excel
create object h_excel <font color="navy">'EXCEL.APPLICATION'</font>.
PERFORM ERR_HDL.
set property of h_excel <font color="navy">'Visible'</font> = 1.
CALL METHOD OF H_EXCEL <font color="navy">'FILESAVEAS'</font> EXPORTING #1 = <font color="navy">'c:\kis_excel.xls'</font> .
PERFORM ERR_HDL.
tell user what is going on
call function <font color="navy">'SAPGUI_PROGRESS_INDICATOR'</font>
exporting
PERCENTAGE = 0
text = text-008
exceptions
others = 1.
get list of workbooks, initially empty
call method of h_excel <font color="navy">'Workbooks'</font> = h_mapl.
perform err_hdl.
add a <font color="navy"><b>new</b></font> workbook
call method of h_mapl <font color="navy">'Add'</font> = h_map.
perform err_hdl.
tell user what is going on
call function <font color="navy">'SAPGUI_PROGRESS_INDICATOR'</font>
exporting
PERCENTAGE = 0
text = text-009
exceptions
others = 1.
output column headings to active Excel sheet
perform fill_cell using 1 1 1 200 <font color="navy">'35.89'</font>(001) <font color="navy">'Number'</font>.
EXCEL FILENAME
CONCATENATE SY-REPID <font color="navy">'_'</font> SY-DATUM6(2) <font color="navy">'_'</font> SY-DATUM4(2) <font color="navy">'_'</font>
SY-DATUM(4) <font color="navy">'_'</font> SY-UZEIT <font color="navy">'.XLS'</font> INTO FILENAME.
CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
free object h_excel.
perform err_hdl.
----
FORM FILL_CELL *
----
sets cell at coordinates i,j to value val boldtype bold *
----
form fill_cell using i j bold col val format.
call method of h_excel 'Cells' = h_zl
exporting
#1 = i
#2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Italic' = bold .
perform err_hdl.
set property of h_f 'Color' = col.
perform err_hdl.
get property of h_zl 'font' = h_n.
perform err_hdl.
set property of h_n 'Number' = 1.
perform err_hdl.
endform. "FILL_CELL
&----
*& Form ERR_HDL
&----
outputs OLE error if any *
----
--> p1 text
<-- p2 text
----
form err_hdl.
if sy-subrc <> 0.
write: / 'OLE-Automation Error:'(010), sy-subrc.
stop.
endif.
endform. " ERR_HDL
09-09-2009 10:30 AM
>
> perform fill_cell using 1 1 1 200 <font color="navy">'35.89'</font>(001) <font color="navy">'Number'</font>.
...
> set property of h_n 'Number' = 1.
why do you need to translate 35.89 ? (you used text symbol 001)
you must use set property of h_zl 'NumberFormat' = '#.####0'.
09-09-2009 12:25 PM