Converting SAP Script to OTF
I am following the below mentioned steps to create a PDF-Output file is to:
1. Creating a sapscript form
2. Close the form using the TABLES parameter to receive an OTF-table
3. Convert OTF to PDF using SX_OBJECT_CONVERT_OTF_PDF
4. Send the object using SO_DOCUMENT_SEND_API1
My problem is When the function 'CLOSE_FORM' occurs,
the OTF- table is empty, i do not know why it does not get filled though i can see a print preview of the script file, so i am unable to go to step 3 and 4.
Anyone who has come across this issue earlier, Can share their knowledge.
All inputs are Rewarded!!!
max bianchi replied
This is a my simple code:
TABLES ITCPO. DATA: T_OTF TYPE TABLE OF ITCOO. ITCPO-TDGETOTF = 'X'. CALL FUNCTION 'OPEN_FORM' EXPORTING DEVICE = 'PRINTER' DIALOG = 'X' FORM = 'ZTEST' OPTIONS = ITCPO EXCEPTIONS CANCELED = 1 DEVICE = 2 FORM = 3 OPTIONS = 4 UNCLOSED = 5 MAIL_OPTIONS = 6 ARCHIVE_ERROR = 7 INVALID_FAX_NUMBER = 8 MORE_PARAMS_NEEDED_IN_BATCH = 9 SPOOL_ERROR = 10 OTHERS = 11. IF SY-SUBRC <> 0. ELSE. CALL FUNCTION 'CLOSE_FORM' TABLES OTFDATA = T_OTF EXCEPTIONS UNOPENED = 1 BAD_PAGEFORMAT_FOR_PRINT = 2 SEND_ERROR = 3 SPOOL_ERROR = 4 OTHERS = 5. ENDIF.
It works fine, i.e. I can get the OTF data from CLOSE_FORM, there's only a strange thing: if I set the flag for OTF I can't see any preview (u've written: "though i can see a print preview of the script file"), but the system returns directly the OTF.