Step1. So here we have a Script with Main window.
Step2. Window text element.
Step3. Program that calls the script and pass the data.. Execute the program.
Step4. Continue with print preview.
Step5. Here is the program with a slight modified one that request for the script OTF data and then converts it in to PDF and downloads it.
--------------------------------------------------------------------------------------------------------------------------------
DATA : lt TYPE TABLE OF sflight,
ls TYPE sflight,
ls_option TYPE itcpo,
lt_otf TYPE TABLE OF itcoo,
file_size TYPE i,
lt_line TYPE TABLE OF tline.
SELECT * FROM sflight INTO TABLE lt UP TO 30 ROWS.
ls_option-tdgetotf = 'X'. "Pass 'X' to get the OTX data
CALL FUNCTION 'OPEN_FORM'
EXPORTING
dialog = ' '
options = ls_option.
CALL FUNCTION 'START_FORM'
EXPORTING
form = 'ZSCRIPT_WORK'.
LOOP AT lt INTO ls.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'FLIGHT_DATA'
* FUNCTION = 'SET'
* TYPE = 'BODY'
window = 'MAIN'.
ENDLOOP.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'CLOSE_FORM'
TABLES
otfdata = lt_otf. " get the otf data into the internal table
CALL FUNCTION 'CONVERT_OTF' " call this FM to convert OTF to PDF
EXPORTING
format = 'PDF' " provide the target Format as PDF
* MAX_LINEWIDTH = 132
IMPORTING
bin_filesize = file_size
* BIN_FILE =
TABLES
otf = lt_otf " pass OTF data
lines = lt_line. " get the PDF data
CALL FUNCTION 'GUI_DOWNLOAD' " download the PDF
EXPORTING
bin_filesize = file_size
filename = 'C:\Users\Documents\DOWNLOAD\SCRIPT_DATA.PDF'
filetype = 'BIN'
TABLES
data_tab = lt_line.
----------------------------------------------------------------------------------------------------------------------------------
Step6. This is teh destination folder before above report execution. Now execute the above report .
Step7. Open the PDF file.
Step8. So we have the pdf output of the script OTF data.
Step2. Window text element.
Step3. Program that calls the script and pass the data.. Execute the program.
Step4. Continue with print preview.
Step5. Here is the program with a slight modified one that request for the script OTF data and then converts it in to PDF and downloads it.
--------------------------------------------------------------------------------------------------------------------------------
DATA : lt TYPE TABLE OF sflight,
ls TYPE sflight,
ls_option TYPE itcpo,
lt_otf TYPE TABLE OF itcoo,
file_size TYPE i,
lt_line TYPE TABLE OF tline.
SELECT * FROM sflight INTO TABLE lt UP TO 30 ROWS.
ls_option-tdgetotf = 'X'. "Pass 'X' to get the OTX data
CALL FUNCTION 'OPEN_FORM'
EXPORTING
dialog = ' '
options = ls_option.
CALL FUNCTION 'START_FORM'
EXPORTING
form = 'ZSCRIPT_WORK'.
LOOP AT lt INTO ls.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'FLIGHT_DATA'
* FUNCTION = 'SET'
* TYPE = 'BODY'
window = 'MAIN'.
ENDLOOP.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'CLOSE_FORM'
TABLES
otfdata = lt_otf. " get the otf data into the internal table
CALL FUNCTION 'CONVERT_OTF' " call this FM to convert OTF to PDF
EXPORTING
format = 'PDF' " provide the target Format as PDF
* MAX_LINEWIDTH = 132
IMPORTING
bin_filesize = file_size
* BIN_FILE =
TABLES
otf = lt_otf " pass OTF data
lines = lt_line. " get the PDF data
CALL FUNCTION 'GUI_DOWNLOAD' " download the PDF
EXPORTING
bin_filesize = file_size
filename = 'C:\Users\Documents\DOWNLOAD\SCRIPT_DATA.PDF'
filetype = 'BIN'
TABLES
data_tab = lt_line.
----------------------------------------------------------------------------------------------------------------------------------
Step6. This is teh destination folder before above report execution. Now execute the above report .
Step7. Open the PDF file.
Step8. So we have the pdf output of the script OTF data.
No comments:
Post a Comment