09-16-2008 3:16 PM
Hi,
I want start a new page when new vendor in a list. I put this code but isn't ok i don't know why..
LOOP
IF LAST_VENDOR IS NOT INITIAL.
IF LFA1-LIFNR NE LAST_VENDOR.
LAST_VENDOR = LFA1-LIFNR .
NEW-PAGE.
ENDIF.
ELSE.
LAST_VENDOR = LFA1-LIFNR
ENDIF.
WRITE..............
ENDLOOP
Please help
09-16-2008 3:21 PM
hi,
I guess the internal table is sorted with lifnr, right? Than you could try this:
LOOP AT ...
WRITE ...
AT END OF lifnr.
NEW-PAGE.
ENDAT.
ENDLOOP.
hope this helps
ec
09-16-2008 3:22 PM
did you give LINE-COUNT for your report. Report needs to know how many lines are in each page.
Look at the sample code.
REPORT ztest LINE-COUNT 65.
DATA: lt TYPE TABLE OF pa0003 WITH HEADER LINE.
SELECT * FROM pa0003 INTO TABLE lt UP TO 10 ROWS.
LOOP AT lt.
AT NEW pernr.
NEW-PAGE.
WRITE:/ lt-pernr.
ENDAT.
ENDLOOP.
09-16-2008 3:26 PM
If your table is sorted by lifnr and this field is the first in you internal table
LOOP at itab.
at new lifnr.
NEW-PAGE.
endat.
WRITE..............
ENDLOOP
Tell me if this work.
09-16-2008 3:38 PM
09-16-2008 3:44 PM
09-16-2008 3:45 PM
should work...
as stated out already by Andrew, there are two prerequisites:
1. the internal tables has to be sorted by lifnr
2. lifnr has to be the first field of the internal table
you can copy your actual code here if still does not work
09-16-2008 3:47 PM
09-16-2008 3:49 PM
>
> I think the problem is LINE-COUNT but i put what number?
LINE-COUNT should not be the problem, you can forget it!
09-17-2008 9:23 AM