오브젝트특성을 읽는 동안 오류가 발생했습니다
>메시지 번호 SOFFICEINTEGRATION205
>
>
>-------------------------------------
>위와 같이 메시지가 뜨면서 실행이 안되요.
>
>주인장님 소스를 그대로 붙여서 넣었는데, 안되서요..
>이거 어떻게 하면 실행 가능할가요? 엑셀을 ABAP에서 직접 불러서 작업하는거 만들면
>ALV EDIT를 대체해서 쓰기 편할 것 같아서요..
>
>답변 좀 부탁드려요!
제가 샘플링 해놓은 소스가 있는데 도움이 되실지 모르겠네요.
컨테이너에 엑셀 띄어놓고 셀단위 그룹으로 읽기/쓰기 다 가능할 거예요.
약간만 응용하시면 실무에 도움이 되실지도 모르겠네요.
테스트 하고 올려드리는 것이니 잘 될 거예요. ^^
전제 조건 : 화면 100
pf-status '100' .
[flow-logic].
PROCESS BEFORE OUTPUT.
MODULE status.
PROCESS AFTER INPUT.
MODULE exit AT EXIT-COMMAND.
MODULE user_command.
[소스코드]
TYPE-POOLS: soi.
DATA: ok_code TYPE syucomm.
* SAP Desktop Office Integration Interfaces
DATA: control TYPE REF TO i_oi_container_control,
document TYPE REF TO i_oi_document_proxy,
spreadsheet TYPE REF TO i_oi_spreadsheet,
error TYPE REF TO i_oi_error,
errors TYPE REF TO i_oi_error OCCURS 0 WITH HEADER LINE.
* spreadsheet interface structures for Excel data input
DATA: cellitem TYPE soi_generic_item.
DATA: rangeitem TYPE soi_range_item.
DATA: ranges TYPE soi_range_list.
DATA: excel_input TYPE soi_generic_table.
DATA: excel_input_wa TYPE soi_generic_item.
DATA: columns_number TYPE i,
rows_number TYPE i.
START-OF-SELECTION.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
MODULE exit INPUT.
LEAVE TO SCREEN 0.
ENDMODULE. " EXIT INPUT
*&---------------------------------------------------------------------*
*& Module STATUS OUTPUT
*&---------------------------------------------------------------------*
MODULE status OUTPUT.
SET PF-STATUS '100'.
IF control IS NOT BOUND.
* first get the SAP DOI i_oi_container_control interface
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = control
error = error.
* specified above and tell it to run Excel in-place
CALL METHOD control->init_control
EXPORTING
r3_application_name = 'R/3 Basis' "#EC NOTEXT
inplace_enabled = 'X'
inplace_scroll_documents = 'X'
parent = cl_gui_container=>default_screen
register_on_close_event = 'X'
register_on_custom_event = 'X'
no_flush = 'X'
IMPORTING
error = errors.
* ask the SAP DOI container for a i_oi_d0cument_proxy for Excel
CALL METHOD control->get_document_proxy
EXPORTING
document_type = 'Excel.Sheet'
no_flush = 'X'
IMPORTING
document_proxy = document
error = errors.
* and then create a new Excel sheet
CALL METHOD document->create_document
EXPORTING
open_inplace = 'X'
document_title = 'R/3 table contents in Excel' "#EC NOTEXT
no_flush = 'X'
IMPORTING
error = errors.
* check if our d0cument proxy can serve a spreadsheet interface data:
* => SpreadSheet 에 대하여 interface 를 하겠습니다. ^^
DATA: has TYPE i.
CALL METHOD document->has_spreadsheet_interface
EXPORTING
no_flush = 'X'
IMPORTING
is_available = has
error = errors.
CALL METHOD document->get_spreadsheet_interface
EXPORTING
no_flush = ' '
IMPORTING
sheet_interface = spreadsheet
error = errors.
ENDIF.
ENDMODULE. " STATUS OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND INPUT
*&---------------------------------------------------------------------*
MODULE user_command INPUT.
CASE ok_code.
WHEN 'GXLS'. " Get excels
REFRESH: excel_input, ranges.
rangeitem-name = 'SAP_Table'.
APPEND rangeitem TO ranges.
CALL METHOD spreadsheet->get_ranges_data
EXPORTING
all = ' '
no_flush = ' '
IMPORTING
contents = excel_input
CHANGING
ranges = ranges.
* check no errors occured
CALL METHOD error->raise_message
EXPORTING
type = 'E'.
* DESCRIBE TABLE excel_input LINES exceldata-lines.
WHEN 'PXLS'. " Put excels
rows_number = columns_number = 2.
REFRESH: ranges, excel_input.
rangeitem-name = 'SAP_Table'.
excel_input_wa-column = rangeitem-columns = 1.
excel_input_wa-row = rangeitem-rows = 1.
DO rows_number TIMES.
excel_input_wa-value = 'TEST'.
APPEND rangeitem TO ranges.
APPEND excel_input_wa TO excel_input.
ADD 1 TO : excel_input_wa-column, rangeitem-columns,
excel_input_wa-row, rangeitem-rows.
ENDDO.
* create an excel range for our data
CALL METHOD spreadsheet->insert_range_dim
EXPORTING
name = 'SAP_Table'
top = 3
left = 3
rows = rows_number
columns = columns_number
no_flush = 'X'
IMPORTING
error = errors.
CALL METHOD spreadsheet->set_color
EXPORTING
rangename = 'SAP_Table'
back = '45'
front = '2'
no_flush = 'X'
IMPORTING
error = errors.
CALL METHOD spreadsheet->set_ranges_data
EXPORTING
ranges = ranges
contents = excel_input
no_flush = 'X'
IMPORTING
error = errors.
APPEND errors.
CALL METHOD spreadsheet->fit_widest
EXPORTING
name = space
no_flush = 'X'.
* now flush automation queue
CALL METHOD control->set_focus
EXPORTING
no_flush = ' '
IMPORTING
error = errors.
ENDCASE.
CLEAR ok_code.
ENDMODULE. " USER_COMMAND INPUT
댓글 2
-
김기만
2010.03.03 08:54
-
예스맨
2010.03.09 15:54
저도 호기심에 요요님 소스 테스트 해봤는데요...궁금한점이 발생해서요..
엑셀화면의 값을 읽는 로직이 잘 작동이 안되서 그러는데요.. 왜 그럴까요?
밑에 부분 같은데. excel_input 인터널테이블 값에 아무값도 들어오지가 않네요 -_-.
CALL METHOD spreadsheet->get_ranges_data
EXPORTING
all = ' '
no_flush = ' '
IMPORTING
contents = excel_input
CHANGING
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
14 | FOR ALL ENTRIES IN 질문드립니다! [5] | 아좀더 | 2019.04.19 | 19315 |
» | [re] <img src=1.gif>DOI 예제 따라하고 있는데요, 안되네요.. [2] | 요요 | 2010.03.02 | 20220 |
12 | <b>[완료]</b>Mark field달기 [6] | SAP폐인 | 2007.12.04 | 20634 |
11 | <b>[완료]</b>메시지가 잘립니다. [3] | 김지성 | 2007.12.05 | 24509 |
10 |
ALV 에서는 에디팅 기능을 사용 할 수 없나요?
[5] ![]() | 댕댕 | 2007.04.03 | 27092 |
9 | <b>[완료]</b>Sorting시 Internal Table 이름이 가변적일때 Field symbol 사용 방법좀 가르쳐 주세요. [4] | SkyDream | 2007.12.05 | 27828 |
8 |
자재번호 자동 List up..? Search help..? 기능 문의 드립니다
[2] ![]() | 아좀더 | 2019.06.26 | 30818 |
7 | [요청]클래스를 이용한 ALV에서 선택 SEL MODE문의드립니다. [2] | 노력&성장 | 2008.04.17 | 35461 |
6 | <img src=2.gif border=0>Smartform 출력옵션 &field<옵션>& 중 자릿수 제한 기능에 관하여. [2] | JiruMi | 2009.04.20 | 44737 |
5 | [요청]소수점 데이터를 선언시 질문입니다. [2] | kkk | 2008.04.17 | 48289 |
4 |
Multi Selection 버튼 색상 문의..<-제목이 흠..
![]() | 김지성 | 2007.08.01 | 50548 |
3 |
[re] inner join 과 sub query 의 퍼포먼스...
[2] ![]() | Risky | 2009.09.11 | 59475 |
2 |
[요청]스크린페인터가 되질 않습니다.. alphanumeric editor가 나와요..ㅜㅜ
[15] ![]() | 피크민 | 2007.12.06 | 71198 |
1 | <b>[완료]</b>external alias의 대해 알려주세요~ [1] | abap퍼 | 2008.02.26 | 102809 |
고맙습니다.. 소스 갖다가 붙여 넣기 해보니 잘 돌아가네요..
이제 소스 분석 해보도록 하겠습니다. 좋은 하루 되세요!