‎2007 Sep 24 8:30 AM
Hi,
I want to upload data from an Excel sheet into the database table I have recently created.
Is there a easy way of doing this?
Or should I write an ABAP Program?
Thanks in advance,
Dilek
‎2007 Sep 24 9:19 AM
There is an easy way for uploading data from flatfile into database table which is user-friendly.
The one and only <b>LSMW</b> (Legacy System Migration Workbench ) in Abap.
Go the transaction LSMW and enter a projectname, subproject name and object name and press enter. Go all the steps mentioned in it.
Please reward if helpful.
‎2007 Sep 24 8:32 AM
hi dilek
write an ABAP CODE ,
USE upload FM '"gui_upload".
regards
prajwal
‎2007 Sep 24 9:16 AM
To upload data from Excel into SAP:
Some of the Business functions (BAPI's / RFC unctions) offer data upload
The general tool in SAP for data upload is the Batch input / call transactons
<b>Hope this is helpful, Do reward</b>
‎2007 Sep 24 9:19 AM
There is an easy way for uploading data from flatfile into database table which is user-friendly.
The one and only <b>LSMW</b> (Legacy System Migration Workbench ) in Abap.
Go the transaction LSMW and enter a projectname, subproject name and object name and press enter. Go all the steps mentioned in it.
Please reward if helpful.
‎2007 Sep 24 9:45 AM
Hi,
It will be Ok with LSMW. Or else do the recording for SE16 and enter the test data in required fields and then write a simple BDC. Now execute that your data will be uploaded into table..
Hope this helps you. Reply for queries, shall post the updates.
Regards.
Kumar.
‎2007 Sep 24 9:53 AM
hi,
first upload data from excel into internal table. and use modify command to update datbase table
check this code
REPORT zmat_no message-id zebg.
TYPE-POOLS truxs.
TABLES:zmatnr.
DATA : itab LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
DATA row LIKE alsmex_tabline-row.
data : g_matnr like mara-matnr.
data : count type i.
data : itab_count type i.
data : gi_final like zmatnr occurs 0 with header line.
*data : begin of gi_final occurs 0,
mat_old like mara-matnr,
mat_new like mara-matnr,
end of gi_final.
***********************Selection Screen*************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETER : pfname LIKE rlgrap-filename OBLIGATORY.
select-options : records for count.
SELECTION-SCREEN END OF BLOCK b1.
*******************************************************************
*********************At Selection Screen*************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfname.
PERFORM search.
*******************************************************************
START-OF-SELECTION.
perform process.
form process.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = pfname
i_begin_col = 1
i_begin_row = 2
i_end_col = 12
i_end_row = 65000
TABLES
intern = itab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
describe table itab lines itab_count.
row = 1.
loop at itab.
if itab-row <> row.
append gi_final.
clear gi_final.
endif.
case itab-col.
when '1'.
CLEAR G_MATNR.
gi_final-OLD_MATNR = itab-value.
CONCATENATE 'NEW' gi_final-old_matnr INTO itab-value.
gi_final-new_MATNR = itab-value.
endcase.
row = itab-row.
append gi_final.
clear gi_final.
endloop.
CALL FUNCTION 'PROGRESS_INDICATOR'
EXPORTING
I_TEXT = 'File Has Been Successfully Uploaded from Workstation ' .
if not gi_final[] is initial.
if not records-low is initial .
if not records-high is initial.
records-high = records-high + 1.
DESCRIBE TABLE gi_final LINES count.
IF records-high < count.
DELETE gi_final FROM records-high TO count.
ENDIF.
IF records-low <> 1.
IF records-low <> 0.
DELETE gi_final FROM 1 TO records-low.
ENDIF.
ENDIF.
endif.
endif.
endif.
IF NOT GI_FINAL[] IS INITIAL.
CALL FUNCTION 'PROGRESS_INDICATOR'
EXPORTING
I_TEXT = 'Processing zmatnr table'
I_OUTPUT_IMMEDIATELY = 'X'.
if itab_count <> count.
*
message i000 with 'records are not matching'.
*
exit.
*
else.
modify zmatnr from table gi_final.
message i000 with 'data base table modified successfully'.
endif.
endif.
endform.
&----
*& Form search
&----
text
----
--> p1 text
<-- p2 text
----
FORM search .
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
CHANGING
file_name = pfname.
ENDFORM. " search
regards
siva
‎2007 Sep 24 10:16 AM
Check this:
<a href="/people/sap.user72/blog/2006/01/19/upload-data-from-multiple-worksheets-within-a-single-excel-file-into-internal-table-from-abap">/people/sap.user72/blog/2006/01/19/upload-data-from-multiple-worksheets-within-a-single-excel-file-into-internal-table-from-abap</a>