cancel
Showing results for 
Search instead for 
Did you mean: 

Print a Table

Former Member
0 Kudos

Hi All,

In my scenario I am having a tree structure with in a table. I had done this using recursive node. Using onLoadChildren event i will be adding the child elements to the parent element.

Now i will be having a Print button outside the table. the functionality of this button is to print the table values alone. When i click on the print button i want to print the values that are populated in the table.

How to achieve this print functionality.

Can any one suggest me any idea.

Regards,

Susil.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

You can give it a try using Adobe Print Forms. On the click of Print button you can launch a WD window with Adobe Form integrated in it.

Regards

Manas Dua

Former Member
0 Kudos

Hi Manas,

I dont want to go for Adobe form. When i click on the print button it should print the table directly.

Regards,

Susil.

ChrisPaine
Active Contributor
0 Kudos

Direct print functionality is not available until 7.02 - and this will just trigger the browser print - so more a screen dump. Given the 7.02 help is now gone, I can't even give you a reference to this - sorry.

Otherwise - you're going to have to think about using the ACF functions or printing to the SAP spool/ SAP printer. With the SAP spool/printer be aware that the local printer option is not possible - it has to be a printer set up for SAP printing.

There have been many questions and responses about this in the past, please do a search to find some of them! (although I've not seen such an detailed explanation of how to push an ALV (N.B. not an WDA ALV) table to the SAP spool before - excellent stuff from Bhavana Amar there.)

Cheers,

Chris

former_member233090
Active Contributor
0 Kudos

Hi continuation


* Start List Processing using generated print parameters
  NEW-PAGE PRINT ON PARAMETERS ld_prnt_params NO DIALOG.

* If you insert ABAP write statements here they will apear on your printout
* write: 'HelloWorld'.

* Create the ALV Object
  DATA: error_string TYPE string.

  cl_salv_table=>factory(
    EXPORTING
      list_display = abap_true
    IMPORTING
      r_salv_table = it_alvtable
    CHANGING
      t_table      =  ).

* Process the ALV Columns
  DATA: columns TYPE REF TO cl_salv_columns_table.

* Reference ALV columns object
  columns = it_alvtable->get_columns( ).
* Set columns to optimised width.
  columns->set_optimize( abap_false ).

*Set ALV to print in the background
  it_alvtable->display( ).
  NEW-PAGE PRINT OFF.

to be more clear

above the internal table containing the data is IT_SCARR, this gets assigned to it_datatab which in turn get assign to the field symbol <tab>. This means that it does not matter what structure your data table has, the code will build the printout appropriately. Therefore if you are using a data table with a differnet name and/or structure all you need to do is replace IT_SCARR with the name of your declared itab.

hope it will help you out

Bhavana

Former Member
0 Kudos

Hi Bhavana,

i am not using any internal table, i will be adding the values to the node dynamically when ever user clicks on the onloadchildren event.

Regards,

Susil.

Former Member
0 Kudos

Hi Bhavana Amar,

I had try this code , but need further guidance how to check if its printed or not, i'm checked at spool SP01 , but there is no printing queue.

Need help and guide on this.

Thanks

Brgds,

Badzkun

former_member233090
Active Contributor
0 Kudos

Hi sushil.

herei can show the example which i have done ,

here i have add the ABAP code which takes the internal table of data and sends it to the printer.

It does this by using the print functionality of the object ALV method, so builds an ALV grid based on your internal table and then sends this to your SAP printer.


* Print web dynpro table using ALV object print functionality
  data it_datatab type ref to data.

* assign table containing data to it_datatab
  get reference of it_scarr into it_datatab.

  FIELD-SYMBOLS: <tab> TYPE table.
  ASSIGN it_datatab->* TO <tab>. "assign data table to field symbol

  DATA: it_alvtable   TYPE REF TO cl_salv_table.
  DATA: ld_prnt_params TYPE pri_params,
        ld_valid(1) TYPE c.

* Get print parameters
  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      copies                 = '1'  "print_options-copies
      layout                 = 'X_65_255'
      no_dialog              = abap_true
    IMPORTING
      out_parameters         = ld_prnt_params
      valid                  = ld_valid
    EXCEPTIONS
      archive_info_not_found = 1
      invalid_print_params   = 2
      invalid_archive_params = 3
      OTHERS                 = 4.
  IF sy-subrc ne 0 OR ld_valid NE abap_true.
* invalid print parameters
    return.
  ENDIF.

Cheers,

bhavana