09-15-2008 11:14 AM
Hi,
I have a problem with ALV during printing or print preview. First, let me describe the situation. My requirement was to have a page break for every Material Number. This was working fine already. However, the user had a change of heart and decided he didn't want to have a page break for every material. Now, they wanted only one page for all materials.
I thought this was easy to do since I only needed to comment out the SORT (and all codes related to SORT) table that was used to create the page-break. Thing is, it's not working anymore. Although I was able to display one table only, the old page breaks still appear! For example, if there were 7 materials before, therefore, 7 page breaks with 7 blocks of internal tables. Now, only 1 full internal table is displayed while the other 6 are empty! Please help me how to get rid of the other tables or page breaks.
I hope this is clear. Thanks. I appreciate all the help I can get.
09-15-2008 11:16 AM
Are you passing the SORT table to ALV function.
SORT-GROUP = '*' . "Comment this option.
Check properly...once again.
09-15-2008 11:21 AM
Hi Vijay,
Thanks for your quick response. The answer is - yes, I already did that. Actually, I commented out all codes relating to SORT table in ALV. Still did not work. =(
09-15-2008 11:29 AM
09-15-2008 11:43 AM
Hi again,
I'm afraid the code is rather long. Would it be alright if I'll send it to you via email?
Anyways, I have some updates. I have checked other variants, and it's working ok on some. But not in one particular variant! It's getting rather confusing.
Anyways, to give you a full picture. Imagine I have three variants:
1) Variant A - 7 materials
2) Variant B - 3 materials
3) Variant C - 5 materials
For variant A, it's not working ok. The other 6 page breaks keep appearing even if the tables for those are empty.
For variant B, it's working fine. The other 2 page breaks didn't appear.
For variant C, two page breaks appear. I have counted the materials and it gives a page break on the 50th item. Is this normal? Is it by default that page breaks appear for every 50th item?
Thanks a lot.
09-15-2008 12:45 PM
Then the Page Breaks are Triggering from Variant level , not from the Code.
Try to Delete the Variants and Create new Variants.
09-15-2008 12:59 PM
>
> Then the Page Breaks are Triggering from Variant level , not from the Code.
Vijay
Is there any possibility of dependency of page-break on variant?
if it is so..can you pls tell how ,that would be great addin for us(me).
Cheers
09-15-2008 1:15 PM
Amit,
Using sort option.
Do one thing. Just create one ALV program with SORT options anf GROUP = '*'.
Now go to output and save the Variant. Print the report.
with out sort option and variant.
Now come back and Delete the sort options , activate the code.
And see the output. Choose the variant which you created beofre. and print the report.
See both the case. it triggeres the same output. you just copy paste it and un comment the commented sort code
Just test with this code,
REPORT zalv_total_sub.
TYPE-POOLS: slis.
INCLUDE <icon>.
DATA: layout TYPE slis_layout_alv .
DATA: BEGIN OF it_flight OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
END OF it_flight.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fcat LIKE LINE OF it_fieldcat.
DATA: it_sort TYPE slis_t_sortinfo_alv,
wa_sort LIKE LINE OF it_sort.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_FLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_flight
.
wa_fcat-do_sum = 'X'.
MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
WHERE fieldname = 'SEATSOCC' .
CLEAR wa_fcat.
*wa_sort-fieldname = 'CONNID'.
*wa_sort-up = 'X'.
*wa_sort-group = '*'.
*wa_sort-subtot = 'X'.
*APPEND wa_sort TO it_sort.
*CLEAR wa_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_save = 'X'
i_callback_user_command = 'USER_COMMAND'
is_layout = layout
it_fieldcat = it_fieldcat
it_sort = it_sort
TABLES
t_outtab = it_flight
EXCEPTIONS
program_error = 1.
09-15-2008 1:22 PM
Hi Vijay,
Correct me if I'm wrong, but are you saving the Variant of the layout?
In my case, the variant that I'm talking about is the Variant in the selection-screen - the one for each test data.
Is the page-break dependent also on these variants?
09-15-2008 1:32 PM
If a person who is asking some ALV related stuff and Talking about Variants then which one i should think you are speak ing about.
The chances are there , when your selection screen consists of ALV variant , and that variant you are passing it to ALV function then it definitely influence the output.
09-15-2008 2:33 PM
Hi Vijay,
I have deleted and recreated the variant. Still it's not working... Anyways, I really do appreciate your help. Thanks a lot. 😃