Skip to Content

Conversion FAQ

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jan 09, 2007 at 01:31 PM

    Hi,

    Refer thread

    alv-list-as-pdf

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      first of all thanks for your help but could you please explain why we use:-

      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.

      and what is the use of <b>tline</b>.

      Right now i have taken an internal table and then fill it using GUI_UPLOAD FM.

      After this i m using this internal table and passing it to function 'CONVERT_OTF_2_PDF'.

      IS my approch right please help me i am not able to understand the concept of how to use this FM.

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 01:31 PM

    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
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.