ALV page break & Totals
Hi All,
I have a requirement to provide a Headcount of active employee for each benefit plan. I had extracted & populated the output table with the required fields and it needs to be printed in ALV grid with the total count of employee at benefit plan level.
For example:
Employee ID (P0002-PERID)...First Name (P0002-VORNA)...Personnel Area (P0001-WERKS)...Personnel Sub Area (P0001-WERKS)...Benefit Plan (P0377-BPLAN)...Start Date (P0377-BEGDA)...End Date (P0377-ENDDA)
The above fields are columns.
Each benefit plan should start in new page and the total (number of employee) in that plan at the end.
Please help me in acheiving the above requirement.
Thanks in advance.
Satish
Hi,
Please guide me.
Satish
Similar Messages
-
Dear SDN,
I found lots of posts with this title, however, after following all the instructions, my ALV does not show any page break.
Using input table IT_SORT of the ALV Function Module.
WA_SORT-FIELDNAME = 'PSPID'.
WA_SORT-SUBTOT = 'X'.
WA_SORT-GROUP = '* '.
APPEND WA_SORT TO IT_SORT.
What might be missing?
How should this page break come up?
Thank you.
Regards,
Fabiohi,
Check the below link
page break in ALV
Page break Ups in ALV reports
PS-> In ALV grid, we will not be able to see the page breaks on the screen. Once we convert the ALV grid to u201CList Outputu201D,we can see the page breaks or during print from the ALV grid.
Reagrds,
Nagaraj -
Hello! Could someone please help me with this one?
I have an ALV report that requires to have a page break every N lines. I've checked initially with similar posts on the forum, but so far all the solutions I've seen are based on the SORT-GROUP field. Has anyone discovered how to do the page break based on the line number?
Also, there's something weird with the scrolling of my report. Whenever I click the next page button, or press the Page Down, it goes to the very end of the report output. Do I need to set something in order for the page down/up to function properly?
Thanks very much in advance.Hi,
Please take a look at a previous post at Re: New Page in ALV for Value Change on a Field on the same topic.
Hope it helps.
Regards
Jayant -
ALV Page Break when Catagory Changes (ie SO # change)
I will have an ALV report with a Sale Order # on a header section and line items associated for the header SO#, and when a different SO# occurs it will go to next page and display the next SO# on header section and the item info on the main body. Is this possible and how would I set this up? (not using OO). Thanks in advance.
Hi,
Try this..
Add a row for the sales order # field to the sort internal table T_SORT and pass it in the parameter IT_SORT..
DATA: T_SORT TYPE LVC_T_SORT.
DATA: S_SORT TYPE LVC_S_SORT.
S_SORT-SPOS = '1'.
S_SORT-FIELDNAME = 'VBELN'. "Sales order #
S_SORT-UP = 'X'.
S_SORT-GROUP = '*'. "This will trigger a page feed
APPEND S_SORT TO T_SORT..
Thanks,
Naren -
ALV how to display page no in every page - Page break
Hi All
I would like to know how can i write an ALV page no in each of the page.
Currently i manage to write the page no in the top , but only show "Page No : 1 "
but when i send to spool the All the page no will break into "Page No : 1 , Page No :2 and up to end page .
thank youHi Check this program.
A Simple ABAP ALV LIST VIEWER Example
This ALV program have all the basic report requirements such as page heading, page no, sub-total and a grand total.
This is a basic ALV with the followings:-
- Page Heading
- Page No
- Sub-Total
- Grand Total
REPORT ZALV.
TYPE-POOLS: SLIS.
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
COL_POS TYPE I.
DATA: BEGIN OF ITAB,
FIELD1(5) TYPE C,
FIELD2(5) TYPE C,
FIELD3(5) TYPE P DECIMALS 2,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB_FIELDCAT.
Print Parameters
PARAMETERS:
P_PRINT AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
P_RESERV TYPE I. "NO OF FOOTER LINE
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
START-OF-SELECTION.
TEST DATA
MOVE 'TEST1' TO ITAB1-FIELD1.
MOVE 'TEST1' TO ITAB1-FIELD2.
MOVE '10.00' TO ITAB1-FIELD3.
APPEND ITAB1.
MOVE 'TEST2' TO ITAB1-FIELD1.
MOVE 'TEST2' TO ITAB1-FIELD2.
MOVE '20.00' TO ITAB1-FIELD3.
APPEND ITAB1.
DO 50 TIMES.
APPEND ITAB1.
ENDDO.
END-OF-SELECTION.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
FORM BUILD.
DATA FIELD CATALOG
Explain Field Description to ALV
DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD1'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
*FIELDCAT_LN-NO_OUT = 'X'. "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD2'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-NO_OUT = 'X'.
FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD3'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
FIELDCAT_LN-REF_TABNAME = 'MSEG'. "<- REF TABLE IN THE DICTIONNARY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-DO_SUM = 'X'. "SUM UPON DISPLAY
APPEND FIELDCAT_LN TO GT_FIELDCAT.
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM.
FORM CALL_ALV.
ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT = GS_PRINT
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM.
HEADER FORM
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
define END_OF_PAGE event
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM.
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'HEADER 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-KEY = 'STATUS 1'.
GS_LINE-INFO = 'INFO 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
GS_LINE-KEY = 'STATUS 2'.
GS_LINE-INFO = 'INFO 2'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'A'.
GS_LINE-INFO = 'ACTION'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
ENDFORM.
FORM END_OF_PAGE.
WRITE at (sy-linsz) sy-pagno CENTERED.
ENDFORM.
PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = P_PRINT. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = P_NOSINF. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = P_NOCOVE. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = P_NONEWP.
LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = P_RESERV.
ENDFORM.
*END OF ZALV PROGRAM
Reward if it helps you. -
Problem with Page Break In ALV Report
Hi
I have got a problem in my ALV report. I have a checkbox in the user input screen where users decide whether they want a page break or not in the print preview (or print) page. Now i also have the option to have layout name in the input screen. so If i leave the layout box empty the check or not check of page break works fine. but if use a save layout name in the layout box the add check box doesn't work anymore. If i have a layout name in the layout box it doesn't matter whether i have checked for page break or not it does the same thing.(in one report it always puts the page breaked)
Any ideas where to look for the error?
here is the code for the page break. Opt5 is the check box.
perform build_sort tables pt_sort changing ls_sort.
ls_sort-fieldname = 'PERNR'.
ls_sort-subtot = 'X'.
IF OPT5 = 'X'.
ls_sort-GROUP = '*'.
ENDIF.
append ls_sort to pt_sort.
ls_sort-subtot = ' '.
ls_sort-GROUP = ''.Never mind it was acting like the page break was not working because the layout was saved with the page break on/OFF.
-
Page break and Subtotal display in alv
Kindly provide me the resolution for the following issue at your earliest
Issue:
I am sorting the alv list based on invoice payment date with subtotals.
and i need a page break for every new invoice payment date.I have achived
the same by following code but now subtotals are displaying in the new page
first line rather i need subtotals at end of each page.
Thanking you.
Regards
Ravishekar.Thallapally
Mobil:09866887298.
*& Form sub_Build_sort_catalogue
Building Sort Catalog
<-- L_T_SORT : Internal table for sort catalog
FORM sub_build_sort_catalogue CHANGING l_t_sort TYPE slis_t_sortinfo_alv.
DATA: l_v_sortcat TYPE slis_sortinfo_alv.
CLEAR l_v_sortcat.
Sort the fields with Planned Incoming Payment in alv
l_v_sortcat-spos = '1'.
l_v_sortcat-fieldname = 'FAEDT'.
l_v_sortcat-subtot = 'X'.
l_v_sortcat-up = 'X'.
APPEND l_v_sortcat TO l_t_sort.
CLEAR l_v_sortcat.
Sort the fields with Planned Incoming Payment in alv
l_v_sortcat-spos = '002'.
l_v_sortcat-fieldname = 'INV_REF'.
l_v_sortcat-subtot = 'X'.
l_v_sortcat-up = 'X'.
APPEND l_v_sortcat TO l_t_sort.
CLEAR l_v_sortcat.
ENDFORM. " sub_Build_sort_catalogue
*& Form sub_after_line_output
Appending another event 'AFTER_LINE_OUTPUT' to g_t_events
-->L_T_OUTPUT : Internal table with output data
<--L_T_EVENTS : Internal table with events
FORM sub_after_line_output USING l_t_output TYPE ty_t_output
CHANGING l_t_events TYPE slis_t_event.
DATA: l_v_event TYPE slis_alv_event.
l_v_event-name = 'AFTER_LINE_OUTPUT'.
l_v_event-form = 'SUB_AFTER_LINE_OUTPUT1'.
APPEND l_v_event TO l_t_events.
ENDFORM.
*& Form after_line_output
After line output event is handled via this form
L_V_LINE : Capturing line value for page break.
FORM SUB_after_line_output1 USING l_v_line TYPE slis_lineinfo. "#EC CALLED
DATA: l_index1 LIKE sy-tabix,
l_index2 LIKE sy-tabix.
FIELD-SYMBOLS: <l_fs_output1> TYPE ty_output,
<l_fs_output2> TYPE ty_output.
CLEAR l_index1.
l_index1 = l_v_line-tabindex.
READ TABLE g_t_output INDEX l_index1 ASSIGNING <l_fs_output1>.
IF sy-subrc = 0.
CLEAR l_index2.
l_index2 = l_index1 + 1.
READ TABLE g_t_output INDEX l_index2 ASSIGNING <l_fs_output2>.
IF sy-subrc = 0.
IF <l_fs_output1>-FAEDT <> <l_fs_output2>-FAEDT .
WRITE: sy-uline.
NEW-PAGE.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " after_line_output
*& Form Sub_display_alv_list
Displaying the ALV list
-->L_T_FIELDCATALOG : Itab with Field Catalog
-->L_T_LAYOUT : Itab with Layout Records
-->L_T_OUTPUT : Itab with Output Data
-->L_T_EVENT : Itab with Event Catalalog
FORM sub_display_alv_list USING l_t_fieldcatalog TYPE slis_t_fieldcat_alv
l_t_layout TYPE slis_layout_alv
l_t_sort TYPE slis_t_sortinfo_alv
CHANGING l_t_event TYPE slis_t_event
l_t_output TYPE ty_t_output .
*Set Report Title.
g_v_title = 'AR Clearing Doc. Details'.
*Perform for after line output
PERFORM sub_after_line_output USING l_t_output
CHANGING l_t_event .
*CALL TO FM REUSE ALV LIST DISPLAY
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
is_layout = l_t_layout
it_fieldcat = l_t_fieldcatalog
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = l_t_sort
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = l_t_event[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = l_t_output[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " Sub_display_alv_listDear Friends,
I have got the solution from my technical lead for the below issue, I like to share this resolution with you all.
Best Regards,
Ravishekar.Thallapally
*& Form after_line_output
After line output event is handled via this form
L_V_LINE : Capturing line value for page break.
FORM sub_after_line_output1 USING l_v_line TYPE slis_lineinfo."#EC CALLED
DATA: l_v_int TYPE int1.
IF l_v_line-sumindex IS NOT INITIAL .
l_v_int = l_v_line-sumindex MOD 2 .
IF l_v_line-subtot = 'X' AND l_v_int = 0.
Write:/ sy-uline.
NEW-PAGE.
CLEAR:l_v_int.
ENDIF.
ENDIF.
ENDFORM. " after_line_output -
ALV: How do I suppress repeating values and page breaks on printed output?
Good day, everyone!
First, I've done a LOT of searching trying to find the answer to my question, but I'm not finding an answer. If this has already been answered and you can point me to a URL, I would appreciate it.
Here's my issue: I have a rather simple ALV report. It has the columns of Person ID, Personnel Number, For Period, In Period, and Amount. I sort by Person ID and Personnel Number, and if the value repeats on the next line of the report, I want to suppress it (make it blank).
I thought the answer was in the following code, where I set the GROUP attribute to asterisk:
CLEAR sortcat_ln.
sortcat_ln-spos = '1'.
sortcat_ln-fieldname = 'PERSONID_EXT'.
sortcat_ln-up = c_true.
sortcat_ln-group = '*'.
APPEND sortcat_ln TO sortcat.
CLEAR sortcat_ln.
sortcat_ln-spos = '2'.
sortcat_ln-fieldname = 'PERNR'.
sortcat_ln-up = c_true.
sortcat_ln-group = '*'.
APPEND sortcat_ln TO sortcat.
It looks PERFECT on the screen -- the values are suppressed if they repeat, and everything appears together on one screen. However, when I print the report, two things happen: 1) The values repeat on each row, even if they are the same, and 2) I get a page break after each Person ID / Personnel Number combination.
I now realize that I can't use the GROUP attribute. Is there some other way in ALV to blank these repeating values and keep all the rows together on one page, rather than page breaking after each value change?
Thanks!
DaveHi
Same requirement i had before, when i try to print preview. the output of the grid display is in grouping is ok, but when i print preview or print it doesnt cater the grouping and page breaks, so what i did i modify the internal table use in alv , after hitting the print preview/print with the format desired by the user. you can do that in user-command. see code below
FORM user_command USING r_ucomm TYPE syucomm
rs_selfield TYPE slis_selfield.
DATA lt_sort TYPE lvc_t_sort.
CASE r_ucomm.
WHEN '&RNT_PREV' OR '&RNT'.
t_final_x[] = t_final[].
PERFORM clear_redundant.
PERFORM set_sort_criteria USING lt_sort.
WHEN '&F03' OR '&PRINT_BACK_PREVIEW'.
t_final[] = t_final_x[].
WHEN OTHERS.
ENDCASE.
ENDFORM. "user_command
hope it helps -
Page-break in alv background job for alv output variant not coming correctl
Hi,
I have created an ALV grid report. When i run the report in background i get the output with correct page-break on FIELD1. Now when i run the report in background with an "ALV output variant" (its the ALV variant that controls the fields display in the output; this is not the program variant), i do not get the page-break on FIELD1. I have already build the sort criteria and using:
gs_sort-group = '* '. "New-Page
Please let me know what could be reason for not getting the page-break in background when i am using the alv output variant and how do i correct this problem.
Regards,
RakeshHello Everyone,
I have solved the problem. While running the program in background, we get the page-breaks when we use the below part of code in the sort catalogue with the condition that the program variant should not use any ALV layout variant.
gs_sort-group = '* '. "New-Page
If you are using the ALV layout variant in the program variant then we can check the ROWPOS, COLPOS, and NO_OUT for that ALV layout variant and pass them along in the fieldcatalog table. You should be careful with not to pass the layout variant in the DISVARIANT. You can notice that i have cleared it and simply passing the program name into that.
*C-- Process separately for jobs running in Background. Actually
*C-- sortcat-group solves the problem only in Foreground. In background
*C-- when ALV layout variant is not selected then it works otherwise it
*C-- fails. So for background jobs we are reading the fieldcat and then
*C-- passing the same in the display FM.
IF sy-batch = 'X'.
CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
EXPORTING
i_dialog = ' '
i_user_specific = ' '
i_default = ' '
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
it_default_fieldcat = gt_fieldcat
i_layout = gs_layout
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
IMPORTING
* E_EXIT =
et_fieldcat = lt_fieldcat
* et_sort = gt_sort[]
* ET_FILTER =
* es_layout = gs_layout
CHANGING
cs_variant = gs_disvariant
EXCEPTIONS
wrong_input = 1
fc_not_complete = 2
not_found = 3
program_error = 4
OTHERS = 5
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR gs_fieldcat.
LOOP AT gt_fieldcat INTO gs_fieldcat.
*C-- Transfer all position changes to gt_fieldcat from lt_fieldcat
CLEAR ls_fieldcat.
READ TABLE lt_fieldcat
INTO ls_fieldcat
WITH KEY fieldname = gs_fieldcat-fieldname.
IF sy-subrc = 0.
gs_fieldcat-row_pos = ls_fieldcat-row_pos.
gs_fieldcat-col_pos = ls_fieldcat-col_pos.
gs_fieldcat-no_out = ls_fieldcat-no_out.
MODIFY gt_fieldcat FROM gs_fieldcat INDEX sy-tabix.
CLEAR gs_fieldcat.
ENDIF.
ENDLOOP.
*C-- Clear the disvariant for the background job as it contains the ALV
*C-- layout varinat
CLEAR gs_disvariant.
gs_disvariant-report = 'ZGPPMP0001'.
Then pass gt_fieldcat to 'REUSE_ALV_GRID_DISPLAY'.
The reason i'm doing it this way is that when we pass the layout variant name, the contents in gt_fieldcat were getting modified.
One more thing i'd like to point out is that that, i tried to delete the fields with no_out = 'x'. Now when i ran the program in background with all the fields in sort catalog (suppose there are 2 fields field1 and field2) also in fieldcatalog it ran fine. In the next run in background i removed one of the fields in sort catalog from the fieldcatalog (delete the fields with no_out = 'x') and i got dump. Basically i had hidden field1 and so the code which was deleting fields with no_out = 'x' deleted this field from gt_fieldcat. So basically we should not delete fields with no_out = 'x'.
I was getting ABAP runtime errors MESSAGE_TYPE_X in the following part of the standard code.
000310 LOOP AT CT_SORT INTO LS_SORT.
000320
000330 READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
000340 WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
000350 IF SY-SUBRC NE 0.
> MESSAGE X000(0K).
000370 ENDIF.
000380
000390 LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
i have just mentioned this part because when i checked the forum many people were getting such errors "MESSAGE_TYPE_X". This could also be one of the reasons. -
INSERT 'PAGE BREAK' AT CHANGE IN EACH TOTAL
Hi...
Does anyone know a way of inserting a page break at each change in a total on a report, so when the report is printed it prints each section (i.e. each time it finds a total) on a separate page.
I also want to print the report title on each page if possible.
The disco. version I am using is 4.1
I would appreciate any help on this. Thanks.Hi,
A 'total' on a report is based on a group item, e.g. By department, region, category, etc.
Make this group item a 'Page item' and you have a separate page for each group.
Regards,
John -
How to give a page break in alv grid display after 65 lines are displayed?
hi all,
I need to give a page break in alv grid display after 65 lines are displayed on each page...Please help me with this...hai
give this command beging of the report name... u have to diclar the beging of the report ......
<b>report</b> ( name of the report) <b>standard page heading line-size 200 line-count 65.</b>
ex1.:- report name is rtpm_trl_show_flows
report <b>rtpm_trl_show_flows </b> no standard page heading line-size 200
line-count 65.
ex:2
report <b>zlpur01</b> no standard page heading line-size 200
line-count 65.
type-pools: slis.
tables: bkpf.
selection-screen begin of block sel with frame title text-001.
select-options: s_comp for bkpf-bukrs, " Company
s_valut for bkpf-budat. " Invoice Date
S_MTART FOR MARA-MTART. " Material Type
selection-screen end of block sel.
parameters: p_vari like disvariant-variant. " ALV Variant
constants: formname_top_of_page type slis_formname value 'TOP_OF_PAGE'.
data: i_bseg type bseg occurs 0 with header line.
data: vatval type p decimals 2 value '0.15'.
data: xhkont type string value '154000'.
data COM type c.
data: begin of invt occurs 100,
budat like bkpf-budat, " Inv Dat
bukrs like bkpf-bukrs, " Material
STCEG like bsak-STCEG, "name of the companycode
belnr like bkpf-belnr,
xblnr like bkpf-xblnr, " Inv Reference
ebeln like rseg-ebeln, " PO number
lifnr like bseg-lifnr, " Vendor No
name1 like lfa1-name1, " Supplier Name
matnr like bseg-matnr,
maktx like makt-maktx,
stcd1 like lfa1-stcd1, " Supplier VAT REG NO
xamt like bseg-dmbtr, " TAX amt
yamt like bseg-wrbtr,
wrbtr like bseg-wrbtr, " Base amount
mwskz like bseg-mwskz,
dmbtr like bseg-dmbtr, " TAX amt
gjahr like bkpf-gjahr,
hkont like bseg-hkont,
zamt like bseg-dmbtr, " TAX amt
wamt like bseg-dmbtr,
shkzg like bseg-shkzg,
shkzg1 like bseg-shkzg,
end of invt.
regard
nawa -
Prevent Occurence of list header and page breaks in spool file of ALV Grid
Prevent Occurence of list header and page breaks in spool file of ALV Grid Display.
When we run the ALV in background and create spool request then:
Spool file output is coming like this.
Column1 Column2 Column3 Column4
data data data data
data data data data
data data data data
Column1 Column2 Column3 Column4
data data data data
data data data data
data data data data
But the required is like this
Column1 Column2 Column3 Column4
data data data data
data data data data
data data data data
data data data data
data data data data
data data data data
Please suggest a posible answerHello all,
if you have not yet solved this on your own, here is my solution: use a format type that has 60000 lines per page for your spool output device.
It all depends on the format type that was used for creating the spool output.
By default (in our system), we have 65 lines per page. And after each page the column headings of the ALV will appear.
What i did:
create a new format type via transaction SPAD->full administration->device types->format types (copy an existing one)
change"Number of Rows" to 60000 or something applicable
edit the device type of your output device (e.g. LOCL) to contain the newly created format type (via SPAD; Button "Formats" in device type maintenance).
That's it! Be sure to use this format type for your output device in the "Background Print Parameters" window (-> Button "Properties").
Regards
Daniel Klein
All other parameters you discussed before didn't do it. All ALV-Settings will be overwritten by the output device settings and its print properties. -
Hi .
I am facing problem in displaying a particular layout in ALV.
the layout is as follows:
1. Header part
2. Line item
3. There is field customer and after every change of customer do page break and display information like how many record read and how many record processed. below is brief detail about how to get read and processed record.
I have two internal table say table1 and table2.
Looping table1
increase the counter as counter_read = counter_read +1.
compare the record with table2.
if matches
increase the counter as counter_process = counter_process + 1.
4. At the end of report display a error log.
to get the error log we will follow the above logic and if record not matched then display as error record.
Please help ASAP to find the solution.
Thanks in advanceThere is a knowledge base article C2014229 (1210986 - Subreports do not have a Page Header) , but instead of providing link I will just copy content here:
Symptom
Since subreports are objects in the Main Report, they do not contain Page Headers. How can you create a fake page header for subreports?
Resolution
To create a fake page header for subreports, use the following steps:
1. In the subreport, create a formula:
@FakePageHeader
//name of formula
WhileReadingRecords;
2. Go to the 'Insert' menu and click 'Group'. Select the @FakePageHeader formula.
3. Select the 'Repeat Group Header on Each New Page' option, and click 'OK'.
This inserts a new group at the lowest, or innermost, grouping level. You will need to move this group to the highest, or outermost, grouping level.
4. Go to 'Report' menu and click 'Group Expert'. Use the up arrow to move this newest group up to the top of the list.
5. Move all the headers that you would like repeated into this Header for the @FakePageHeader group.
Hope it will help. -
Problem with printing ALV - repetitive page breaks
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.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. -
How to supress top of page in ALV during page breaks...
Hello Experts,
I am currently developing a report using the old ALV(REUSE_ALV_LIST_DISPLAY) since
I need to have page breaks(using the SORT event) depending on the sort criteria. But
I noticed that for every page break, the top of page automatically displays. I only
need to display it one or depending on other factors.
So how do we supress top of page event?
Thank you guys and take care!Hi Viraylab,
Try out like this ..
1. Declare a global variable g_flag = 0.
2. if g_flag = 1.
top-of-page.
your heading.....
and default g_flag = 0.
endif.
3. *your Output
Perform display.
4. Form display.
Your --- Code...
g_flag = 1.
endform.
Regards,
sg
Maybe you are looking for
-
Delivery quantity greater than confirmed quantity in sales order
Hi experts, Quantity in delivery order can be changed to more than the confirmed quantity in sales order when there is sufficient stock. (Setting "Check overdelivery" in 0VLP already maintained "B-Situation rejected with an error message"). Anyway in
-
Error in transaction code ABAON
Dear all, my user gets an error while he is running ABAON tc, its an ABAP runtime error GETWA_NOT_ASSIGNED Pls kindly assist me
-
Java mapping - Setting the name of the file dinamically
Hi all, Problem: I know how to set the name of the file in an Idoc to file interface if I'm using a message mapping, but not if I'm using a Java mapping. I'm using this code inside a user-defined function of the message mapping so that I can set the
-
No picture on contacts imported from Hotmail in iPhone 5
Hello I'm new owner of iPhone 5 and I love it, but althought i have some question, basically my question now is, why the picture of my contacts from Hotmail are not imported? I can see that the contacts are sync'ed both way so i like that, BUT some e
-
Oracle 10g installation error in WINDOWS7
Hi, When am trying to install 10g in my PC, I am getting following error. Abnormal program termination. An internal error has occured. Please provide the following files to oracle support" "Unknown" "Unknown" "Unknown" Please help me out on this. Tel