Skip to Content

spool creation in foreground for ALV without print popup screen

Hi, I have requirement of sending ALV grid output to Email as PDF attachment using only set_table_for_first_display method. I am doing similar thing as given in below link.

but when it is going inside set_table_for_first_display method,it is coming back to the calling screen with spool id. it is not returning to the next line of set_table_for_first_display method. my requirement is, it should create spool without showing print pop up screen in foreground. I have tried all possibilities. but not yet succeeded. My code snap is like this.

     destination                 = 'LOCL'
     layout                      = 'X_65_512/2'
     line_count                  = '65'
     line_size                   = '1024'.

  st_print-print = 'X'.

  gs_layout_alv-zebra = 'X'.
  gs_layout_alv-cwidth_opt = selected.

*  display alv
  CALL METHOD grid->set_table_for_first_display
           is_layout                     = gs_layout_alv
           is_print                      = st_print
            it_outtab                     = git_summary[]
            it_fieldcatalog               = gt_fieldcat_lvc[]
         invalid_parameter_combination = 1
         program_error                 = 2
         too_many_lines                = 3
         OTHERS                        = 4
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  IF sy-batch = 'X'.

*  SELECT * FROM tsp01 INTO tsp01
*           WHERE rq2name = st_print-print_ctrl-pri_params-plist
*           ORDER BY rqcretime DESCENDING.
*    v_spono = tsp01-rqident.
*    EXIT.
*  IF sy-subrc NE 0.
*    CLEAR v_spono.

*convert spool to pdf and send as attachment to sap inbox.
    MOVE sy-spono TO v_spono.

<formatted the code snippet>

v_spono is everytime showing 0.

Edited by: Suhas Saha on Jan 11, 2012 3:26 PM

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2012 at 09:13 AM

    can you read what you have pasted :-)...

    anyways, calll that FM SET_PRINT_PARAMETERS in the initialization event. i think it should work

    Add comment
    10|10000 characters needed characters exceeded

    • formatting is not working.

      once again i am posting only coding part.what u r suggesting i have already used.

      Moderator Message: If the character count > 5000, then the formatting deosn't work.

      Edited by: Suhas Saha on Jan 11, 2012 3:30 PM