Hi,
I had a query regarding OTF to PDF conversion of Smartform output. I have attached my source code below. I am taking the customer number on a selection screen and then based on that customer number i am extracting the order information of the customer. The problem is if the data has only one page, then the PDF file extracted is perfect. However, if it spans more than one page, iam only getting the data on the last page of PDF file. In the remaining pages all i get is empty table (The structure of the table is fine with borders and shading, but no data).
Please help me out guys.
Regards,
*&---------------------------------------------------------------------*
*& Report ZSCRIPT8
*&
*&---------------------------------------------------------------------*
*& AUTHOR - REKHA
*&
*&---------------------------------------------------------------------*
REPORT zscript8.
* These 2 are needed for function 'CONVERT_OTF_2_PDF'
*---------------------------------------------------------------------*
DATA : it_docs TYPE STANDARD TABLE OF docs,
it_lines TYPE STANDARD TABLE OF tline,
* Standard parameters for smartform
*---------------------------------------------------------------------*
my_job_output_info TYPE ssfcrescl,
my_output_options TYPE ssfcompop,
my_control_parameters TYPE ssfctrlop,
*---------------------------------------------------------------------*
dev_name TYPE rspoptype, " For device name for PDF output
v_bin_filesize TYPE i, "Specifying the file size for functions
"Convert_otf_2_pdf and Gui_download
f_name TYPE rs38l_fnam. "To store the form function module name
*---------------------------------------------------------------------*
DATA w_kna1 TYPE kna1. "For Customer information
DATA t_vbak TYPE vbak OCCURS 1. "For order information
PARAMETERS p_custno TYPE kna1-kunnr.
* To print the customer number and the name at the top of the order
* table output
*---------------------------------------------------------------------*
SELECT * FROM kna1 INTO w_kna1 WHERE kunnr = p_custno.
ENDSELECT.
* Selecting the order data of the selected customer.
*---------------------------------------------------------------------*
SELECT vbeln
erdat
ernam
netwr
INTO CORRESPONDING FIELDS OF TABLE t_vbak
FROM vbak WHERE kunnr = p_custno.
*.................GET SMARTFORM FUNCTION MODULE NAME.................*
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSMARTFORM4'
IMPORTING
fm_name = f_name.
*.................GET DEVICE NAME FOR PDF OUTPUT.....................*
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = sy-langu
i_application = 'SAPDEFAULT'
IMPORTING
e_devtype = dev_name.
*............SETTING STANDARD PARAMETERS FOR SMART FORM INTERFACE.....*
my_output_options-tdprinter = dev_name.
my_control_parameters-no_dialog = 'X'. "SUPPRESS SPOOL DIALOG MODULE
my_control_parameters-getotf = 'X'. "TO GET OTF DATA WITHOUT PRINTING
*...........................CALL SMARTFORM............................*
CALL FUNCTION f_name
EXPORTING
control_parameters = my_control_parameters
output_options = my_output_options
w_kna1 = w_kna1
IMPORTING
job_output_info = my_job_output_info
TABLES
t_vbak = t_vbak.
*.........................CONVERT TO OTF TO PDF.......................*
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = v_bin_filesize "This is must, if not
TABLES
otf = my_job_output_info-otfdata " given getting run err
doctab_archive = it_docs
lines = it_lines.
*..................................DOWNLOAD AS FILE....................*
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_bin_filesize "Must give else run error
filename = 'C:MYPDF.PDF'
filetype = 'BIN' "This is also must else run error
TABLES
data_tab = it_lines.