2005 Feb 06 1:20 PM
i have Report, listing Records each time with
header as company code at the top
see below format.
Companycode :200.
Business Area :011A.
GL account Code : 12345678.
Date Document no. Amount ......
2005/01/02 300001 1000 ......
Companycode :200.
Business Area :130B.(different Value)
GL account Code : 12345678.
Date Document no. Amount ......
2005/01/02 300001 1000 ......
Companycode :300.(different company code)
Business Area :011A.
GL account Code : 12345678.
Date Document no. Amount ......
2005/01/02 300001 1000 ......
it goes like this...
But in report they code the header part in TOP-OF-PAGE.
could you pls confirm does Header part display each time
in program in listing report.
my thinking is top-of-page display only once at top
in listing. is it not?
let me give outline report structure as below.
Report Ztxxxxx.
Start-of-selection.
Loop itab_t001(Internal table with Companycode.)
Perform make data.
Perform listdata. (details output itab_data internal table)
endloop.
TOP-OF-PAGE.
read table itab_t001 with key itab_data-bukrs.
write itab_Data-bukrs.(company code)
write itab_data-gsber.(business area)
write itab_data-hkont.(GL account code.)
Form makedata.
loop....
endform
Form listdata.
loop....
endform.
ambichan.
2005 Feb 06 4:13 PM
TOP-OF-PAGE is fired when the program encounters its first "write" statement. If in the REPORT statement at the top of the program, there is a LINE-COUNT extension, the program will fire the TOP-OF-PAGE event when the LINE-COUNT has be exceeded. Example, say you have a report which is 132 characters wide by 65 lines, program will write the header at the begining of the report and after every 65th line. By setting the LINE-COUNT, you are telling the program to change page numbers every 65 lines.
From what I see in your program, the TOP-OF-PAGE will only be fired once.
Hope this helps.
Regards,
Rich Heilman
2005 Feb 06 5:14 PM
Hi
Rich is right. Moreover, if you want your "<b>TOP-OF-PAGE</b>" event triggered only once at the beginning of the report, use:
TOP-OF-PAGE .
IF sy-pagno = '1' .
*--include your top_of_page coding here
ENDIF .
However, I am still not sure your requirement is this. Why do you write something from the internal table at top_of_page. Generally, general report data (e.g. selection criteria, date, user name, etc. are written there)
May be what is done (since the code you wrote is an outline and this may occur at other parts) is to group the report list content and at a control level execute a <b>"NEW-PAGE"</b> statement which will also trigger the "<b>TOP_OF_PAGE</b>" event with the next "WRITE" statement.
Hope this helps...
*--Serdar
2005 Feb 07 3:41 PM
Hi,
As per your Logic the Top-of-page will be triggered once for each page. But if you want to have header for each new entry based on Company code and Business area..
then use control break statements in your program.
Instead of writing the headings in Top-of-page... write the headings in the Loop and Endloop statements.
The program structure will be as below...
sort itab_data by bukrs gsber.
loop at itab_data.
v_index = sy-tabix.
at new gsber.
read table itab_data index v_index.
write:/ 'company code:",itab_data-bukrs.
write:/ 'business area:',itab_Data-gsber.
write:/ 'GL Account:',itab_data-hkont.
endat.
endloop.
I hope the above code could be of use to you..
Regards,
Vara