본문 바로가기

ABAP 물타기/Report

한글 출력 자리수 조정


UNICODE 적용 후 한글은 영문 숫자와 동일하게 1자리로 저장 된다.
하지만 출력시에서의 한글 DISPLAY는 2자리를 차지한다.
따라서 반으로 줄여 출력해야 한다.

  data : c1(20),
       c2(20).

"12개 이면 24자리가 필요하므로 10개만 출력
c1 = '가나다라마가나다라마가나'.

write :/ c1.
perform coversion_kor_char using c1 CHANGING c2.
write :/ c2.

"영문 숫자는 모두 나옴
c1 = 'abcdefghij1234567890'.


write :/ c1.
perform coversion_kor_char using c1 CHANGING c2.
write :/ c2.


form coversion_kor_char  using    pl_in
                         changing pl_out.

  data: l_len    type i.

  check not ( pl_in is initial ).
  clear: pl_out.

  condense pl_out no-gaps.

  describe field pl_out length l_len in character mode.

  call function 'CUT_2BYTES_STRINGS'
    exporting
      i_str = pl_in
      i_len = l_len
    importing
      o_str = pl_out.

'ABAP 물타기 > Report' 카테고리의 다른 글

Lock Data  (0) 2011.07.22
Long Text  (0) 2011.07.10
Modify Screen 1000  (0) 2011.01.19
year month select-optoins  (0) 2011.01.12
파일다운로드 Use SMW0  (0) 2011.01.03