메뉴 건너뛰기

SAP 한국 커뮤니티

텍스트파일 다운받을때 유니코드 문제 해결

솔로몬 2007.06.29 07:52 조회 수 : 14067 추천:25

<PRE>DATA: cp_tab  TYPE         nls_langu_cp_tab,
      l_wa    TYPE         nls_langu_cp_line,
      cc      TYPE REF TO  cl_nls_struc_container.

*
DATA:  BEGIN OF downtab OCCURS 100,
        content(500),
       END OF downtab.

DATA:  BEGIN OF head OCCURS 100,
         header(1),
         txjcd(6),
         aa(20),
        end of head.

head-header = '1'.
head-txjcd = '가나다라마'.
head-aa = '아자차'.
append head.


* 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 = head
        langu = '3'
      IMPORTING
        cont  = downtab-content.
  CATCH cx_sy_conversion_codepage .
  CATCH cx_parameter_invalid_range .
ENDTRY.



APPEND downtab.


LOOP AT downtab.
  WRITE : /1(100) downtab-content.

ENDLOOP.

</PRE>