메뉴 건너뛰기

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

번호 제목 글쓴이 날짜 조회 수
1967 <img src=3.gif>TABSTRIP 에 관한 에러 !! 고수님들 ~ 도와주세요 ~~ [1] file ena 2010.02.24 1393
1966 <img src=2.gif>cl_gui_textedit 사용하여 upload 할 경우 한글이 깨지는 현상을 수정하는 방법이 있는지요. [5] 태사성 2010.02.24 2096
1965 <img src=3.gif>loop at screen을 이용한 스크린 Block 제어 [3] Fjohnny 2010.02.24 5103
1964 <img src=3.gif>ECC 업그레이드 샙 쿼리 오류 질문 [1] 띠로리~ 2010.02.25 1246
1963 <img src=3.gif>인터널 테이블에 space값을 null값으로 변경 [2] 오류제로 2010.02.25 1862
1962 <img src=2.gif>MM03 기본단위 KG -> PC 로 변경방법? [8] file 구운남자 2010.02.26 4159
1961 <img src=3.gif>[HR] 코스트센터를 이용해서 HR조직코드 받아오는 방법 [2] 모모 2010.02.27 1880
1960 <img src=2.gif>Start-Of-Selection 구문 활용에서의 구버전과 신버전의 차이 [2] Fjohnny 2010.02.28 1802
1959 <img src=3.gif>abap 구문에 대해 문의드립니다. [3] 하루하루 2010.03.01 1796
1958 <img src=3.gif>필드값 요리 방법이 궁금 합니다. [6] 남산밑 2010.03.01 1570
1957 <img src=2.gif>필드 심볼 타입 다르게 선언하기... [6] 은미짱 2010.03.02 2021
1956 <img src=3.gif>Open SQL문에서 두 값 사이의 random값을 가져오는 구문이 있나요? [2] 고담 2010.03.02 1732
1955 <img src=1.gif>BW 인포오브젝트를 사용한 큐브를 확인하는 방법 좀 알려주세요 BW궁금 2010.03.02 1839
1954 <img src=3.gif>라이프 프로그램에서 AT PF~ 질문드려요 [2] 궁금 2010.03.02 1339
1953 <img src=3.gif><img src=1.gif>DOI 예제 따라하고 있는데요, 안되네요.. file 김기만 2010.03.02 1365
» [re] <img src=1.gif>DOI 예제 따라하고 있는데요, 안되네요.. [2] 요요 2010.03.02 20205
1951 <img src=3.gif>라벨 프린터(ZEBRA Printer)로 출력 해보시는 분 있나요?_수정본 [3] 버미! 2010.03.02 3488
1950 <img src=2.gif>타입 변경......Dec <-> Curr 변환 [2] sweety 2010.03.03 2269
1949 <img src=3.gif>데이터 값이 256btye 까지 들어가지 않는 문제... [1] 태사성 2010.03.03 1838
1948 <img src=2.gif>[SD] 영업쪽에서 견적생성하는 bapi혹시 있나요? [1] KKGGTT 2010.03.03 1300