아래는 간단한 type-1 소스입니다.
문제는 실행은 되는데 실행하면 레포트가 한장에 멈추지않고 반복해서 2장까지 나온다는거네요
루프문 어디가 문제일까요
REPORT ZLIST NO STANDARD PAGE HEADING
LINE-SIZE 98 LINE-COUNT 29 MESSAGE-ID PP.
*Table 선언
TABLES : zdtdoc, zinput, zoutput.
DATA : s_year(4) TYPE n,
s_mon(2) TYPE n,
s_date(2) TYPE n.
DATA : a_first(50),
a_second(50),
a_third(50),
s_first(50),
s_second(50),
s_third(50).
DATA : lin(1).
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE zinput.
data : docdate type zoutput-docdate,
wr type zoutput-wr,
etc type zoutput-etc,
docname type zoutput-docname,
docno type zdtdoc-docno.
data : end of itab.
*기초data Internal Table 선언
INITIALIZATION.
CLEAR : s_year, s_mon, s_date, a_first, a_second, a_third, s_first,
s_second, s_third.
*작업조건 Screen 구성
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : Research TYPE zoutput-idno OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1 .
TOP-OF-PAGE.
PERFORM write_header.
START-OF-SELECTION.
PERFORM select_data.
END-OF-SELECTION.
DESCRIBE TABLE itab LINES lin.
IF lin <= 0.
MESSAGE i999 WITH '원하는 조건의 data가 없습니다.'.
ELSE.
PERFORM write_data.
endif.
*&---------------------------------------------------------------------*
*& Form INIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init .
CLEAR : s_year, s_mon, s_date, a_first, a_second, a_third,
s_first, s_second, s_third.
ENDFORM. " INIT
*&---------------------------------------------------------------------*
*& Form select_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM select_data .
CLEAR itab. REFRESH itab.
SELECT a~name a~idno a~address a~gender b~idno b~name b~docdate
b~docname c~docno c~docname
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( zinput as a inner join zoutput as b on a~name = b~name
and a~idno = b~idno )
inner join zdtdoc AS c on b~docname = c~docname
WHERE a~idno = Research.
ENDFORM. " select_data
*&---------------------------------------------------------------------*
*& Form write_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM write_data .
loop at itab.
s_year = itab-docdate+0(4).
s_mon = itab-docdate+4(2).
s_date = itab-docdate+6(2).
a_first = itab-wr+0(26).
a_second = itab-wr+26(26).
a_third = itab-wr+52(26).
s_first = itab-etc+0(26).
s_second = itab-etc+26(26).
s_third = itab-etc+52(26).
ULINE.
WRITE : /1 '|',
4 '성', 11 '명',
16 '|',
20 itab-name,
65 '|',
68 '성', 75 '별',
80 '|',
84 itab-gender,
98 '|'.
ULINE.
WRITE : /1 '|',
4 '주', 11 '소',
16 '|',
20 itab-address,
65 '|',
68 '주민등록번호',
80 '|',
84 itab-idno,
98 '|'.
ULINE.
WRITE : /1 '|',
43 '상병 부위 및 상병명',
98 '|'.
ULINE.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 3 a_first, 98 '|'.
WRITE : /1 '|', 3 a_second, 98 '|'.
WRITE : /1 '|', 3 a_third, 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 98 '|'.
ULINE.
WRITE : /1 '|',
4 '진료일자',
16 '|',
23 '위 사람은', 34 itab-docdate, 47 '에 본원에서 진료받은 사실이 있음.',
98 '|'.
ULINE.
WRITE : /1 '|',
43 '특 기 사 항',
98 '|'.
ULINE.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 3 s_first, 98 '|'.
WRITE : /1 '|', 3 s_second, 98 '|'.
WRITE : /1 '|', 3 s_third, 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 98 '|'.
ULINE.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 50 '발행일자:', 75 s_year, 79 '년',82 s_mon, 84 '월', 87 s_date,
89 '일', 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 50 '의료기관:', 79 '서원대학병원', 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 50 '의료기관주소:', 79 '모충동 244~9', 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 50 '전화 및 FAX', 79 '043-220-6432', 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 50 '담당의사:', 72 '면허번호 제', 85 itab-docno, 89 '호', 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 50 '의사성명:', 85 itab-docname, 98 '|'.
WRITE : /1 '|', 98 '|'.
WRITE : /1 '|', 98 '|'.
ULINE.
endloop.
ENDFORM. " write_data
*&---------------------------------------------------------------------*
*& Form write_header
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM write_header .
ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
WRITE : /1 '|', 98 '|', /1 '|', 98 '|',
/1 '|', 98 '|', /1 '|', 98 '|',
/1 '|', 42 '진', 45'료', 48'확', 51'인', 54'서', 98 '|',
/1 '|', 98 '|', /1 '|', 98 '|',
/1 '|', 98 '|', /1 '|', 98 '|'.
ENDFORM. " write_header
행 바이트가 98바이트 라인 카운트가 65개네요 65라인 넘으면 두장으로 나올 것 같은데요. 헤더라인 + Internal table라인카운트 + End of page 라인 해서
65라인넘으면 2장 나올것 같은데요