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

function module

Former Member
0 Likes
656

Is there any function module available for uploading data from excel to the internal table.

regards

mny

1 ACCEPTED SOLUTION
Read only

aris_hidalgo
Contributor
0 Likes
638

You can use FM GUI_UPLOAD. Just check it in SE37.

Hope it helps...

P.S. Please award points if it helps...

9 REPLIES 9
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
638

Hi,

Try TEXT_CONVERT_XLS_TO_SAP.

Regards,

Sesh

Read only

varma_narayana
Active Contributor
0 Likes
638

Hi

you can use

GUI_UPLOAD

or

ALSM_EXCEL_TO_INTERNAL_TABLE

<b>REWARD IF HELPFUL</b>

Read only

aris_hidalgo
Contributor
0 Likes
639

You can use FM GUI_UPLOAD. Just check it in SE37.

Hope it helps...

P.S. Please award points if it helps...

Read only

Former Member
0 Likes
638

Hi,

Try this

<b>ALSM_EXCEL_TO_INTERNAL_TABLE</b>

Regards,

LIJO

Read only

0 Likes
638

check this also,

ws_excel

Read only

RaymondGiuseppi
Active Contributor
0 Likes
638

You could try ALSM_EXCEL_TO_INTERNAL_TABLE

Regards

Read only

Former Member
0 Likes
638

Hi

You can upload data from presentation server to an internal table using gui_upload. Use gui_download to download from internal table to flat file.

Use fm ALSM_EXCEL_TO_INTERNAL_TABLE to upload data frm excel.

Use function module GUI_UPLOAD

The FILETYPE refer to the type of file format you need: For e.g 'WK1' - Excel format , 'ASC' - Text Format etc.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\test.csv'

FILETYPE = 'ASC'

TABLES

DATA_TAB = itab

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17.

Reward for all helpfull answers

Regards

Pavan

Read only

Former Member
0 Likes
638

Hi Here is complete Program using the FM GUI_UPLOAD to get Excel data into an internal table.

REPORT Z_EXCEL_TO_ITAB_ZDETDETAIL.

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

*"Table declarations...................................................

TABLES:

ZDETDETAIL. " Database table to be uploaded

"----


  • Data declaration of the structure to hold ZDETDETAIL data *

"----


DATA:

BEGIN OF FS_ZDETDETAIL,

CNT(3) TYPE C, " Client

DETCODE(15) TYPE C, " Det Code

DET_TIER TYPE C, " Det tier

GL_ACCOUNT(10) TYPE C, " Gl amount

OFFSET_ACCOUNT(10) TYPE C, " Offset Amount

END OF FS_ZDETDETAIL.

"----


  • Internal table to hold ZDETDETAIL data *

"----


DATA:

T_ZDETDETAIL LIKE STANDARD TABLE OF FS_ZDETDETAIL.

*"----


Function Module to upload ZDETDETAIL Data

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = <b>'D:\ZDET_DETAIL_2.TXT'</b>

FILETYPE = <b>'ASC'</b>

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = 'DAT'

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = T_ZDETDETAIL

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17

.

IF SY-SUBRC <> 0.

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

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

ENDIF. " IF SY-SUBRC <> 0.

LOOP AT T_ZDETDETAIL INTO FS_ZDETDETAIL.

WRITE:

/ FS_ZDETDETAIL-CNT,

FS_ZDETDETAIL-DETCODE,

FS_ZDETDETAIL-DET_TIER,

FS_ZDETDETAIL-GL_ACCOUNT,

FS_ZDETDETAIL-OFFSET_ACCOUNT.

ENDLOOP. " LOOP AT T_ZDETDETAIL...

LOOP AT T_ZDETDETAIL INTO ZDETDETAIL.

IF SY-TABIX GE 2.

  • DELETE ZDETDETAIL.

INSERT ZDETDETAIL.

ENDIF. " IF SY-TABIX GE 2.

ENDLOOP. " LOOP AT T_ZDETDETAIL

Regards,

Rama chary.Pammi

Read only

Former Member
0 Likes
638

Hi

see this program i am uploading data from excel sheet to internal table

by seaing this you will get total idea

ables : lfa1.
data : it_lfa1 type lfa1 occurs 1,
       wa_lfa1 type lfa1.
select-options : ven_no for lfa1-lifnr.
select lifnr
       name1
       ort01
       ort02
       begru  from lfa1 into corresponding fields of table it_lfa1 where lifnr in ven_no.


CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
*   BIN_FILESIZE                    =
    filename                        = 'C:sashisecel.xls'
*   FILETYPE                        = 'ASC'
*   APPEND                          = ' '
   WRITE_FIELD_SEPARATOR           = 'X'
*   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                        = it_lfa1
*   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
          .
IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


if sy-subrc = 0.
 message i001(zsd_mes).
endif.

reward if usefull