Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Download Int Table as Excel file into Appln Server FilePath(Background Job)

Former Member
0 Kudos

Hi,

I have a requirement of downloading Internal Table as Excel file into Appln Server FilePath which will be a Background Job.

Is there any Fuction Module to create excel file filling with contents of internal table, and posting it in a Application server File path.

I tried EXCEL_OLE_STANDARD_DAT but it works only when the file exist already.

Points will be rewarded for useful answers.

3 REPLIES 3

Former Member
0 Kudos

do like this..

OPEN DATASET file FOR INPUT IN TEXT MODE

ENCODING DEFAULT .

LOOP AT ITAB .

CASE COL.

WHEN 1.

OUTPUT+0(10) = ITAB-FIELD1.

WHEN 2 .

OUTPUT+10(10) = ITAB-FIELD2.

WHEN 3.

OUTPUT+20(10) = ITAB-FIELD3.

ENDCASE.

CLOSE DATASET file.

Former Member
0 Kudos

Hi Manikandan,

REPORT ZTEST.

data : begin of warea ,
            a type i,
            b type c, 
            m type i,
        end of warea.
Data : j type i.

Data itab like table of warea with header line.

j = 5 .

while j > 0.
itab-a = itab-a + 1.
itab-b = 'b'.
itab-m = itab-m + 1.
append itab.
j = j - 1.
endwhile.

OPEN DATASET dsn FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*" opens a file for writing; if the file is not thr in the working directory it will create one with the same name.*

LOOP AT itab.
concatenate itab-fname itab-lname itab-place into rec separated by space
.
TRANSFER rec TO dsn.
rec = ''.
ENDLOOP.
CLOSE DATASET dsn.

rec = ''.
OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT.
" opens the file for reading only.

*READ DATASET dsn INTO rec.


IF sy-subrc = 0.
message i005(zmsg_kunal).
ENDIF.

WHILE sy-subrc = 0.
WRITE / rec. READ DATASET dsn INTO rec.
ENDWHILE.

EXIT. 

CLOSE DATASET dsn.

Clemenss
Active Contributor
0 Kudos

Hi manikandan,

I'm afraid this will not be possible easily, because the application server does not have Excel installed and OLE will only work at your frontend.

You may create a tab-delimited file that can be read by excel.

Regards,

Clemens