Hi SAPGURUS
I want to convert a text file to pdf file for this i am creating a internal table and then fill it from the input file (this i do by GUI_UPLOAD FM). After that i download the data in another file and then i now want to convert the downloaded file into pdf file for this i am using the FM CONVERT_OTF_2_PDF.
But this is not working and giving me dumb when executed.
could anyone provide me a simple program so that i can understand the use of thr CONVERT_OTF_2_PDF FM.
Please reply as soon as possible.
Hi,
Refer thread
DATA: lt_pdfdata LIKE TABLE OF tline WITH HEADER LINE. DATA: lt_otf TYPE STANDARD TABLE OF itcoo WITH HEADER LINE, lt_doctab TYPE STANDARD TABLE OF docs WITH HEADER LINE, lt_otfdata TYPE STANDARD TABLE OF itcoo WITH HEADER LINE. *-- Convert the OTF data to PDF data CALL FUNCTION 'CONVERT_OTF_2_PDF' EXPORTING use_otf_mc_cmd = 'X' IMPORTING bin_filesize = v_bin TABLES otf = lt_otf doctab_archive = it_doctab lines = lt_pdfdata EXCEPTIONS err_conv_not_possible = 1 err_otf_mc_noendmarker = 2 OTHERS = 3.
This is an alternative SX_OBJECT_CONVERT_OTF_PDF
You can use this custom FM...You must convert your text file to a spool request and call the FM -:)
*"---------------------------------------------------------- *"*"Interfase local *" IMPORTING *" REFERENCE(FILENAME) TYPE STRING *"---------------------------------------------------------- SELECT RQIDENT INTO (T_TSP01-RQIDENT) FROM TSP01 WHERE RQOWNER EQ SY-UNAME AND RQCLIENT EQ SY-MANDT. APPEND T_TSP01. ENDSELECT. SORT T_TSP01 DESCENDING. CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF' EXPORTING SRC_SPOOLID = T_TSP01-RQIDENT NO_DIALOG = '' IMPORTING PDF_BYTECOUNT = NUMBYTES PDF_SPOOLID = PDFSPOOLID BTC_JOBNAME = JOBNAME BTC_JOBCOUNT = JOBCOUNT TABLES PDF = PDF EXCEPTIONS ERR_NO_OTF_SPOOLJOB = 1 ERR_NO_SPOOLJOB = 2 ERR_NO_PERMISSION = 3 ERR_CONV_NOT_POSSIBLE = 4 ERR_BAD_DSTDEVICE = 5 USER_CANCELLED = 6 ERR_SPOOLERROR = 7 ERR_TEMSEERROR = 8 ERR_BTCJOB_OPEN_FAILED = 9 ERR_BTCJOB_SUBMIT_FAILED = 10 ERR_BTCJOB_CLOSE_FAILED = 11 OTHERS = 12. IF SY-SUBRC EQ 0. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING BIN_FILESIZE = NUMBYTES FILENAME = FILENAME FILETYPE = 'BIN' TABLES DATA_TAB = PDF EXCEPTIONS FILE_WRITE_ERROR = 1 NO_BATCH = 2 GUI_REFUSE_FILETRANSFER = 3 INVALID_TYPE = 4 NO_AUTHORITY = 5 UNKNOWN_ERROR = 6. IF SY-SUBRC EQ 0. DELETE FROM TSP01 WHERE RQIDENT EQ T_TSP01-RQIDENT. ENDIF. ENDIF. ENDFUNCTION.
Greetings,
Blag.
Add a comment