Posted: Mon Aug 12, 2013 7:35 pm Post subject: Загрузка значений в EXCEL.
Не могу понять почему в Excel создается только один лист, цикл проходит 2 раза. Документ создается после первого прохода и больше ничего не происходит. Подскажите, пожалуйста, где может быть ошибка.
INCLUDE ole2incl.
DATA :lh_excel TYPE ole2_object,
lh_mapl TYPE ole2_object,
lh_map TYPE ole2_object,
lh_sheet TYPE ole2_object,
lh_cells TYPE ole2_object,
lh_column TYPE ole2_object.
DATA: lt_val TYPE TABLE OF string.
DATA : lv_row TYPE i,
lv_col TYPE i,
l_path TYPE string.
DATA name TYPE string.
DATA l_list TYPE i.
CREATE OBJECT lh_excel 'EXCEL.APPLICATION'.
SET PROPERTY OF lh_excel 'Visible' = 1.
CALL METHOD OF lh_excel 'WORKBOOKS' = lh_mapl.
CALL METHOD OF lh_mapl 'ADD' = lh_map.
DO 2 TIMES.
l_list = sy-index.
IF l_list = 1.
name = 'List1'.
ELSE.
name = 'List2'.
ENDIF.
CALL METHOD OF lh_excel 'WORKSHEETS' = lh_sheet
EXPORTING #1 = sy-index .
CALL METHOD OF lh_sheet 'ACTIVATE'.
SET PROPERTY OF lh_sheet 'NAME' = name.
CALL METHOD OF lh_sheet 'Cells' = lh_cells
EXPORTING
#1 = 1
#2 = 1.
SET PROPERTY OF lh_cells 'VALUE' = 'test_val'.
CALL METHOD OF lh_excel 'Columns' = lh_column.
CALL METHOD OF lh_column 'Autofit'.
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.