Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

alv grid field truncated for print preview

Former Member
0 Kudos

hi,

I have developed an alv report using grid display.

there are two fields in the output of length 20 each.

They get displayed correctly in grid format.

But, when on the output screen, I click on List menu and goto "Print Preview",

the output gets displayed in a list format where these two fields get displayed in a truncated format.

I have tried all options such as optimize colwidth and giving outputlen for the fieldcatalog.

But, still the problem persists, only for printing and print preview.

Please suggest a solution.

Thanks & Regards,

Tejas Savla

4 REPLIES 4

franois_henrotte
Active Contributor
0 Kudos

try to provide different parameters for printing

in function REUSE_ALV_GRID_DISPLAY and in method SET_TABLE_FOR_FIRST_DISPLAY of class CL_GUI_ALV_GRID it is parameter IS_PRINT

Former Member
0 Kudos

If you are using FM REUSE_ALV_GRID_DISPLAY.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = repid

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

IS_LAYOUT = gt_layout

IT_FIELDCAT = gt_fieldcat

IT_SORT = lt_sort

I_DEFAULT = 'X'

I_SAVE = 'X'

IT_EVENTS = it_events[]

IS_PRINT = printalv

TABLES

T_OUTABab = it_output

Declare printalv

DATA: printalv TYPE slis_print_alv

Thanks,

siddu

abapdeveloper20
Contributor
0 Kudos

Hi ronak,

Please follow the below Code . if you have all events implemented in your Code and compare for the Print event .

DATA: gt_events type slis_t_event,
gd_prntparams type slis_print_alv.

call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_events = gt_events 
is_print = gd_prntparams 
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.

perform build_events.
perform build_print_params.

&------------------------------------------------------------------
*& Form BUILD_EVENTS
&------------------------------------------------------------------

Build events table 
-------------------------------------------------------------------
form build_events.
data: ls_event type slis_alv_event.

call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.

read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS

&------------------------------------------------------------------
*& Form BUILD_PRINT_PARAMS
&------------------------------------------------------------------


Setup print parameters 
-------------------------------------------------------------------
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS

&------------------------------------------------------------------
*& Form END_OF_PAGE
&------------------------------------------------------------------
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.

write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.


&------------------------------------------------------------------
*& Form END_OF_LIST
&------------------------------------------------------------------
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.

skip.
write:/40 'Page:', sy-pagno .
endform.

Reward points if it is usefull ....

~Lakshmiraj~

Former Member
0 Kudos

Hi All,

Thanks for your replies.I have tried the various options given by some of you above,but still the problem persists.

Can anyone please suggest the best fit solution.

Thanks in advance.

Regards,

Tejas