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

upload

Former Member
0 Likes
692

hi how can we upload the data from an excel file into a internal table.

does gui_upload,ws_upload work if not how can we do this.

thanks,

vaasu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
675

Hi,

Use the FM

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = fpath "'c:\NON_STD.xls'

i_begin_col = 1

i_begin_row = 1

i_end_col = 100

i_end_row = 100

TABLES

intern = i_mail

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

Reward if useful

6 REPLIES 6
Read only

Former Member
0 Likes
676

Hi,

Use the FM

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = fpath "'c:\NON_STD.xls'

i_begin_col = 1

i_begin_row = 1

i_end_col = 100

i_end_row = 100

TABLES

intern = i_mail

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

Reward if useful

Read only

0 Likes
675

what we haver to do if the column nos is in alphabets.A,B,C etc..........

thnks,

Vaasu

Read only

0 Likes
675

>

> what we haver to do if the column nos is in alphabets.A,B,C etc..........

>

>

> thnks,

> Vaasu

HI,

you are uploading data from flat file to internal table and then to database.with the function module

ALSM_EXCEL_TO_INTERNAL_TABLE then you call this internal table and you will upload data to internal table.

with function module bdc_insert or with call transaction method we will upload data into database level.

regards,.

swami.

Read only

0 Likes
675

Hi

But my requirement is not like that

i have to get the data from excel sheet to internal table thats it.

but excel sheet contain columns A B etc..

thnks,

vaasu.

Read only

Former Member
0 Likes
675

Hi,

{*..............................................................

*: Description :

*: -


:

*: This is a simple example program to get data from an excel :

*: file and store it in an internal table. :

*: :

*: Author : www.sapdev.co.uk, based on code from Jayanta :

*: :

*: SAP Version : 4.7 :

*:............................................................:

REPORT zupload_excel_to_itab.

TYPE-POOLS: truxs.

PARAMETERS: p_file TYPE rlgrap-filename.

TYPES: BEGIN OF t_datatab,

col1(30) TYPE c,

col2(30) TYPE c,

col3(30) TYPE c,

END OF t_datatab.

DATA: it_datatab type standard table of t_datatab,

wa_datatab type t_datatab.

DATA: it_raw TYPE truxs_t_text_data.

  • At selection screen

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

field_name = 'P_FILE'

IMPORTING

file_name = p_file.

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

*START-OF-SELECTION.

START-OF-SELECTION.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

i_line_header = 'X'

i_tab_raw_data = it_raw " WORK TABLE

i_filename = p_file

TABLES

i_tab_converted_data = it_datatab[] "ACTUAL DATA

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

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

  • END-OF-SELECTION.

END-OF-SELECTION.

LOOP AT it_datatab INTO wa_datatab.

WRITE:/ wa_datatab-col1,

wa_datatab-col2,

wa_datatab-col3.

ENDLOOP.

}

Regards

Sudheer

Read only

Former Member
0 Likes
675

hi,

report zflatfile_upper_f4help.

*----


  • INTERNAL TABLE

*----


data: begin of wi_upp occurs 0,

text type string,

end of wi_upp.

data: begin of wi_upp1 occurs 0,

text1 type string,

end of wi_upp1.

*----


  • DATA

*----


data: var1 like rlgrap-filename.

data: var2 like rlgrap-filename.

data : name1 type string ,

name2 type string.

*&----


*& CALLING FUNCTIONAL MODULE 'KD_GET_FILENAME_ON_F4'

*&----


call function 'KD_GET_FILENAME_ON_F4'

exporting

program_name = syst-repid

dynpro_number = syst-dynnr

changing

file_name = var1.

if sy-subrc <> 0.

endif.

name1 = var1.

*&----


*& CALLING FUNCTIONAL MODULE 'GUI_UPLOAD'

*&----


call function 'GUI_UPLOAD'

exporting

filename = name1

filetype = 'ASC'

tables

data_tab = wi_upp.

loop at wi_upp.

write:/ wi_upp-text.

translate wi_upp-text to upper case.

append wi_upp to wi_upp1.

write:/ wi_upp-text.

endloop.

hope this helps u,

Regards,

Arunsri