2007 Sep 11 8:22 AM
Hello All,
I am having a problem while displaying details in a report program. I am printing page number details in my top-of-page event. I am using sy-pagno field. Even my report contains more than 1 page, I am not able to see the page number getting incremented. Its always showing 1 in all the pages. Kindly help in this regard.
Thanks & regards,
Prakash Ghantasala
2007 Sep 11 8:56 AM
Hello All,
I could not understand why to put line count and writing the do enddo loop in start-of-selection. Generally for every new page this top-of-page should be triggerred and should execute the code within that block right???
Can you please tell me??
However I am placing my code below.
Main program...
----
End of selection
----
END-OF-SELECTION.
IF t_final IS NOT INITIAL.
Display the report in the output.
PERFORM display_report.
ELSE.
MESSAGE i057 WITH text-t19.
ENDIF.
----
TOP OF PAGE
----
TOP-OF-PAGE.
Print the heading, page number details.
PERFORM print_heading.
************************************************************************
Form Include......
Print the main details like bill to, patient
LOOP AT t_final INTO ls_final.
AT NEW kunde.
Print the bill to name
CLEAR ls_billto.
READ TABLE t_patn INTO ls_billto WITH KEY kunnr = ls_final-kunde.
IF sy-subrc = 0.
SKIP.
WRITE:/5 sy-uline(40).
WRITE:/5 sy-vline.
FORMAT COLOR 4 INTENSIFIED ON.
WRITE: 7 ls_billto-name1, 44 sy-vline.
FORMAT COLOR OFF.
WRITE:/5 sy-uline(40).
ENDIF.
ENDAT.
IF ls_final-kunnr <> l_patient.
Print the patient details header details
PERFORM print_patn_details USING ls_final.
l_patient = ls_final-kunnr.
ENDIF.
Print the values of the patient details.
PERFORM print_values USING ls_final.
ENDLOOP.
&----
*& Form print_heading
&----
Print the heading, page number details.
----
FORM print_heading .
Display the company code address, page number and time details.
WRITE:/5 sy-uline(75).
WRITE: 111 sy-uline(31).
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: w_adrc-name1.
WRITE: 78 space.
FORMAT COLOR OFF.
WRITE: 79 sy-vline.
WRITE: 111 sy-vline.
FORMAT COLOR 5.
WRITE: 112 sy-datum, 124 sy-timlo, 141 sy-vline.
FORMAT COLOR OFF.
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: w_adrc-house_num1, ',', w_adrc-street, 78 space.
FORMAT COLOR OFF.
WRITE: 79 sy-vline.
WRITE: 111 sy-vline.
FORMAT COLOR 5.
WRITE: 112 text-t02, 124 sy-pagno.
FORMAT COLOR OFF.
WRITE: 141 sy-vline.
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: w_adrc-postcode1, ',', w_adrc-city1, 76 space.
WRITE: 79 sy-vline.
FORMAT COLOR OFF.
WRITE: 111 sy-uline(31).
WRITE:/5 sy-uline(75).
SKIP.
Display the title of the report and period details
WRITE:/5 sy-uline(61).
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: 7 text-t03, 32 sy-vline, 34 text-t04,
40 s_period-low, 51 text-t05, 53 s_period-high, 65 sy-vline.
FORMAT COLOR OFF.
WRITE:/5 sy-uline(61).
ENDFORM. " print_heading
Hello All,
I could not understand why to put line count and writing the do enddo loop in start-of-selection. Generally for every new page this top-of-page should be triggerred and should execute the code within that block right???
Can you please tell me??
However I am placing my code below.
Main program...
----
End of selection
----
END-OF-SELECTION.
IF t_final IS NOT INITIAL.
Display the report in the output.
PERFORM display_report.
ELSE.
MESSAGE i057 WITH text-t19.
ENDIF.
----
TOP OF PAGE
----
TOP-OF-PAGE.
Print the heading, page number details.
PERFORM print_heading.
************************************************************************
Form Include......
Print the main details like bill to, patient
LOOP AT t_final INTO ls_final.
AT NEW kunde.
Print the bill to name
CLEAR ls_billto.
READ TABLE t_patn INTO ls_billto WITH KEY kunnr = ls_final-kunde.
IF sy-subrc = 0.
SKIP.
WRITE:/5 sy-uline(40).
WRITE:/5 sy-vline.
FORMAT COLOR 4 INTENSIFIED ON.
WRITE: 7 ls_billto-name1, 44 sy-vline.
FORMAT COLOR OFF.
WRITE:/5 sy-uline(40).
ENDIF.
ENDAT.
IF ls_final-kunnr <> l_patient.
Print the patient details header details
PERFORM print_patn_details USING ls_final.
l_patient = ls_final-kunnr.
ENDIF.
Print the values of the patient details.
PERFORM print_values USING ls_final.
ENDLOOP.
&----
*& Form print_heading
&----
Print the heading, page number details.
----
FORM print_heading .
Display the company code address, page number and time details.
WRITE:/5 sy-uline(75).
WRITE: 111 sy-uline(31).
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: w_adrc-name1.
WRITE: 78 space.
FORMAT COLOR OFF.
WRITE: 79 sy-vline.
WRITE: 111 sy-vline.
FORMAT COLOR 5.
WRITE: 112 sy-datum, 124 sy-timlo, 141 sy-vline.
FORMAT COLOR OFF.
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: w_adrc-house_num1, ',', w_adrc-street, 78 space.
FORMAT COLOR OFF.
WRITE: 79 sy-vline.
WRITE: 111 sy-vline.
FORMAT COLOR 5.
WRITE: 112 text-t02, 124 sy-pagno.
FORMAT COLOR OFF.
WRITE: 141 sy-vline.
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: w_adrc-postcode1, ',', w_adrc-city1, 76 space.
WRITE: 79 sy-vline.
FORMAT COLOR OFF.
WRITE: 111 sy-uline(31).
WRITE:/5 sy-uline(75).
SKIP.
Display the title of the report and period details
WRITE:/5 sy-uline(61).
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: 7 text-t03, 32 sy-vline, 34 text-t04,
40 s_period-low, 51 text-t05, 53 s_period-high, 65 sy-vline.
FORMAT COLOR OFF.
WRITE:/5 sy-uline(61).
ENDFORM. " print_heading
2007 Sep 11 8:24 AM
Hi!
It only seems bad, if you print it out and check in the spool or on the printed papaer, it has to be correct. It seems a bug in ABAP.
Regards
Tamá
2007 Sep 11 8:26 AM
Hi Prakash
Please use the below code for total page.
REPORT ZATEST61 NO STANDARD PAGE HEADING LINE-SIZE 80 LINE-COUNT 10.
TOP-OF-PAGE.
PERFORM WRITE_TITLE.
START-OF-SELECTION.
DO 200 TIMES.
WRITE: /5 'Write data', SY-INDEX.
ENDDO.
END-OF-SELECTION.
PERFORM WRITE_TOTAL_PAGE.
&----
*& Form WRITE_TITLE
&----
text
----
--> p1 text
<-- p2 text
----
FORM WRITE_TITLE.
ULINE.
WRITE: AT 50'Page:', SY-PAGNO NO-GAP,'of' ,'*****'.
ULINE.
ENDFORM. " WRITE_TITLE
&----
*& Form WRITE_TOTAL_PAGE
&----
text
----
--> p1 text
<-- p2 text
----
FORM WRITE_TOTAL_PAGE.
DATA: PAGE_COUNT LIKE SY-LISEL.
WRITE SY-PAGNO TO PAGE_COUNT LEFT-JUSTIFIED.
DO SY-PAGNO TIMES.
READ LINE 2 OF PAGE SY-INDEX.
REPLACE '*****' WITH PAGE_COUNT INTO SY-LISEL.
MODIFY CURRENT LINE.
ENDDO.
ENDFORM. " WRITE_TOTAL_PAGE
Regards
Wiboon
2007 Sep 11 8:27 AM
see this sample program
DATA : ws_lines TYPE i,
ws_flag(1) TYPE c.
DATA : ws_matnr TYPE mara-matnr,
ws_werks TYPE marc-werks.
DATA: hold_tabix TYPE sy-tabix.
DATA: ws_wgbez TYPE t023t-wgbez.
*DATA: f(20), val(12).
*Constants
CONSTANTS:pip(1) VALUE '|',
lc_view(1) TYPE c VALUE 'E',
lc_con(1) TYPE c VALUE 'X'.
Internal Table declaration.
TYPES : BEGIN OF tp_itab1,
werks TYPE marc-werks,
xchar TYPE marc-xchar,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
meins TYPE mara-meins,
ernam TYPE mara-ernam,
matkl TYPE mara-matkl,
maktx TYPE makt-maktx,
wgbez TYPE t023t-wgbez,
END OF tp_itab1.
DATA : t_itab1 TYPE STANDARD TABLE OF tp_itab1,
wa_itab1 TYPE tp_itab1,
ws_maktx TYPE maktx.
Selection screen declaration **********************************
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 2.
SELECT-OPTIONS: s_werks FOR marc-werks OBLIGATORY.
SELECT-OPTIONS: s_matnr FOR mara-matnr OBLIGATORY.
SELECT-OPTIONS: s_mtart FOR mara-mtart.
SELECTION-SCREEN SKIP 1.
PARAMETERS: check1 TYPE marc-xchar AS CHECKBOX.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_meins FOR mara-meins.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN END OF BLOCK a1.
*top of page.
TOP-OF-PAGE.
PERFORM top_of_page.
***Start of Selection*********************************************
START-OF-SELECTION.
*Fetching data
PERFORM fetch_data.
*displaying data
PERFORM display.
END-OF-SELECTION.
&----
*& Form fetch_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM fetch_data.
SELECT mara~matnr
mara~ernam
mara~mtart
mara~matkl
mara~meins
mara~ernam
marc~werks
marc~xchar
makt~maktx
INTO CORRESPONDING FIELDS OF TABLE t_itab1 FROM
( mara INNER JOIN marc ON maramatnr = marcmatnr ) INNER JOIN
makt ON maramatnr = maktmatnr
WHERE mara~matnr IN s_matnr AND
marc~werks IN s_werks AND
mara~mtart IN s_mtart AND
mara~meins IN s_meins.
SORT t_itab1 BY matnr.
DELETE ADJACENT DUPLICATES FROM t_itab1
COMPARING matnr werks.
*fetching material group description
LOOP AT t_itab1 INTO wa_itab1.
hold_tabix = sy-tabix.
SELECT SINGLE wgbez INTO ws_wgbez
FROM t023t
WHERE matkl = wa_itab1-matkl AND
spras = sy-langu.
IF sy-subrc = 0.
wa_itab1-wgbez = ws_wgbez.
MODIFY t_itab1 INDEX hold_tabix FROM wa_itab1.
CLEAR ws_wgbez.
ELSE.
SELECT SINGLE wgbez INTO ws_wgbez
FROM t023t
WHERE matkl = wa_itab1-matkl AND
spras = 'EN'.
IF sy-subrc = 0.
wa_itab1-wgbez = ws_wgbez.
MODIFY t_itab1 INDEX hold_tabix FROM wa_itab1.
CLEAR ws_wgbez.
ENDIF.
ENDIF.
*fetching material description
IF NOT wa_itab1-maktx IS INITIAL.
SELECT SINGLE maktx INTO ws_maktx FROM makt
WHERE matnr = wa_itab1-matnr AND
spras = sy-langu.
IF sy-subrc = 0 AND wa_itab1-maktx <> ws_maktx.
hold_tabix = sy-tabix.
wa_itab1-maktx = ws_maktx.
MODIFY t_itab1 INDEX hold_tabix FROM wa_itab1.
ELSE.
SELECT SINGLE maktx INTO ws_maktx FROM makt
WHERE matnr = wa_itab1-matnr AND
spras = 'EN'.
wa_itab1-maktx = ws_maktx.
MODIFY t_itab1 INDEX hold_tabix FROM wa_itab1.
CLEAR : wa_itab1,
ws_maktx,
hold_tabix.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " fetch_data
&----
*& Form top_of_page
&----
text
----
--> p1 text
<-- p2 text
----
FORM top_of_page.
<b>FORMAT COLOR COL_HEADING.
WRITE : / 'USER : ', sy-uname,
/ 'DATE : ', sy-datum, sy-uzeit,
/ 'PLANT : ', wa_itab1-werks.
ULINE AT /(134).</b>
WRITE : / pip, "Column headings
(13) text-002,pip,
(15) text-003,pip,
(40) text-004,pip,
(12) text-005,pip,
(15) text-006,pip,
(20) text-007,pip.
ULINE AT /(134).
ENDFORM. " top_of_page
&----
*& Form display
&----
text
----
--> p1 text
<-- p2 text
----
FORM display.
FORMAT COLOR OFF.
*displaying report when Batch Managed Selected
SORT t_itab1 BY werks matnr.
IF check1 = 'X'.
LOOP AT t_itab1 INTO wa_itab1.
IF wa_itab1-xchar = ' '.
DELETE TABLE t_itab1 FROM wa_itab1.
ENDIF.
ENDLOOP.
ELSE.
*displaying report when Batch Managed is NOT Selected
LOOP AT t_itab1 INTO wa_itab1.
IF wa_itab1-xchar = 'X'.
DELETE TABLE t_itab1 FROM wa_itab1.
ENDIF.
ENDLOOP.
ENDIF.
IF t_itab1[] IS INITIAL.
MESSAGE i000(zg) WITH text-008.
ENDIF.
SORT t_itab1 BY werks matnr.
CLEAR ws_lines.
LOOP AT t_itab1 INTO wa_itab1.
WRITE : / sy-vline, wa_itab1-mtart, 17 sy-vline,
wa_itab1-matnr, 35 sy-vline,
wa_itab1-maktx, 78 sy-vline,
wa_itab1-ernam, 93 sy-vline,
wa_itab1-matkl, 111 sy-vline,
wa_itab1-wgbez, 134 sy-vline.
*hide
HIDE : wa_itab1-matnr,wa_itab1-werks.
ON CHANGE OF wa_itab1-werks.
CLEAR ws_lines.
ENDON.
ws_lines = ws_lines + 1 .
*bottom of page
AT END OF werks.
ULINE AT /(134).
WRITE : / 'TOTAL MATERIAL DISPLAYED : ', ws_lines,
/ 'PAGE NUMBER : ', sy-pagno.
SKIP 2.
NEW-PAGE.
ENDAT.
ENDLOOP.
ENDFORM. " display
AT LINE-SELECTION.
GET CURSOR FIELD f VALUE val.
IF f = 'WA_ITAB1-MATNR'.
SET PARAMETER ID 'MAT' FIELD wa_itab1-matnr.
SET PARAMETER ID 'MXX' FIELD lc_view. "to skip the select views popup
SET PARAMETER ID 'WRK' FIELD wa_itab1-werks.
IF NOT wa_itab1-matnr IS INITIAL.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
CLEAR : wa_itab1-matnr, wa_itab1-werks.
ENDIF.
2007 Sep 11 8:31 AM
What's your line-count set to? Try the code below...
Jonathan
report zlocal_jc_line_count
line-count 10.
start-of-selection.
do 21 times.
write: / 'line', sy-loopc.
enddo.
2007 Sep 11 8:42 AM
Hi Prakash,
the following is working fine for me...
<b>report zlocal_jc_line_count line-count 10.
top-of-page.</b>
write: 'T-O-P', <b>sy-pagno</b>.
start-of-selection.
do 21 times.
write: / 'line', sy-index.
enddo.
Could u please show me the code --- Report title and Top-of-page ??
2007 Sep 11 8:48 AM
set line count in u r report if u r not set this default line count for page will be too high(around 20000 lines)
Reoprt report_name line-count 15.
2007 Sep 11 8:56 AM
Hello All,
I could not understand why to put line count and writing the do enddo loop in start-of-selection. Generally for every new page this top-of-page should be triggerred and should execute the code within that block right???
Can you please tell me??
However I am placing my code below.
Main program...
----
End of selection
----
END-OF-SELECTION.
IF t_final IS NOT INITIAL.
Display the report in the output.
PERFORM display_report.
ELSE.
MESSAGE i057 WITH text-t19.
ENDIF.
----
TOP OF PAGE
----
TOP-OF-PAGE.
Print the heading, page number details.
PERFORM print_heading.
************************************************************************
Form Include......
Print the main details like bill to, patient
LOOP AT t_final INTO ls_final.
AT NEW kunde.
Print the bill to name
CLEAR ls_billto.
READ TABLE t_patn INTO ls_billto WITH KEY kunnr = ls_final-kunde.
IF sy-subrc = 0.
SKIP.
WRITE:/5 sy-uline(40).
WRITE:/5 sy-vline.
FORMAT COLOR 4 INTENSIFIED ON.
WRITE: 7 ls_billto-name1, 44 sy-vline.
FORMAT COLOR OFF.
WRITE:/5 sy-uline(40).
ENDIF.
ENDAT.
IF ls_final-kunnr <> l_patient.
Print the patient details header details
PERFORM print_patn_details USING ls_final.
l_patient = ls_final-kunnr.
ENDIF.
Print the values of the patient details.
PERFORM print_values USING ls_final.
ENDLOOP.
&----
*& Form print_heading
&----
Print the heading, page number details.
----
FORM print_heading .
Display the company code address, page number and time details.
WRITE:/5 sy-uline(75).
WRITE: 111 sy-uline(31).
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: w_adrc-name1.
WRITE: 78 space.
FORMAT COLOR OFF.
WRITE: 79 sy-vline.
WRITE: 111 sy-vline.
FORMAT COLOR 5.
WRITE: 112 sy-datum, 124 sy-timlo, 141 sy-vline.
FORMAT COLOR OFF.
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: w_adrc-house_num1, ',', w_adrc-street, 78 space.
FORMAT COLOR OFF.
WRITE: 79 sy-vline.
WRITE: 111 sy-vline.
FORMAT COLOR 5.
WRITE: 112 text-t02, 124 sy-pagno.
FORMAT COLOR OFF.
WRITE: 141 sy-vline.
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: w_adrc-postcode1, ',', w_adrc-city1, 76 space.
WRITE: 79 sy-vline.
FORMAT COLOR OFF.
WRITE: 111 sy-uline(31).
WRITE:/5 sy-uline(75).
SKIP.
Display the title of the report and period details
WRITE:/5 sy-uline(61).
WRITE:/5 sy-vline.
FORMAT COLOR 5.
WRITE: 7 text-t03, 32 sy-vline, 34 text-t04,
40 s_period-low, 51 text-t05, 53 s_period-high, 65 sy-vline.
FORMAT COLOR OFF.
WRITE:/5 sy-uline(61).
ENDFORM. " print_heading
2007 Sep 11 8:59 AM
The demo program I provided is just to show you that the page numbers do in fact increase - I set the line count to just 10 (not usual!) and then the "do" loop is to force the write statements across 3 pages, so you get 3 page headings.
In your code, what is the "report" statement at the top of the program - that is where the line count would normally be defined.
Jonathan
2007 Sep 11 9:08 AM
Thanks a lot. Solved my problem.
Points awarded...
Thanks
Prakash Ghantasala
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |