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

Replacement for Function Module 'SEND_TABLE_TO_EXCEL' in ECC 6.0

Former Member
0 Likes
855

Hi Friends,

Can anybody help me to find the replacement of Function Module <b>'SEND_TABLE_TO_EXCEL'</b> in ECC 6.0.

The Function Module exists in 4.6b. But it is no longer available in ECC 6.0.

Regards,

Vaitheeswaran.

6 REPLIES 6
Read only

Former Member
0 Likes
696

Hi

u can use ALSM_EXCEL_TO_INTERNAL_TABLE function

regards

Pulkit Agrawal

Read only

Former Member
0 Likes
696

If you want to download an internal table to excel format you can use the <b>"GUI_DOWNLOAD"</b> function.Some sample code is as below.

types: begin of gs_xcel,

vkorg type vbak-vkorg,

del1(1) type c,

vtweg type vbak-vtweg,

del2(1) type c,

zzposmgr type zzsdacspo-zzposmgr,

del3(1) type c,

zz_region type zzsdaregn-zz_region,

del4(1) type c,

ename2 type pa0001-ename,

del5(1) type c,

zzcsospos type vbak-zzcsospos,

del6(1) type c,

ename type pa0001-ename,

del7(1) type c,

vbeln type vbfs-vbeln,

del8(1) type c,

text type t100-text,

del9(1) type c,

msgv1 type vbfs-msgv1,

del10(1) type c,

auart type vbak-auart,

del11(1) type c,

erdat type vbsk-erdat,

del12(1) type c,

wadat_ist type likp-wadat_ist,

end of gs_xcel.

data: gt_xcel type table of gs_xcel,

gws_xcel type gs_xcel.

data: v_tmp_name type string,

v_tmp_name = 'c:\sdrinver.xls'.

call function 'GUI_DOWNLOAD'

exporting

  • BIN_FILESIZE =

filename = v_tmp_name

FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = ','

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

tables

data_tab = gt_xcel

  • FIELDNAMES =

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22

Read only

0 Likes
696
i think this  fm  is  used  for download data with header line .
in place  of  this  u can use gui_upload.

ex---
DATA : ITAB TYPE MARA OCCURS 0 WITH HEADER LINE.
 
SELECT * INTO ITAB
         FROM MARA
         UP TO 10 ROWS.
         APPEND ITAB.
ENDSELECT.
 
DATA : BEGIN OF ITAB1 OCCURS 0,
         LINE(50) TYPE C,
       END OF ITAB1.
 
ITAB1-LINE = 'field1 description'.
APPEND ITAB1.
ITAB1-LINE = 'field2 desc'.
APPEND ITAB1.
ITAB1-LINE = 'field3 desc'.
APPEND ITAB1.
*--and so on you have to add up the records in itab1.
 
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    FILENAME                        = 'c:abc.xls'
   FILETYPE                        = 'ASC'
   WRITE_FIELD_SEPARATOR           = 'X'
* IMPORTING
*   FILELENGTH                      =
  TABLES
    DATA_TAB                        = ITAB
   FIELDNAMES                      = ITAB1
 EXCEPTIONS
   FILE_WRITE_ERROR                = 1
   NO_BATCH                        = 2
   GUI_REFUSE_FILETRANSFER         = 3
   INVALID_TYPE                    = 4
   NO_AUTHORITY                    = 5
   UNKNOWN_ERROR                   = 6
   HEADER_NOT_ALLOWED              = 7
   SEPARATOR_NOT_ALLOWED           = 8
   FILESIZE_NOT_ALLOWED            = 9
   HEADER_TOO_LONG                 = 10
   DP_ERROR_CREATE                 = 11
   DP_ERROR_SEND                   = 12
   DP_ERROR_WRITE                  = 13
   UNKNOWN_DP_ERROR                = 14
   ACCESS_DENIED                   = 15
   DP_OUT_OF_MEMORY                = 16
   DISK_FULL                       = 17
   DP_TIMEOUT                      = 18
   FILE_NOT_FOUND                  = 19
   DATAPROVIDER_EXCEPTION          = 20
   CONTROL_FLUSH_ERROR             = 21
   OTHERS                          = 22
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Read only

anversha_s
Active Contributor
0 Likes
696

hi,

chk this.

REPORT ZSRIM_GUI_DOWNLOAD_TO_EXCEL.

data : itab type mara occurs 0 with header line.

select * into itab

from mara

up to 10 rows.

append itab.

endselect.

data : begin of itab1 occurs 0,

line(50) type c,

end of itab1.

itab1-line = 'field1 description'.

append itab1.

itab1-line = 'field2 desc'.

append itab1.

itab1-line = 'field3 desc'.

append itab1.

*--and so on you have to add up the records in itab1.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE = ' '

  • CODEPAGE = ' '

FILENAME = 'C:\ABCD.XLS '

FILETYPE = 'DAT'

  • MODE = ' '

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH = FILELENGTH

TABLES

DATA_TAB = ITAB

FIELDNAMES = ITAB1

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

INVALID_FILESIZE = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

rgrds

anver

Read only

Former Member
696

Hi,

This Function Module actually transfers data from a Database Table to an Excel Sheet.

Regards,

Vaitheeswaran.

Read only

0 Likes
696

great answer!