이글은 아래 링크의 원본 글에 대한 한글 번역 입니다
https://blogs.sap.com/2014/09/30/abap-webdynpro-table-to-excel/

ABAP WebDynpro Table to Excel

September 30, 2014 

웹딘프로아밥 테이블을 엑셀 파일로 변환하여 다운로드하는 깔끔한 방법입니다.
(다음 에러 없이: 'filename.xls'의 파일 형식 및 확장명이 일치하지 않습니다. 파일이 손상되었거나 안전하지 않을 수 있습니다. 데이터 원본을 신뢰하지 않는다면 파일을 열지 마세요. 그래도 파일을 여시겠습니까?).

 

 

아래 코드를 가진 메소드를 만드세요:


 

 

method wd_download_table_to_excel.
******************************************************************************************************************
*Purpose:  Accept any table and and sends to Excel from ABAP WebDynpro
******************************************************************************************************************
  data: lv_xstring type xstring.
  data: lv_mime_type type w3conttype.
  data: lv_mime_type_string type string.
  data: ref_data type ref to data.

  get reference of lt_tbl into ref_data.

  call function 'SDOK_MIMETYPE_GET'
    exporting
      extension = 'xlsx'
    importing
      mimetype  = lv_mime_type.

  lv_mime_type_string = lv_mime_type.

  cl_fdt_xl_spreadsheet=>if_fdt_doc_spreadsheet~create_document( exporting itab = ref_data iv_call_type = 1 columns = lt_column receiving xdocument = lv_xstring ).
  cl_wd_runtime_services=>attach_file_to_response( exporting i_filename = i_filename i_content = lv_xstring i_mime_type = lv_mime_type_string i_in_new_window = abap_false ).

endmethod.

 

/wp-content/uploads/2014/09/temp_553273.jpg

 

 

이글은 아래 링크의 원본 글에 대한 한글 번역 입니다
https://blogs.sap.com/2014/09/30/abap-webdynpro-table-to-excel/

+ Recent posts