You are on page 1of 1

INTO TABLE lt_tsp01

WHERE rq2name = lv_rq2name


AND rqowner = sy-uname .

*sort table to find latest spool no


SORT lt_tsp01 BY rqcretime DESCENDING .

*Read table to find latest spool no


READ TABLE lt_tsp01 INTO ls_tsp01 INDEX 1.

*Get user desktop


CALL METHOD cl_gui_frontend_services=>get_desktop_directory
CHANGING
       desktop_directory = lv_string
EXCEPTIONS
       cntl_error = 1
       error_no_gui = 2
       not_supported_by_gui = 3
OTHERS = 4.
 

IF sy-subrc <> 0.
*   Implement suitable error handling here
     lv_string = sy-repid.
ENDIF.

CALL METHOD cl_gui_cfw=>update_view.


CONCATENATE lv_string text-001 INTO lv_string.

*Prepare selection table for PDF download


ls_param-selname = ‘SPOOLNO’.
ls_param-sign = ‘I’.
ls_param-option = ‘EQ’.
ls_param-low = ls_tsp01-rqident.
ls_param-high = ‘ ‘.
APPEND ls_param TO lt_param.

ls_param-selname = ‘P_FILE’.
ls_param-sign = ‘I’.
ls_param-option = ‘EQ’.
ls_param-low = lv_string.
ls_param-high = ‘ ‘.
APPEND ls_param TO lt_param.

* Submit to PDF converted and download


SUBMIT rstxpdft4 WITH SELECTION-TABLE lt_param
AND RETURN.
IF sy-subrc <> 0.

   MESSAGE ‘PDF convert not possible’ TYPE ‘I’.


ENDIF.
ELSE.
MESSAGE ‘PDF Can not be downloaded, you have selected huge data. Reduce data and try again’ TYPE ‘I’.
ENDIF.
ENDCASE.

ENDFORM.

You might also like