cancel
Showing results for 
Search instead for 
Did you mean: 

Missing columns in print preview of ALV Grid

Former Member
0 Kudos

In a report using ALV grid the output is ok in ALV grid when press print preview the 1st column is always missing and the 1st row shift by 1 character. Why is it happening. The same is happening in print out or when list saved in excel also.

the coding is like

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_interface_check = ' '

i_buffer_active = ' '

i_callback_program = i_repname

i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'

i_callback_pf_status_set = ' '

i_callback_user_command = 'FRM_ALV_USER_COMMAND'

i_structure_name = 'IT_REPORT'

i_background_id = ' '

is_layout = i_layout

it_fieldcat = i_fieldtab[]

it_sort = i_sort[]

i_default = 'X'

i_save = 'A'

is_variant = i_variant

it_events = i_events[]

is_print = i_print

tables

t_outtab = it_report.

Kindly resolve.

thanks

anya

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Anya,

Check this it may help you.

Thanks,

Reward If Helpful.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi everybody,

its not printer problem even when i keep 3-4 columns in layout as soon as i press print preview the ist row has some shifted characters and ist column is missing.

further for other ALV programs no such problem is appearing.

Kindly help

thanks

Former Member
0 Kudos

Check the structure created in your Fieldcatalog. if in the fieldcatalog, the source structure has different source internal table names, then the output is not very consistent. Pls check for this.

Cheers

L

Former Member
0 Kudos

Control parameters relevant for printing

PRINT

Value range: SPACE, 'X'

'X' = Print list and do not display it on the screen. Further settings can be made on the print parameter screen.

NO_PRINT_SELINFOS

Value range: SPACE, 'X'

'X' = Do not print existing selection information (see also LAYOUT-GET_SELINFOS)

NO_COVERPAGE

Value range: SPACE, 'X'

'X' = Print selection information and list status, if available, on a separate page.

NO_NEW_PAGE

Value range: SPACE, 'X'

Internal use only

RESERVE_LINES

Value range: 0, n

n = Number of lines output in the footer by the user during printout at END_OF_PAGE in the corresponding callback event.

NO_PRINT_LISTINFOS

Value range: SPACE, 'X'

'X' = Do not print list status (sort information, subtotals information and filter information).

NO_CHANGE_PRINT_PARAMS

Value range: SPACE, 'X'

SPACE = (default) The output format (number of columns) is dynamically adjusted depending on the list width (255 at most).

'X' = The current print parameters are always used. If the list is wider, the output width is not adjusted dynamically.

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_events.htm

http://www.erpgenie.com/sap/abap/controls/alvgrid.htm

if u give top_of_page and end_of page in reuse_alv_grid_display, u may see them in ur output but while printing u cant see them. u need to reserve some lines for them while printing.

Chk this link for more info:

Former Member
0 Kudos

Sample code:

REPORT ZALV_DISPLAY_CHANGE.

TABLES :T247.

TYPE-POOLS SLIS. "Type definitions for alv report

DATA: IT_FIELDCAT TYPE LVC_T_FCAT,

WA_FIELDCAT TYPE LVC_S_FCAT.

DATA: WA_LAYOUT TYPE LVC_S_LAYO.

DATA : BEGIN OF IT_FINAL OCCURS 0,

CHECK(1),

CELLTAB TYPE LVC_T_STYL, " Switch between display/change

MNR LIKE T247-MNR,

LTX LIKE T247-LTX,

END OF IT_FINAL.

DATA : WA_FINAL LIKE IT_FINAL.

DATA : W_REPID LIKE SY-REPID.

W_REPID = SY-REPID.

REFRESH IT_FINAL.

SELECT MNR LTX

FROM T247

INTO CORRESPONDING FIELDS OF TABLE IT_FINAL

WHERE SPRAS EQ 'E'.

WA_FIELDCAT-FIELDNAME = 'CHECK'.

WA_FIELDCAT-TABNAME = 'IT_FINAL'.

WA_FIELDCAT-CHECKBOX = 'X'.

WA_FIELDCAT-EDIT = 'X'..

WA_FIELDCAT-OUTPUTLEN = '3'.

WA_FIELDCAT-COL_POS = '1'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'MNR'.

WA_FIELDCAT-TABNAME = 'IT_FINAL'.

WA_FIELDCAT-OUTPUTLEN = '8'.

WA_FIELDCAT-COL_POS = '2'.

WA_FIELDCAT-REPTEXT = 'Month'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'LTX'.

WA_FIELDCAT-TABNAME = 'IT_FINAL'.

WA_FIELDCAT-OUTPUTLEN = '20'.

WA_FIELDCAT-COL_POS = '3'.

WA_FIELDCAT-REPTEXT = 'Month Desc'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

DATA: WA_CELLTAB TYPE LVC_S_STYL,

IT_CELLTAB TYPE LVC_T_STYL,

L_INDEX TYPE I.

CLEAR : WA_CELLTAB,WA_FINAL,IT_CELLTAB.

REFRESH IT_CELLTAB.

*Initialize the celltab table

LOOP AT IT_FINAL INTO WA_FINAL.

L_INDEX = SY-TABIX.

WA_CELLTAB-FIELDNAME = 'CHECK'.

WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.

INSERT WA_CELLTAB INTO TABLE IT_CELLTAB.

INSERT LINES OF IT_CELLTAB INTO TABLE WA_FINAL-CELLTAB.

MODIFY IT_FINAL FROM WA_FINAL INDEX L_INDEX.

ENDLOOP.

*Make the first five 5 rows as disabled

CLEAR L_INDEX.

LOOP AT IT_FINAL INTO WA_FINAL.

L_INDEX = SY-TABIX.

IF SY-TABIX LE 5.

LOOP AT WA_FINAL-CELLTAB INTO WA_CELLTAB.

IF WA_CELLTAB-FIELDNAME EQ 'CHECK' .

WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.

MODIFY WA_FINAL-CELLTAB FROM WA_CELLTAB.

MODIFY IT_FINAL INDEX L_INDEX FROM WA_FINAL TRANSPORTING CELLTAB.

ENDIF.

ENDLOOP.

ENDIF.

ENDLOOP.

WA_LAYOUT-BOX_FNAME = 'CHECK'.

WA_LAYOUT-NO_ROWMARK = 'X'.

WA_LAYOUT-STYLEFNAME = 'CELLTAB'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID

I_GRID_TITLE = 'GRID DISPLAY'

IS_LAYOUT_LVC = WA_LAYOUT

IT_FIELDCAT_LVC = IT_FIELDCAT

TABLES

T_OUTTAB = IT_FINAL

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

Please give me reward point If it is useful

Thanks

Murali Poli

Former Member
0 Kudos

Hi Anya,

Looks nothing wrong with the code. Can you just check your default printer settings in SAP.

Regards,

Atish