메뉴 건너뛰기

SAP 한국 커뮤니티

report zsapdoi_005.

sapjoy 2008.12.26 12:10 조회 수 : 2978

report zsapdoi_005.


include officeintegrationinclude.


data: factory  type ref to i_oi_document_factory.
data: document type ref to i_oi_document_proxy.
data: link_server type ref to i_oi_link_server.
data: retcode  type t_oi_ret_string.
data: is_closed type i.


data: ok_code like sy-ucomm.
data: save_ok like ok_code.


tables: sflight.


parameters : p_carrid like sflight-carrid obligatory.


data: begin of gt_sflight occurs 0,
        carrid    like sflight-carrid,
        fldate    like sflight-fldate,
      end   of gt_sflight.


start-of-selection.


  select *
         from sflight
         into corresponding fields of table gt_sflight
        where carrid = p_carrid.


  if sy-subrc ne 0.
    leave list-processing.
  endif.


.
  call screen 100.
*&---------------------------------------------------------------------*
*&      Module  DOI_CREATE  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module doi_create output.
call method c_oi_factory_creator=>get_document_factory
    importing
      factory = factory
      retcode = retcode.
  if retcode ne c_oi_errors=>ret_ok.
    exit.
  endif.


  call method factory->start_factory
    exporting
      r3_application_name = 'ZSAPDOI_005'
    importing
      retcode             = retcode.
  call method c_oi_errors=>show_message
    exporting
      type = 'E'.



  call method factory->get_link_server
    importing
      link_server = link_server
      retcode     = retcode.
  call method c_oi_errors=>show_message
    exporting
      type = 'E'.


  call method link_server->start_link_server
    importing
      retcode = retcode.
  call method c_oi_errors=>show_message
    exporting
      type = 'E'.


  if not link_server is initial.


    call method link_server->add_table_item2
      exporting
        item_name  = 'gt_sflight'
      importing
        retcode    = retcode
      changing
        data_table = gt_sflight[].
    call method c_oi_errors=>show_message
      exporting
        type = 'E'.


  endif.


data: doc_table like w3mime occurs 0.
data: doc_size type i.
data: doc_type(80) value soi_doctype_excel97_sheet. "SOI_DOCTYPE_WORD97_DOCUMENT.
data: doc_format(80) type c.


  call function 'SAP_OI_LOAD_MIME_DATA'
    exporting
      object_id        = 'ZDOI_EXCEL'
    importing
      data_size        = doc_size
      document_format  = doc_format
      document_type    = doc_type
    tables
      data_table       = doc_table
    exceptions
      object_not_found = 1
      internal_error   = 2
      others           = 3.



  call method factory->get_document_proxy
    exporting
      document_type  = doc_type
    importing
      document_proxy = document
      retcode        = retcode.
  call method c_oi_errors=>show_message
    exporting
      type = 'E'.


    call method document->open_document_from_table
      exporting
        document_table = doc_table[]
        document_size  = doc_size
        startup_macro  = 'DOI_EXCEL_MACRO'
      importing
        retcode        = retcode.



*  CALL METHOD document->open_document
*    EXPORTING
*      OPEN_INPLACE   = 'X'
*      document_url   = 'FILE://C:DOI_002.doc'
*      startup_macro  = 'DOI_MACRO'
*      document_title = '비행기 티켓 정보'
*    IMPORTING
*      retcode       = retcode.
  call method c_oi_errors=>show_message
    exporting
      type = 'E'.
 


endmodule.                 " DOI_CREATE  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_0100 input.


endmodule.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&      Module  EXIT  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module exit input.
case ok_code.
    when 'EXIT'.


      if not document is initial.


        call method document->is_destroyed
          importing
            ret_value = is_closed.


        if is_closed is initial.
          call method document->close_document
            exporting
              do_save = 'X'
            importing
              retcode = retcode.
          call method c_oi_errors=>show_message
            exporting
              type = 'E'.
        endif.


        call method document->release_document
          importing
            retcode = retcode.


        call method c_oi_errors=>show_message
          exporting
            type = 'E'.


        free document.


      endif.


      leave to screen 0.


  endcase.


endmodule.                 " EXIT  INPUT
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_0100 output.
  set pf-status 'STATUS01'.


endmodule.                 " STATUS_0100  OUTPUT

번호 제목 글쓴이 날짜 조회 수
629 REPORT z20_002 [2] sapjoy 2007.04.15 3092
628 REPORT Z18_002 sapjoy 2007.03.05 3082
627 REPORT z18_02. sapjoy 2012.08.01 3078
626 report zsalv_004 sapjoy 2010.08.20 3076
625 Z02_003 [2] sapjoy 2006.12.02 3042
624 Z01_018 [2] sapjoy 2006.12.02 3042
623 doi_create [1] sapjoy 2008.12.25 3040
622 REPORT Z_DYNAMIC_SCREEN [1] sapjoy 2010.10.07 3034
621 REPORT Z05_014 sapjoy 2008.04.14 3010
620 Z01_020 [2] sapjoy 2006.12.02 3008
619 report zsalv_041 . sapjoy 2010.08.20 2998
618 REPORT Z15_033 sapjoy 2007.02.05 2987
617 report zsalv_043 . sapjoy 2010.08.20 2978
» report zsapdoi_005. sapjoy 2008.12.26 2978
615 report zsalv_032 . sapjoy 2010.08.20 2976
614 REPORT Z11_001 sapjoy 2006.12.20 2976
613 INLUCDE ZXAISU02 sapjoy 2008.12.15 2961
612 PROGRAM z16_001 sapjoy 2007.04.26 2952
611 REPORT Z17_028 sapjoy 2007.02.26 2937
610 REPORT z19_005 [1] sapjoy 2007.04.03 2927