메뉴 건너뛰기

SAP 한국 커뮤니티

>

오브젝트특성을 읽는 동안 오류가 발생했습니다


>메시지 번호 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

번호 제목 글쓴이 날짜 조회 수
6507 [요청]운영자님 좋은 조언 부탁드립니다. [1] secret 한사 2008.10.01 3
6506 [re] 특정 글자 뒤의 내용을 가져 오는 법 문의. secret ecbase 2006.12.02 7
6505 <img src=2.gif>INNER JOIN & OUTTER JOIN 의 차이점을 연구하기 위한 자료들 모음. [2] secret bill 2011.02.18 11
6504 매개변수 ID 가 SUBSCREEN 과 일반 SCREEN 에서 인식하는게 다른가요? 초밥 2024.05.02 27
6503 SKF 기표 취소 관련 문의 asfasf 2024.03.26 50
6502 BAPI_ROUTING_CREATE 실행 시 에러 파뤼타임 2024.04.15 52
6501 kb11n 변형 설정 문의 [1] 정만 2024.02.06 72
6500 read table 구문중 데이터 많을때.. [1] happy_boy 2024.04.23 75
6499 넘버레인지 interval cts에 관해서 문의드립니다. [2] happy_boy 2024.03.22 80
6498 [ABAP] CHAR TYPE 필드 MAX 값 구하기.. [2] Mckee 2024.04.24 88
6497 z07_04문제  실행해 보았는데fail뜹니다. 리얼오버 2022.01.07 93
6496 Screen 화면을 새 창으로 띄워서 원래 창에서도 작업 가능한 방법 Aranha 2024.02.23 99
6495 ALV Row 파일 저장 ~ 관련 질문 입니다. 멜론좋아 2022.10.19 112
6494 웹딘프로 환경설정 관련해서 질문있습니다 ㅇㅇㅇㅇㅇ 2022.11.21 114
6493 public method 호출 시 오류 [1] wid5785 2024.02.10 117
6492 ALV 총계/소계 상단 정렬 방법 문의 [1] 쌥쌥잇 2024.02.09 118
6491 Function Group: EINR 관련 문의 드립니다. [4] 쌥맨 2022.01.07 120
6490 abap 으로 DFS 알고리즘 구현해보신분 계실까요...? Juenkdo1 2024.03.13 124
6489 DYNP_VALUES_READ 함수 질문 [2] eeeaass 2024.02.22 125
6488 sapnwrfc.dll 사용중이신분 계신가요? alarm 2022.02.21 126