Printing in ALV Grid
Hi experts,
When I'm printing ALV table, fonts are that small, that it is difficult to read the text. Any ideas how can control this?
Thanks in advance,
Michal
hI,
you can do this if you have the class CL_DD_DOCUMENT
for reference check the example in SE38
DD_STYLE_TABLE
Or
Use the IT_SORT paramter of the ALV function module..
define an internal table of type it_sort in your program..
for this pass the field name 'PERNR' AND append it...
and give this table to the FM.....
data:
t_sort type SLIS_T_SORTINFO_ALV,
w_sort type slis_sortinfo_alv.
w_sort-fieldname = 'PERNR'.
w_sort-up = 'X'.
append w_sort to t_sort.
w_sort
You will get the required output...
you may increase font size using CL_DD_DOCUMENT only for grid header and bottom area, it will not have any effect on the cells.
Inside the cells, the font and it's size is derived from SAPGUI settings (and monitor size).
In the cells you can set standard character atrributes color, intensied and inverse.
Regards
vasu
Similar Messages
-
Re: Increasing Column Header Length While Printing in ALV Grid
Hi
For some column headers in a report, the translations in Turkey are more than 40 characters, because of which while executing the report in TR language, the column header is getting truncated.
So, I would like to know if we can increase the column header length while printing the ALV Grid(OO ALV) output.
Or else, Is there any way where we can divide the column header into 2 rows.
Please let me know.
Thanks and Regards,
Vishwa.Jose and Sivaram,
Thanks for replying.
The problem we have is with the column headers, there is a limit of 40 characters for the column header in ALV reports. So, increasing the outputlen also did not help.
Regards,
Vishwa. -
Hi Friends,
I am facing a problem while printing a report from ALV grid .. The report display is coming perfectly based on the SORT criteria .. but while trying to print or print preview or Download to Excel the sorting is not working .. If any one know how to print the report as it look like the screen display ..Please let me know..
Thanks in advance..
Regards.
ElangoHi Vinni,
Thanks for your repaly , I am using 4.7.
Function module used to display grid is REUSE_ALV_GRID_DISPLAY and for
build the field catlog I am using REUSE_ALV_FIELDCATALOG_MERGE
function module .
Regards,
Elango -
Hi,
I am using ALV List and ALV grid in one of my custom reports.
There is no issue with ALV List when I print the report after running the program.
But when I use ALV Grid , the report runs good and when I try to print the report I get short dump "OBJECTS_NOT_CHARLIKE" in program "LKKBLF99" of the main program "SAPLKKBL".
I am using the function module "REUSE_ALV_GRID_DISPLAY" to run the report using ALV Grid and I get the above short dump when I try to print the report.
Can anyone help me please?
Thanks,
Ashok.Hai Ashok
Try with the following Code
*& Report ZALV_GRID *
REPORT ZALV_GRID .
TABLES: MARA.
TYPE-POOLS : SLIS.
Data declaration
DATA: BEGIN OF I_MARA OCCURS 0.
INCLUDE STRUCTURE MARA.
DATA: END OF I_MARA.
DATA: V_REPID LIKE SY-REPID.
selection-screen
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
SELECTION-SCREEN END OF BLOCK B1.
initialisation
INITIALIZATION.
S_MATNR-LOW = '1400'.
S_MATNR-HIGH = '1500'.
APPEND S_MATNR.
V_REPID = SY-REPID.
start-of-selection
START-OF-SELECTION.
SELECT * FROM MARA
INTO TABLE I_MARA
WHERE MATNR IN S_MATNR AND
MTART = P_MTART.
CHECK SY-SUBRC = 0.
end of selection
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'MARA'
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
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 = I_MARA
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks & Regards
Sreenivasulu P -
Hello All,
I want to print data on an alv grid to spool according the current layout using code.
Can anyone give me suggestion, maybe some sample code?
Thanks in advance,
AlexHi,
I have 2 ALV grid in the screen and pront to spool of both ALV's using OOp.
Please find sample code. Whenever report runs in the background i simply call this print subroutine after creating fieldcatalog, layout, sorting table etc.
FORM list_append TABLES ut_table
USING u_no TYPE char1
u_tabname TYPE slis_tabname.
IF u_no CA '13'.
MOVE 'TOP_OF_PAGE' TO ls_event-name.
CONCATENATE 'TOP_OF_PAGE' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ELSE.
MOVE 'TOP_OF_LIST' TO ls_event-name.
CONCATENATE 'TOP_OF_LIST' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
it_fieldcat = lt_fieldcat
is_layout = ls_layout
i_tabname = u_tabname
it_events = lt_events
it_sort = lt_sort
* i_text =
TABLES
t_outtab = ut_table
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " LIST_APPEND
* Form f_list_display
FORM f_list_display.
DATA ls_print TYPE slis_print_alv.
ls_print-no_print_selinfos = 'X'. " Display no selection infos
ls_print-no_print_listinfos = 'X'. " Display no listinfos
ls_print-reserve_lines = 2. " Lines reserved for end of page
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
is_print = ls_print
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " F_LIST_DISPLAY
May this will help you.
aRs
Message was edited by:
aRs -
How to print multiple ALV Grids with only one print dialog?
Hi,
I have a report that has multiple ALV grids in splitter containers. The users want to be able to print those ALVs by pushing only one print button. I got it to work (parameter IS_PRINT and method SET_FRONTEND_PRINT before calling SET_TABLE_FOR_FIRST_DISPLAY) but I can't find a way to avoid that the printer dialog pops up for every grid I print.
I tried to use the function module approach with REUSE_ALV_LIST_DISPLAY but have the same issue. Any thoughts?
Thanks,
GuentherHi Peluka,
Well, that's exactly what I am doing. Putting one central button in the app is not the problem; the issue is that the print dialog (to select the printer) pops up for every individual ALV grid. E.g. if I place 4 ALV grids on my screen and trigger their print from a central button, I am getting 4 print dialogs.
Cheers,
Guenther -
Hi,
When taking the printout of an ALV Grid where different colors are used for displaying dates or currencies, a / is coming on top of those columns.
Could some one help me in removing the /'s and keep the colors as it is.
Best Regards,
Kumarhi paul,
thanks for the link, but unfortunately, this site is blocked here. If you want to have a look at the code that i wrote, you can check the standard program for transaction MB51. In the main program pls search for the subroutine build_runtimetable. Double click on that form and u will see where the field catalog is getting filled up.
There please check for the field MSEG ERFMG and the value at last column +, which is at column 30. the table rtt is used to fill field catalog.
Please check it and help me.
Best Regards,
Kumar -
Subtotal text print in alv grid report
HI all,
I am trying to print the text for the column e.g. "SUBTOTAL TEXT" when i click on event button on the tool bar.
total is getting generated but text is not printing i am giving the code what i had written please tel me what changes should be done in this code .
***********Code
FORM sub_get_event .
CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE 'SUBTOTAL_TEXT'.
DATA: l_s_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 4
IMPORTING
ET_EVENTS = i_event
EXCEPTIONS
LIST_TYPE_WRONG = 0
OTHERS = 0.
Subtotal
READ TABLE i_event INTO l_s_event
WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO l_s_event-form.
MODIFY i_event FROM l_s_event INDEX sy-tabix.
ENDIF.
ENDFORM. " sub_get_event
*& Form subtotal_text
Build subtotal text
P_total Total
p_subtot_text Subtotal text info
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
Material level sub total
IF p_subtot_text-criteria = 'KWMENG'.
p_subtot_text-display_text_for_subtotal = 'Total '(009).
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = it_repid
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE' "#EC *
IS_LAYOUT = it_lay
IT_FIELDCAT = it_fldct[]
IT_EVENTS = i_event
TABLES
t_outtab = it_outtb
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "Alv_Display
Thank you,
Supriya.in order to get the subtotals and subtotal texts you need to have sort option. without sort option it is not possible to trigger this event.
first populate the sort table then it will tirgger. check this thread for sample code
Re: SubTotal Text in ALV? -
Change of list printing to ALV grid printing
Hi everybody
I have requirement to convert the following code to Grid display
can any body help me out in this.
NEW-PAGE PRINT ON
NO DIALOG
LINE-COUNT 58
LINE-SIZE 170 LAYOUT 'X_58_170'
NEW LIST IDENTIFICATION 'X'
KEEP IN SPOOL 'X'
NEW-SECTION
IMMEDIATELY P_ERRLP
DESTINATION P_DEVICE
SAP COVER PAGE 'X'
LIST NAME 'ZFFR070E'.
advance thanksYou can do that
See this thread
CL_ALV_GRID header
Here the data is being displayed in the header, instead you can display in the bottom container rather than top container and display the grid in the top container.
Regards,
Ravi
Note : Please mark all the helpful answers -
Hi, how to set printer to alv grid, please check my code
Hi,
Iam giving my code, please observe...
DEFAULT PRINTER NAME "A909".
NOW IAM SETTING OT "LP01".
GS_PRINT-PRINT = 'X'.
P_PRINTR = 'LP01'.
CALL FUNCTION 'UPDATE_DEFAULT_PRINTPARAMS'
EXPORTING
USER = SY-UNAME
DESTINATION = P_PRINTR
IMMEDIATELY = ' '
RELEASE = 'X'
NEW_LIST_ID = 'X'.
SY-BATCH = 'X'
CALL METHOD GO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK = G_CONSISTENCY_CHECK
I_STRUCTURE_NAME = 'KNA1'
IS_VARIANT = GS_VARIANT
I_SAVE = 'A'
I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
IS_PRINT = GS_PRINT
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = ITAB2[]
IT_FIELDCATALOG = GT_FIELDCAT
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
After running this program iam getting the default printer spool request number 'A909', Iam not getting printing form 'LP01'.
Need is to send the print to given printer (LP01), here printer may varry accoring to the selection. So nee is to set the printer that which has choosen.
Please give me the valuble solution as early as possible.
Please solve this as early as possible.Hi Ravi,
You can choose for the print version to be created as a PostScript file instead of a PDF document. The PostScript file is then sent directly to a printer of your choice
If you do not specify an output device here, a PDF file is generated and displayed on the screen.
You use the methods of the interface class IF_SALV_WD_PDF_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).
<b>Function</b> <b>Method</b>
Set ALV output to be printed immediately --> SET_PRINT_IMMEDIATE
Check whether the ALV output is to be printed immediately --> GET_PRINT_IMMEDIATE
Set printer --> SET_PRINTER
Get printer --> GET_PRINTER
See the below for SAP link
http://help.sap.com/saphelp_nw04s/helpdata/en/43/27472def40601ee10000000a422035/content.htm
see the thread also
Re: How to set the printer in set_table_for_first_display
mark all the helpful answers
Regards
Sudheer -
Greetings,
I am printing the ALV grid in the background using non OO processing.
It, of course, switches automatically to the ALV list when it prints... but... does anyone know how to shut off the "Sort criteria" and the "Data statistics" tables when printing?
These 2 tables are printing in front of the ALV list... on page 1.
Thanks,
Doug -Never mind.
<print_structure>-NO_PRINT_LISTINFOS = 'X' -
Need to display texts on to the ALV grid using SALV
Hi evryone,
There is a requirement to print an ALV grid containing the row titles and their subsequent values. The display shouild look like as below
Summary ItemsA cost 111111
ItemsB cost 222222
ItemC cost 333333
New items
ItemD cost 111111
ItemE cost 222222
ItemF cost 333333
Total 666666 666666
The headings pertaining to ItemA to itemB should come in a single column and their subsequent values as shown above. The total should be displayed below the corresponding block of items. Can anyone please suggest me the way we can acheive this using SALV and container concept.Sorry my earlier did not get displayed as expected. Please find below the format how the ALV should get displayed.
Summary -
ITEMA----
1111
ITEMB----
2222
ITEMC----
3333
ITEMD----
1111
ITEME----
2222
ITEMF -
3333
Total--6666--
6666
Please ignore the dots here they are just written to indicate spaces between the texts. The text summary and the texts "ItemA, B, C etc" should have 1 coulmn gap and the prices for the first item block should have 1 column block from the texts and the prices for second Item block should have a 2 coulumn block from the texts and total value should be displayed below each block.
Edited by: Phaniacumen on May 8, 2010 1:59 PM -
Taking download into excel from ALV Grid - header is printing in two lines
Hi All,
I have a scenario where I am taking the download from ALV grid to an excel sheet. Now the header of the ALV (column names) is appearing in two lines in the downloaded excel sheet while items (records of the ALV table) are getting displayed in a single line.
This download is taken from the standard download to local file (spreadsheet) button provided by SAP for ALVs.
I am using function module "Reuse_alv_grid_display" for the purpose.
Can somebody provide an idea how I can avoid the header printing in two lines and keep the length as it is.
Thanks in Advance,
ChandanHi..
1. Pass header name in internal table appned first line.
2. after that pass u r data .
3. Use FM. WS_DOWNLOAD
Salil ......
Edited by: salil chavan on Nov 26, 2008 11:07 AM -
Print headings using RSBTCHH0 on ALV grids
Most reports I have developed use the list processing event top-of-page to print headings for the report listing by calling standard SAP subroutine BATCH-HEADING in program RSBTCHH0 when structure BHDGD has been populated. Field BHDGD-LINES contains the line size used for printing the report headings. When we use ABAP objects to print data in the ALV grid we can add the same processing to print page headings to event PRINT_TOP_OF_PAGE. It appears as if the heading data is printed until the position of last column of the grid before the text is wrapped, creating a new line. Is there anyway of controlling the default line-size when doing grid printing.
Thanks in advance
ColinHi,
Refer to this document for all your ALV queries:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an easy reference for alv grid control.pdf
regards
Aveek -
How to send the ALV GRID output to spool by using the print button in std t
How to send the ALV GRID output to spool by using the print button in standard tool bar.
We have created a button in the va02 transaction. If user click on the button the new screen will be display on that screen we are populating the alv grid output using the oops concept. But i am unable to send the output to spool using the print button in the standard tool bar.
I am able to display the Print parameter dialog box but i am not able to send it to spool.
Kindly help.
Thanks In Advance.
G.V.RamanaHi Shaik,
There is not properties button in my print screen.
MODULE user_command_0900 INPUT.
WHEN 'EXCEL'.
PERFORM excel_download.
WHEN 'PRI'.
PERFORM print_output.
form Print_output.
CALL FUNCTION 'RSPO_LIST_LAYOUT_FITS'
EXPORTING
columns = 80
device = 'ANY '
lines = 65
maxpenality = 1999
TABLES
layouts = lt_layouts1
EXCEPTIONS
unknown_device = 1
OTHERS = 2.
IF sy-subrc = 0.
LOOP AT lt_layouts1.
IF lt_layouts1-penality < 1000 AND
lt_layouts1-penality < l_min_penality.
l_layout = lt_layouts1-layout.
l_min_penality = lt_layouts1-penality.
ENDIF.
ENDLOOP.
IF NOT l_layout IS INITIAL.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
mode = 'CURRENT'
line_size = 80 "#EC *
new_list_id = l_new_list_id
no_dialog = l_no_dialog
layout = l_layout
IMPORTING
out_archive_parameters = rs_arc_params
out_parameters = rs_pri_params
valid = l_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc NE 0. " INS SLIN
ENDIF. " INS SLIN
IF rs_pri_params-linsz LT 80 OR
rs_pri_params-linsz LT gt_stack-s_lprint-width.
gt_stack-print_line_break = 'X'.
ELSE.
CLEAR gt_stack-print_line_break.
ENDIF.
IF l_valid NE 'X'.
rs_pri_params = ls_pri_params_sav.
rs_arc_params = ls_arc_params_sav.
ENDIF.
ENDIF.
ENDIF.
endform. " Print_output
CALL METHOD gv_cost_tot_alv_grand->set_table_for_first_display
EXPORTING
is_layout = gs_layout_cost_tot_grand
CHANGING
it_fieldcatalog = gt_fcat_cost_tot_grand[]
it_outtab = gt_cost_tot_grand[].
Please check my code
Maybe you are looking for
-
Hi, I have one servlet HTML page which gets the input from the user andon submittingthe form one mroe servlet is called which validates and dependig user value it will form the SQL select. Then I need to call Servlet which will generate an HTML page
-
Test cold backup database in archive mode
Hello, We doing every week a cold backup from Oracle database, us database is in archive mode. We would like to test us cold backup in other server but the drive where we have to copy the datafiles and logs and rollback are different on this server.
-
Is there a way to retrieve pictures off of my Incredible ?
How do I retrieve photos off of my Incredible Droid 2
-
HII am tring to import an Alias table(*.ALT) in to essbase using Maxl. Can anyone tell me how to import that Alias table using Maxl?Thanks in advanceEss
-
Big problems with Firewire iPod and camcorder - please help!
Hi all, I don't know where else to turn with this problem. I think I've damaged my Firewire kit. I have an iPod 4G 20GB and a Canon MV901 MiniDV Camcorder. I used them both over Firewire with my Pismo without difficulty, but I then tried video editin