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

excel sheet data upload

Former Member
0 Likes
880

Hi Guys,

how can we upload the data from excel to sap?

plz give me any code.

Thamks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
841

Check the other thread for answer and close this one.

8 REPLIES 8
Read only

Former Member
0 Likes
842

Check the other thread for answer and close this one.

Read only

Former Member
0 Likes
841

check these links

[link2|https://www.sdn.sap.com/irj/scn/advancedsearch?query=gui_upload&cat=sdn_all]

[link1|;

      • Search the forums before u post a question, somebody else might have got the problem earlier, that u r facing today. if problem persists... make a post.

Regards,

SAPient

Read only

Former Member
0 Likes
841

Hi bass................

Try to upload from excel using FM it using for mostly session method

'TEXT_CONVERT_XLS_TO_SAP

.

DATA : it_itab like it_mk01 occurs 0 ..

DATA : IT_TYPE TYPE TRUXS_T_TEXT_DATA.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP' (this is fm like gui_upload)

EXPORTING

I_FIELD_SEPERATOR = 'X'

I_LINE_HEADER = 'X'

I_TAB_RAW_DATA = IT_TYPE

I_FILENAME = P_FPATH

TABLES

I_TAB_CONVERTED_DATA = it_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.

Read only

Former Member
0 Likes
841

This message was moderated.

Read only

0 Likes
841
Easiest way to load any Excel file to any SAP module is using trasactionSHUTTLE application from Winshuttle.

i 'm not clear!

***ok got it! good one!

You are marketing that????

Regards,

Srinivas

Edited by: Srinivas Gummaluri on Nov 13, 2008 4:21 PM

Read only

Former Member
0 Likes
841

use the below FM "ALSM_EXCEL_TO_INTERNAL_TABLE"

Read only

Former Member
0 Likes
841
  • Excel sheet structure

DATA: BEGIN OF i_intern OCCURS 0.

INCLUDE STRUCTURE alsmex_tabline.

DATA: END OF i_intern.

*Pass Starting and ending column and rows

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = p_file

i_begin_col = p_col

i_begin_row = p_row

i_end_col = p_col1

i_end_row = p_row1

TABLES

intern = i_intern

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE e906 WITH text-003.

EXIT.

ELSE.

*move data to final internal table

LOOP AT i_intern.

CASE i_intern-col.

WHEN '1'.

it_docu1-dokar = i_intern-value.

WHEN '2'.

it_docu1-doktl = i_intern-value.

WHEN '3'.

it_docu1-dokvr = i_intern-value.

WHEN '4'.

it_docu1-dktxt = i_intern-value.

WHEN '5'.

it_docu1-stabk = i_intern-value.

WHEN '6'.

it_docu1-dwnam = i_intern-value.

WHEN '7'.

it_docu1-klart = i_intern-value.

WHEN '8'.

it_docu1-class = i_intern-value.

WHEN '9'.

it_docu1-kunnr = i_intern-value.

WHEN '10'.

it_docu1-dappl = i_intern-value.

ENDCASE.

AT END OF row.

APPEND it_docu1.

ENDAT.

ENDLOOP.

IF sy-subrc EQ 0.

LOOP AT it_docu1.

MOVE-CORRESPONDING it_docu1 TO wa_docu.

APPEND wa_docu TO it_docu.

CLEAR: wa_docu,it_docu1.

ENDLOOP.

ENDIF.

ENDIF.

Check This part of code. This was to upload data of 10 Fields.

Regards,

Krishna.

Read only

Former Member
0 Likes
841

Hi,

Use the following code:

call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'

exporting

filename = file

i_begin_col = '1'

i_begin_row = '1'

i_end_col = '100'

i_end_row = '5000'

tables

intern = xcel

exceptions

inconsistent_parameters = 1

upload_ole = 2

others = 3.

clear xcel-col.

loop at xcel.

case xcel-col.

when '0001'.

wa_flat-lifnr_001 = xcel-value. "ok

when '0002'.

wa_flat-bukrs_002 = xcel-value. "ok

when '0003'.

wa_flat-ekorg_003 = xcel-value. "ok

when '0004'.

wa_flat-ktokk_004 = xcel-value. "ok

when '0005'.

wa_flat-anred_005 = xcel-value. "ok

when '0006'.

wa_flat-name1_006 = xcel-value. "ok

when '0007'.

wa_flat-name2_006 = xcel-value. "ok

when '0008'.

wa_flat-sort1_007 = xcel-value. "ok

when '0009'.

wa_flat-str_suppl1 = xcel-value. "ok

when '0010'.

wa_flat-str_suppl2 = xcel-value. "ok

when '0011'.

wa_flat-street = xcel-value. "ok

when '0012'.

wa_flat-str_suppl3 = xcel-value. "ok

when '0013'.

wa_flat-location = xcel-value. "ok

when '0014'.

wa_flat-city2 = xcel-value. "ok

when '0015'.

wa_flat-post_code1 = xcel-value. "ok

when '0016'.

wa_flat-city1 = xcel-value. "ok

when '0017'.

wa_flat-country = xcel-value. "ok

when '0018'.

wa_flat-region = xcel-value. "ok

when '0019'.

wa_flat-langu = xcel-value. "ok

when '0020'.

wa_flat-tel_number = xcel-value. "ok

when '0021'.

wa_flat-tel_extens = xcel-value. "ok

when '0022'.

wa_flat-mob_number = xcel-value. "ok

when '0023'.

wa_flat-fax_number = xcel-value. "ok

when '0024'.

wa_flat-fax_extens = xcel-value. "ok

when '0025'.

wa_flat-smtp_addr = xcel-value. "ok

when '0026'.

wa_flat-akont_017 = xcel-value. "ok

when '0027'.

wa_flat-zuawa_018 = xcel-value. "ok

when '0028'.

wa_flat-zterm_019 = xcel-value. "ok

when '0029'.

wa_flat-j_1iexcd_020 = xcel-value. "ok

when '0030'.

wa_flat-j_1iexrn_021 = xcel-value. "ok

when '0031'.

wa_flat-j_1iexrg_022 = xcel-value. "ok

when '0032'.

wa_flat-j_1iexdi_023 = xcel-value. "ok

when '0033'.

wa_flat-j_1iexco_024 = xcel-value. "ok

when '0034'.

wa_flat-j_1icstno_025 = xcel-value. "ok

when '0035'.

wa_flat-j_1ilstno_026 = xcel-value. "ok

when '0036'.

wa_flat-j_1isern_027 = xcel-value. "ok

when '0037'.

wa_flat-j_1ipanno_028 = xcel-value. "ok

when '0038'.

wa_flat-waers_029 = xcel-value. "ok

when '0039'.

wa_flat-webre_030 = xcel-value. "ok

endcase.

at end of row.

append wa_flat to it_flat.

clear wa_flat.

endat.

endloop.

Thanks & regard