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.

http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES?showComments=true&showCommentArea=true#addcomment

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.

  CALL FUNCTION 'SET_PRINT_PARAMETERS'
   EXPORTING
     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
       EXPORTING
           is_layout                     = gs_layout_alv
           is_print                      = st_print
    CHANGING
            it_outtab                     = git_summary[]
            it_fieldcatalog               = gt_fieldcat_lvc[]
    EXCEPTIONS
         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.
  ENDIF.

  IF sy-batch = 'X'.
*  NEW-PAGE PRINT OFF.
*  CALL FUNCTION 'ABAP4_COMMIT_WORK'.

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

*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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.