04-19-2006 5:35 AM
Dear Friends,
We are having an Excel Sheet with 90 different columns. Now we want only 2 of the columns to be uploaded in the database tables. So, Plz tell me which function module will be suitable for this. And plz help me with the code also.
Thanks,
Nishant Jain
04-19-2006 6:08 AM
HI Nishu,
As suggested you can use ALSM_EXCEL_TO_INTERNAL_TABLE..
specify the filename..
the return internal table of type ALSMEX_TABLINE
WHICH HAS A FIELD <b>COL</b> which indicates the column
just loop at that itab chack if COL is <= 2 and put it into another itab..
this will have only first 2 columns from the excel..
if you dont get it .. just reply i'll get some sample code..
regards
satesh
04-19-2006 5:57 AM
04-19-2006 5:59 AM
Hello Nishu,
As want to update SAP tables from excel sheet then you need to write your custom code to do this. For uploading excel sheet into internal table you can use function modules 'WS_UPLOAD' or 'GUI_UPLOAD' depends on your SAP version. Then using UPDATE query you can updated that required 2 columns based on your requirements.
I hope this will help you to fix your issue.
04-19-2006 6:03 AM
hi
good
it is not possible to upload only 2 columns from an excel sheed.You can create another excel sheet for that 2 column and you can upload them using BDC call transation or session method or you can use GUI_UPLOAD function module.
Thanks
mrutyun
04-19-2006 6:08 AM
HI Nishu,
As suggested you can use ALSM_EXCEL_TO_INTERNAL_TABLE..
specify the filename..
the return internal table of type ALSMEX_TABLINE
WHICH HAS A FIELD <b>COL</b> which indicates the column
just loop at that itab chack if COL is <= 2 and put it into another itab..
this will have only first 2 columns from the excel..
if you dont get it .. just reply i'll get some sample code..
regards
satesh
04-19-2006 6:17 AM
Hi Nishu,
A sample for the same..
data it_excel like table of ALSMEX_TABLINE with header line.
here we retrieve only 2 cols directly..
now itab will contain only 2 cols of all rows seperated by comma ..
data str(1000).
data itab like table of str with header line.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = 'C:sample1.xls'
i_begin_col = 1
i_begin_row = 1
i_end_col = 2
i_end_row = 100
tables
intern = it_excel
.
LOOP AT it_excel.
AT NEW row.
CLEAR itab.
ENDAT.
IF itab IS INITIAL.
MOVE it_excel-value TO itab.
ELSE.
CONCATENATE itab ',' it_excel-value INTO itab.
ENDIF.
AT END OF row.
APPEND itab.
ENDAT.
ENDLOOP.
regards
satesh
05-06-2006 1:21 PM
Hi Satesh,
I tried your coding, however, function module 'ALSM_EXCEL_TO_INTERNAL_TABLE' is not available in our current CRM 4.0 system.
On which systems is this FM available?
Thanks & regards
Wolfgang