Application Development 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: 

how to uploat EXCEL data to BDC programing

Former Member
0 Kudos

hi,

how to uploat Excel data to BDC programing and also sheets?

thank you.

6 REPLIES 6

Former Member
0 Kudos

Hi,

U can upload data from the Excel sheet to the BDC program by using FM GUI_UPLOAD use this FM and pass the data from Excel sheet to internal table and use this internal table in BDC program

Simha_
Employee
Employee
0 Kudos

Hi,

check this code...

&----


*& Report ZNEGI6 *

*& *

&----


*& *

*& *

&----


REPORT ZNEGI6 .

data: itab like alsmex_tabline occurs 0 with header line.

TYPES: Begin of t_record,

name1 like itab-value,

name2 like itab-value,

age like itab-value,

End of t_record.

DATA: it_record type standard table of t_record initial size 0,

wa_record type t_record.

DATA: gd_currentrow type i.

*Selection Screen Declaration

*----


PARAMETER p_infile like rlgrap-filename .

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

*START OF SELECTION

call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'

exporting

filename = p_infile

i_begin_col = '1'

i_begin_row = '2' "Do not require headings

i_end_col = '14'

i_end_row = '31'

tables

intern = itab

exceptions

inconsistent_parameters = 1

upload_ole = 2

others = 3.

if sy-subrc <> 0.

message e010(zz) with text-001. "Problem uploading Excel Spreadsheet

endif.

  • Sort table by rows and colums

sort itab by row col.

  • Get first row retrieved

read table itab index 1.

  • Set first row retrieved to current row

gd_currentrow = itab-row.

loop at itab.

  • Reset values for next row

if itab-row ne gd_currentrow.

append wa_record to it_record.

clear wa_record.

gd_currentrow = itab-row.

endif.

case itab-col.

when '0001'. "First name

wa_record-name1 = itab-value.

when '0002'. "Surname

wa_record-name2 = itab-value.

when '0003'. "Age

wa_record-age = itab-value.

endcase.

endloop.

append wa_record to it_record.

*!! Excel data is now contained within the internal table IT_RECORD

  • Display report data for illustration purposes

loop at it_record into wa_record.

write:/ sy-vline,

(10) wa_record-name1, sy-vline,

(10) wa_record-name2, sy-vline,

(10) wa_record-age, sy-vline.

endloop.

This will give u idea of how to uplaod the data from excel to internal table and after that u can use ur BDC mechanism to fill ur fields..'

Cheers,

Simha.

<b>Reward Points If it is needful.</b>

Former Member
0 Kudos

HI

GOOD

YOU CAN VARIOUS PROCESS TO UPLOAD YOUR EXCEL DATA

1-CALL TRANSACTION

2-BDC SESSION

3-LSMW

4-IDOCS

5-BAPI

AS PER YOUR REQUIREMENT YOU CAN USE THEM.

THANKS

MRUTYUN

dani_mn
Active Contributor
0 Kudos

use the function module WS_UPLOAD to fill your internal table of same structure as excel file.

and then fill your BDC with this internal table using recording.

Former Member
0 Kudos

hi

use 'ALSM_EXCEL_TO_INTERNAL_TABLE'

regds

gunjan

Former Member
0 Kudos

thanks.