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: 

Dowloading file into excel format from the application server

Former Member
0 Kudos
82

Hi Friends,

I am Dowloading file into excel format from the application server.

In my concatenate statement I am using "SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB", here the output in the excel file is coming by separate tab but Directory name, header and values all are coming in a single line.

Could u plz temm me why it was coming like that? what can i do to get into separate row ? (Now all r in single row).

It is there the problem with transfer the file from T-code AL11 (or) i need to do any code change for this???

Thanks in Advance,

Magesh.s

3 REPLIES 3

Former Member
0 Kudos
53

0 Kudos
53

Hi,

I want to move the file from AL11 into speerd sheet.

By, List -> send -> File -> select 'spreadsheet'

then in that excel sheet I am getting all the values in single row (ie. Directory name, Header and the field values)

plz guid me in this...

thanks and regards,

Magesh.S

Former Member
0 Kudos
53

hi friend

this code will be help for you

Parameters: P_file like RLGRAP-FILENAME.

data : begin of int_head occurs 0,

Filed1(20) type c, " Header Data

end of int_head.

data : begin of int_data occurs 0,

Field1(20) type c, " Data

Field2(20) type c,

Field3(20) type c,

Field4(20) type c,

end of int_data.

int_head-Filed1 = 'Sales Ord'.

APPEND int_head.

CLEAR int_head.

int_head-Filed1 = 'Sold-to-Party'.

APPEND int_head.

CLEAR int_head.

int_head-Filed1 = 'Purchase Ord'.

APPEND int_head.

CLEAR int_head.

int_head-Filed1 = 'Ship-to-Party'.

APPEND int_head.

CLEAR int_head.

int_data-field1 = '1JOHN'.

int_data-field2 = '2TOM'.

int_data-field3 = '3BRAD'.

int_data-field4 = '4PETER'.

Append int_data.

Clear int_data.

CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'

EXPORTING

file_name = p_file " path offile where u need to download

  • CREATE_PIVOT = 0

  • DATA_SHEET_NAME = ' '

  • PIVOT_SHEET_NAME = ' '

  • PASSWORD = ' '

  • PASSWORD_OPTION = 0

TABLES

  • PIVOT_FIELD_TAB =

data_tab = int_data "internal table with data

fieldnames = int_head "internal table with header

EXCEPTIONS

file_not_exist = 1

filename_expected = 2

communication_error = 3

ole_object_method_error = 4

ole_object_property_error = 5

invalid_filename = 6

invalid_pivot_fields = 7

download_problem = 8

OTHERS = 9

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.