메뉴 건너뛰기

SAP 한국 커뮤니티

report zunicode_026.

sapjoy 2008.11.22 01:24 조회 수 : 2783

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.

번호 제목 글쓴이 날짜 조회 수
291 report zunicode_027. [4] sapjoy 2008.11.22 6289
» report zunicode_026. sapjoy 2008.11.22 2783
289 report zunicode_025. sapjoy 2008.11.22 2490
288 report zunicode_022. sapjoy 2008.11.22 2614
287 report zunicode_017. sapjoy 2008.11.22 2810
286 report zunicode_019. sapjoy 2008.11.22 2326
285 report zunicode_018. sapjoy 2008.11.22 2229
284 report zunicode_016. sapjoy 2008.11.22 2301
283 report zunicode_015. sapjoy 2008.11.22 2226
282 report zunicode_014. sapjoy 2008.11.22 1735
281 report zunicode_013. sapjoy 2008.11.22 2209
280 report zunicode_012. sapjoy 2008.11.22 2217
279 report zunicode_011. sapjoy 2008.11.22 2173
278 report zunicode_010. sapjoy 2008.11.22 2281
277 report zunicode_009. sapjoy 2008.11.22 2229
276 report zunicode_008. sapjoy 2008.11.22 2466
275 report zunicode_007 sapjoy 2008.11.22 2483
274 report zunicode_006. sapjoy 2008.11.22 2317
273 report zunicode_005. sapjoy 2008.11.22 2229
272 report zunicode_004. sapjoy 2008.11.22 2410