* value of excel-cell
types: ty_d_itabvalue type alsmex_tabline-value,
* internal table containing the excel data
ty_t_itab type alsmex_tabline occurs 0,
* line type of sender table
begin of ty_s_senderline,
line(4096) type c,
end of ty_s_senderline,
* sender table
ty_t_sender type ty_s_senderline occurs 0.
*
constants: gc_esc value '"'.
include lalsmexf01.
type-pools ole2.
start-of-selection.
parameters: filename like rlgrap-filename.
parameters: st_rw_s1 type i.
parameters: st_cl_s1 type i.
parameters: st_rw_s2 type i.
parameters: st_cl_s2 type i.
parameters: ed_rw_s1 type i.
parameters: ed_cl_s1 type i.
parameters: ed_rw_s2 type i.
parameters: ed_cl_s2 type i.
data: it_data1 type ty_t_itab.
data: it_data2 type ty_t_itab.
data: it_data_wa like line of it_data1.
* DATA DECLARATION
data: excel_tab type ty_t_sender,
excel_tab1 type ty_t_sender.
data: ld_separator type c.
data: application type ole2_object,
workbook type ole2_object,
sheet type ole2_object,
range type ole2_object,
worksheet type ole2_object.
data: h_cell type ole2_object,
h_cell1 type ole2_object.
data: ld_rc type i.
* MESSAGE DEFINATION
define m_message.
case sy-subrc.
when 0.
when 1.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
when others. raise upload_ole.
endcase.
end-of-definition.
* PARAMETER CHECK
if st_rw_s1 > ed_rw_s1.
raise inconsistent_parameters.
endif.
if st_cl_s1 > ed_cl_s1.
raise inconsistent_parameters.
endif.
if st_rw_s2 > ed_rw_s2.
raise inconsistent_parameters.
endif.
if st_cl_s2 > ed_cl_s2.
raise inconsistent_parameters.
endif.
class cl_abap_char_utilities definition load.
ld_separator = cl_abap_char_utilities=>horizontal_tab.
* OPENING EXCEL FILE
if application-header = space or application-handle = -1.
create object application 'Excel.Application'.
m_message.
endif.
call method of application 'Workbooks' = workbook.
m_message.
call method of application 'Workbooks' = workbook.
m_message.
call method of workbook 'Open' exporting #1 = filename.
m_message.
call method of application 'Worksheets' = sheet exporting #1 = 1.
m_message.
call method of application 'Worksheets' = sheet exporting #1 = 1.
m_message.
call method of sheet 'Activate'.
m_message.
get property of application 'ACTIVESHEET' = sheet.
m_message.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.