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

BDC

Former Member
0 Likes
486

Hi all,

for running BDC i need to take flat file which is in Excel format. what Function module should be used and what parameters should be used. it'surgent.

Thanx in advance.

Kranthi

5 REPLIES 5
Read only

Former Member
0 Likes
470

HI Kranti,

First load the data from excel to some internal table.You can try using GUI_UPLOAD and then use this internal table in your BDC code.

Pls reward points if found useful.

Thanks

Shyam

Read only

Former Member
0 Likes
470

use GUI_UPLOAD.

save the file as text tab delimeter.

regards

shiba dutta

Read only

Former Member
0 Likes
470

Have a look to this Code..

data: begin of itab occurs 10,

casen type zsnitm-casen,

matnr type zsnitm-matnr,

fkimg type zsnitm-fkimg,

aufnr type zsnitm-aufnr,

netpr type zsnitm-netpr,

end of itab.

data w_p_infile type string.

w_p_infile = p_file.

call function 'GUI_UPLOAD'

exporting

filename = w_p_infile

filetype = 'ASC'

has_field_separator = 'X'

dat_mode = 'X'

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.

Read only

Former Member
0 Likes
470

kranti kumar,

use below FM

" ALSM_EXCEL_INTO_INTERNALTABLE"

( OR)

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

  • I_LINE_HEADER = 'X'

i_tab_raw_data = it_type

i_filename = p_file

tables

i_tab_converted_data = itab[]

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.

Pls. reward if useful

Read only

Former Member
0 Likes
470

hi,

when u take the spreadsheet as flatfile, make use of alsm_excel_to_internal table FM.

here we have parameters like ibegin_row,i_endrow_ etc.

this FM loads the data from excel sheet to itab.

if flatfile is .DAT format make use of ws_download to move the data from itab to PC.