Application Development and Automation 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: 
Read only

Problem while using this fm

Former Member
0 Likes
799

Hi all,

iam using this fm for downloading in excel sheet.i want to download with header

how can i do that .header means headings(Eg:materia number etc..)

please send some simple pgm which download with header

CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'

EXPORTING

  • I_FIELD_SEPERATOR =

  • I_LINE_HEADER = 'ihiuhuih'

i_filename = p_file

i_appl_keep = ' '

TABLES

i_tab_sap_data = t_mara

  • CHANGING

  • I_TAB_CONVERTED_DATA =

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
666

after this FM you have to use GUI_DOWNLOAD FM to download the data

declare one more table it_temp and use that in 'SAP_CONVERT_TO_XLS_FORMAT'

type-pools : TRUXS.

data : it_temp type table of TRUXS_T_TEXT_DATA

<b>i_tab_sap_data = it_temp</b>

format the data and

then use GUI_DOWNLOAD FM

4 REPLIES 4
Read only

Former Member
0 Likes
666

Hi

Try below Simple Code...

PARAMETERS: p_file LIKE rlgrap-filename DEFAULT 'c:\tmp\test.xls'.

DATA: t100_Lines TYPE STANDARD TABLE OF t001 WITH DEFAULT KEY.

SELECT * FROM t001 INTO TABLE t100_Lines.

CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'

EXPORTING

i_filename = p_file

TABLES

i_tab_sap_data = t100_Lines.

1) In bove code try below :

<b>Passing I_LINE_HEADER = 'X' in the exporting parameters might help.</b>

OR

2) Populate i_output with the header values just before downloading excel, after downloading remove the line inserted.

t_mara-matnr = 'Material'.

t_mara-vendor = 'Vendor'.

insert i_output index 1.

call function 'sAP_CONVERT_TO_XLS_FORMAT'.

....

delete t_mara index 1.

Mark if helpful..I can give you more codes if you want

Regards

Tushar Mundlik

Message was edited by:

Tushar Mundlik

Message was edited by:

Tushar Mundlik

Message was edited by:

Tushar Mundlik

null

Read only

Former Member
0 Likes
667

after this FM you have to use GUI_DOWNLOAD FM to download the data

declare one more table it_temp and use that in 'SAP_CONVERT_TO_XLS_FORMAT'

type-pools : TRUXS.

data : it_temp type table of TRUXS_T_TEXT_DATA

<b>i_tab_sap_data = it_temp</b>

format the data and

then use GUI_DOWNLOAD FM

Read only

Former Member
0 Likes
666

Hi,

Check this code

TABLES: USR03,DD02L.

DATA: ZX030L LIKE X030L.

DATA BEGIN OF ZDFIES OCCURS 0.

INCLUDE STRUCTURE DFIES.

DATA END OF ZDFIES.

DATA: BEGIN OF FLDITAB OCCURS 0,

FLDNAME(11) TYPE C,

END OF FLDITAB.

DATA ITABUSR03 LIKE USR03 OCCURS 0 WITH HEADER LINE.

DATA TNAME LIKE DD02L-TABNAME.

SELECT * FROM USR03 INTO TABLE ITABUSR03.

TNAME = 'USR03'.

PERFORM GETFIELEDS.

PERFORM SHOW123.

********************************************

FORM GETFIELEDS.

CALL FUNCTION 'GET_FIELDTAB'

EXPORTING

LANGU = SY-LANGU

ONLY = SPACE

TABNAME = TNAME

WITHTEXT = 'X'

IMPORTING

HEADER = ZX030L

TABLES

FIELDTAB = ZDFIES

EXCEPTIONS

INTERNAL_ERROR = 01

NO_TEXTS_FOUND = 02

TABLE_HAS_NO_FIELDS = 03

TABLE_NOT_ACTIV = 04.

CASE SY-SUBRC.

WHEN 0.

LOOP AT ZDFIES.

FLDITAB-FLDNAME = ZDFIES-FIELDNAME.

APPEND FLDITAB.

ENDLOOP.

WHEN OTHERS.

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

with SY-SUBRC.

ENDCASE.

ENDFORM.

***********************************

FORM SHOW123.

CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'

EXPORTING

FILE_NAME = 'C:\USR03.XLS'

DATA_SHEET_NAME = 'USER LIST'

TABLES

DATA_TAB = ITABUSR03

FIELDNAMES = FLDITAB

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.

ENDFORM.

Reward points if it is helpful.

Regards,

Sangeetha.a

Read only

0 Likes
666

Hi Sangeetha,

im creating an ALV grid report to have the output downloaded to excel.

i need ur help on the use of FM MS_EXCEL_OLE_STANDARD_DAT

i need to create multiple sheets in the same excel file ....

total records 3 lakhs and each sheet in excel should contain 65000 records so that one excel sheet can hold 3 lakhs of data but in different sheets..

pls help me with some examples as im new to ABAP.