메뉴 건너뛰기

SAP 한국 커뮤니티

report zunicode_026.

sapjoy 2008.11.21 16:24 조회 수 : 2782

report  zunicode_026.


data: line(500) type c.


data:  begin of itab occurs 100,
        line(500),
      end of itab.



data : line2(500) type c,
       itab2 like table of line.


data: cp_tab  type         nls_langu_cp_tab,
      l_wa    type         nls_langu_cp_line,
      cc      type ref to  cl_nls_struc_container.


line+0(10)  = '하나'.
line+10(10) = '둘'.
line+20(10) = '셋'.
line+30(10) = '넷'.
append line to itab.


 


line+0(10) = 'one'.
line+10(10) = 'two'.
line+20(10) = 'three'.
line+30(10) = 'four'.
append line to itab.


data l_a type filetable.
data l_i type i.
data l_c type abap_bool.
l_c = 'X'.
call method cl_gui_frontend_services=>file_open_dialog
  exporting
*    window_title            =
*    default_extension       =
*    default_filename        =
*    file_filter             =
    with_encoding           = l_c
*    initial_directory       =
*    multiselection          =
  changing
    file_table              = l_a
    rc                      = l_i
*    user_action             =
*    file_encoding           =
*  EXCEPTIONS
*    file_open_dialog_failed = 1
*    cntl_error              = 2
*    error_no_gui            = 3
*    not_supported_by_gui    = 4
*    others                  = 5
        .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.



call method cl_gui_frontend_services=>file_save_dialog
*  EXPORTING
*    window_title         =
*    default_extension    =
*    default_file_name    =
*    with_encoding        =
*    file_filter          =
*    initial_directory    =
*    prompt_on_overwrite  = 'X'
  changing
    filename             =
    path                 =
    fullpath             =
*    user_action          =
*    file_encoding        =
*  EXCEPTIONS
*    cntl_error           = 1
*    error_no_gui         = 2
*    not_supported_by_gui = 3
*    others               = 4
        .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.


loop at itab.


* Non Unicode(한글 2바이트로 인식)
  l_wa-langu = '3'.
  l_wa-codepage = '8500'.


  insert l_wa into table cp_tab.


  cc = cl_nls_struc_container=>create( cp_tab = cp_tab ).


  try.
      call method cc->struc_to_cont
        exporting
          struc = itab
          langu = '3'
        importing
          cont  = line2.
    catch cx_sy_conversion_codepage .
    catch cx_parameter_invalid_range .
  endtry.


  append line2 to itab2.
endloop.


call function 'GUI_DOWNLOAD'
  exporting
    filename         = 'c:test.txt'
    filetype         = 'ASC'
    codepage         = '8500'
  tables
    data_tab         = itab
  exceptions
    file_write_error = 1.

번호 제목 글쓴이 날짜 조회 수
610 report zsapdoi_004. sapjoy 2008.12.26 2923
609 FUNCTION Z_BAPI_ASSETNAME_SEARCH sapjoy 2009.01.30 2898
608 INCLUDE Z16_001I01 sapjoy 2007.04.26 2887
607 REPORT Z05_001 [3] sapjoy 2007.05.21 2880
606 REPORT z17_20 sapjoy 2012.08.01 2879
605 REPORT Z03_003 [7] sapjoy 2007.05.11 2876
604 FORM set_field_catalogs_grid USING lt_fieldcat TYPE lvc_t_fcat. sapjoy 2007.01.03 2875
603 REPORT z19_010 [2] sapjoy 2007.04.06 2843
602 REPORT z18_014 sapjoy 2007.03.09 2843
601 Sub DOI_MACRO() sapjoy 2008.12.26 2842
600 DBZF1SSEL sapjoy 2006.12.19 2842
599 REPORT Z09_006 [1] sapjoy 2006.12.18 2839
598 REPORT Z03_006 [5] sapjoy 2006.12.02 2812
597 report zunicode_017. sapjoy 2008.11.21 2810
596 REPORT Z07_016 sapjoy 2008.04.14 2804
595 Report Z15_047 [3] sapjoy 2007.12.05 2798
594 FIELD_EXIT_STCD2_0 sapjoy 2008.12.16 2792
» report zunicode_026. sapjoy 2008.11.21 2782
592 REPORT Z18_001 sapjoy 2007.03.02 2774
591 Z01_021 [1] sapjoy 2006.12.02 2771