cancel
Showing results for 
Search instead for 
Did you mean: 

Converting SAP Script to OTF

former_member216668
Participant
0 Kudos

Hi,

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!!!

Cheers!

K

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Have u set the flag to get OTF data in OPEN_FORM?

U should set the field OPTIONS-TDGETOTF = 'X'

Max

former_member216668
Participant
0 Kudos

Yes i have done that max

Former Member
0 Kudos

Hi

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.

Max

former_member216668
Participant
0 Kudos

Thanks mate, it works fine now...dont know why it was not working earlier....quite Quuer.

Anyways Thankyou very much for your sample code.

it helped a lot!!!

Cheers,

K

Answers (0)