cancel
Showing results for 
Search instead for 
Did you mean: 

ALV (SALV) Crystal Report view - Print without displaying the report

Former Member
0 Kudos

I have crystal report view enabled for ALV reports using CR add-on for BS Apps, it is working fine, and getting good looking print-outs. Now I am trying to print it without displaying it as we can do with normal ALV report. My code snippet for printing is given below. While executing it shows the report instead of printing it without any user interaction. I also experience a strange behavior If I execute without activating the report it shows the print dialog without showing the report and printing the ALV list not the crystal report, and If I execute the activated version it shows crystal report view and not printing automatically. Please help.


ECC 6   EHP 5

SAP  BASIS: 70210

GUI: 730

Notes Applied: 1805676



REPORT  zsha_test.
TYPES: BEGIN OF lty,
   bukrs TYPE t001-bukrs,
   butxt TYPE t001-butxt,
   END OF lty.

DATA lt_data TYPE STANDARD TABLE OF lty.

SELECT bukrs butxt FROM t001 INTO TABLE lt_data.

DATA go_s TYPE REF TO cl_salv_table.
DATA go_p TYPE REF TO cl_salv_print.
DATA go_pc TYPE alv_s_pctl .
DATA gv_valid TYPE c.
DATA gs_pparams TYPE pri_params.
data ls_key TYPE salv_s_layout_key.


cl_salv_table=>factory(
   IMPORTING
     r_salv_table   go_s
   CHANGING
     t_table        = lt_data
).

go_p go_s->get_print( ).
go_pc = go_p->get_print_control( ).

CALL FUNCTION 'GET_PRINT_PARAMETERS'
   EXPORTING
     no_dialog              = 'X'
   IMPORTING
     valid                  = gv_valid
     out_parameters         = gs_pparams
   EXCEPTIONS
     archive_info_not_found = 1
     invalid_print_params   = 2
     invalid_archive_params = 3
     OTHERS                 = 4.

go_pc-pri_params = gs_pparams.

go_p->set_print_control( go_pc ).

go_s->get_functions( )->set_all( abap_true ).

ls_key-report = sy-repid.
go_s->get_layout( )->set_key( ls_key ).
go_s->get_layout( )->set_save_restriction( cl_salv_layout=>restrict_none ).
go_s->get_layout( )->set_default( abap_true ).

go_s->get_functions( )->set_view_crystal( abap_true ).

go_p->set_print_only( if_salv_c_bool_sap=>true ).

go_s->display( ).


Regards,

Shajahan

Accepted Solutions (0)

Answers (1)

Answers (1)

TammyPowlas
Active Contributor
0 Kudos

I cannot read ABAP code

can you include a screen shot of the print issue?

Former Member
0 Kudos

Hi Tammy Powlas,

Screen shot of code attached. I'm a newbie in SCN, I wonder why ABAP code is not readable or shown.

TammyPowlas
Active Contributor
0 Kudos

My point is I am not an ABAP programmer so I am not understanding how your code helps me understand your issue.

I am sorry if I wasn't clear.

What is the issue/question?

Former Member
0 Kudos

Hi,

I am able to generate crystal report view from a custom report program with ALV output. It can display the output on screen as shown in the attachment. My requirement is to print the same thing in printer without showing the report on screen. I tried to set some print specific properties for ALV, Still it showing in screen, not printing.

TammyPowlas
Active Contributor
0 Kudos

Got it - now I follow.  Thank you for your patience.

I don't think that is currently possible.  You can submit an idea for this at Idea Place (ideas.sap.com)

Former Member
0 Kudos

Thank you for your reply and your valuable time, I will try again with alternate methods, if it does not work I will submit it in ideas.sap.com