전자세금계산서발행본, 전자세금계산서이외 발행본을 각각 한통으로 나오게 하고 싶은데
그게 잘 안되요.
비슷한 내용으로 질문 드렸었는데...
답변대로 안되네요. ㅠㅠ
write 구문에서 셀 병합 하는 방법 좀 알려주세요. ^^
감사합니다.
그림 내용의 소스입니다.
CASE NR.
WHEN '1'.
WRITE : / '| 합 계 |', " Total sum
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE,
/ '| |'.
WHEN '2_1'.
WRITE : / '| 전 자 | 사업자등록번호 |',
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE,
/ '| | 발행분 |',
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE.
WHEN '2_2'.
WRITE : / '| 세금계산서 | 주민등록번호 |',
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE,
/ '| | 발행분 |',
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE.
WHEN '2_3'.
WRITE : / '| 발 행 분 | 소 계 |',
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE.
WHEN '3_1'.
WRITE : / '| 전 자 | 사업자등록번호 |',
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE,
/ '| | 발행분 |',
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE.
WHEN '3_2'.
WRITE : / '| 세금계산서 | 주민등록번호 |',
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE,
/ '| 이 외 | 발행분 |',
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE.
WHEN '3_3'.
WRITE : / '| 발 행 분 | 소 계 |',
41 SY-VLINE, 46 SY-VLINE, 74 SY-VLINE, 100 SY-VLINE.
ENDCASE.
DATA : BEGIN OF itab OCCURS 0,
gubun TYPE c LENGTH 1, " 1 전자세금계산서 발행분, 2 이외
subgb TYPE c LENGTH 1, " 1 사업자등록분, 2 주민등록분
cnt_a TYPE i, " 매출처수
cnt_b TYPE i, " 매수
END OF itab .
DEFINE make_data.
clear itab.
itab-gubun = &1.
itab-subgb = &2.
itab-cnt_a = &3.
itab-cnt_b = &4.
append itab.
END-OF-DEFINITION.
* Make data
make_data : '1' '1' 3 8,
'1' '2' 0 0,
'2' '1' 18 54,
'2' '2' 0 0.
PERFORM write_header.
PERFORM write_body.
*&---------------------------------------------------------------------*
*& Form WRITE_HEADER
*&---------------------------------------------------------------------*
FORM write_header .
PERFORM uline USING 'X' 101.
PERFORM line_draw USING 'X' 55 space.
PERFORM line_draw USING ' ' 20 '매출 '.
PERFORM line_draw USING ' ' 19 '매'.
PERFORM line_draw USING 'X' 55 '구 분'.
PERFORM line_draw USING ' ' 20 space.
PERFORM line_draw USING ' ' 19 space.
PERFORM line_draw USING 'X' 55 space.
PERFORM line_draw USING ' ' 20 '처수 '.
PERFORM line_draw USING ' ' 19 '수'.
PERFORM uline USING 'X' 101.
ENDFORM. " WRITE_HEADER
*&---------------------------------------------------------------------*
*& Form write_body
*&---------------------------------------------------------------------*
FORM write_body.
DATA itab_sum LIKE itab.
DATA itab_ss LIKE itab.
DATA lv_text1 TYPE string.
DATA lv_text2 TYPE string.
DATA lv_uline TYPE c.
SORT itab BY gubun subgb.
LOOP AT itab.
AT LAST.
SUM.
itab_sum = itab.
ENDAT.
ENDLOOP.
LOOP AT itab.
AT FIRST.
PERFORM write_uline USING '3' '합 계' itab_sum.
ENDAT.
CASE itab-gubun.
WHEN '1'.
CASE itab-subgb.
WHEN '1'.
lv_text1 = '전자'.
lv_text2 = '사업자등록번호발행분'.
lv_uline = '1'.
WHEN '2'.
lv_text1 = '발행분'.
lv_text2 = '주민등록번호발행분'.
lv_uline = '2'.
ENDCASE.
WHEN '2'.
CASE itab-subgb.
WHEN '1'.
lv_text1 = '전자'.
lv_text2 = '사업자등록번호발행분'.
lv_uline = '1'.
WHEN '2'.
lv_text1 = '이외 발행분'.
lv_text2 = '주민등록번호발행분'.
lv_uline = '2'.
ENDCASE.
ENDCASE.
PERFORM write_body_line USING lv_text1 lv_text2 itab.
AT END OF gubun.
SUM.
itab_ss = itab.
ENDAT.
PERFORM write_uline USING lv_uline ' 소 계' itab_ss.
ENDLOOP.
ENDFORM. "write_body
*&---------------------------------------------------------------------*
*& Form ULINE
*&---------------------------------------------------------------------*
FORM uline USING lf TYPE any
line TYPE any.
CASE lf.
WHEN 'X'. WRITE / sy-uline(line). " Line feed
WHEN OTHERS. WRITE sy-uline(line).
ENDCASE.
ENDFORM. " ULINE
*&---------------------------------------------------------------------*
*& Form LINE_DRAW
*&---------------------------------------------------------------------*
FORM line_draw USING new_line TYPE any
text_size TYPE i
text TYPE any.
CASE new_line.
WHEN 'X'.
WRITE / sy-vline NO-GAP.
WRITE AT (text_size) text CENTERED.
WHEN OTHERS.
WRITE AT (text_size) text CENTERED.
ENDCASE.
WRITE sy-vline NO-GAP.
ENDFORM. " LINE_DRAW
*&---------------------------------------------------------------------*
*& Form WRITE_BODY_LINE
*&---------------------------------------------------------------------*
FORM write_body_line USING us_text1 TYPE any
us_text2 TYPE any
us_itab LIKE itab.
PERFORM line_draw USING 'X' 24 us_text1.
PERFORM line_draw USING ' ' 29 us_text2.
PERFORM line_draw USING ' ' 20 itab-cnt_a.
PERFORM line_draw USING ' ' 19 itab-cnt_b.
ENDFORM. " WRITE_BODY_LINE
*&---------------------------------------------------------------------*
*& Form WRITE_ULINE
*&---------------------------------------------------------------------*
FORM write_uline USING us_ltype TYPE any
us_text TYPE any
us_itab LIKE itab.
CASE us_ltype.
WHEN '1'.
PERFORM line_draw USING 'X' 24 '세금계산서'.
PERFORM uline USING space 74.
WHEN '2'. " 소계
PERFORM uline USING space 101.
PERFORM line_draw USING 'X' 55 us_text.
PERFORM line_draw USING ' ' 20 us_itab-cnt_a.
PERFORM line_draw USING ' ' 19 us_itab-cnt_b.
PERFORM uline USING space 101.
WHEN '3'. " 합계
PERFORM line_draw USING 'X' 55 us_text.
PERFORM line_draw USING ' ' 20 us_itab-cnt_a.
PERFORM line_draw USING ' ' 19 us_itab-cnt_b.
PERFORM uline USING space 101.
ENDCASE.
ENDFORM. " WRITE_ULINE
대충 작성해 봤는데요. 적당히 고쳐 쓰시면 될 것 같네요.^^;