CONVERT_ABAPSPOOLJOB_2_PDF

Hi,
I am using above function module to convert spool output into pdf format.
Spool output has more than 99 pages. for this reason, above function module is reading the ABAP spooljob and converting to PDF, writing it into new spooljob by submitting the report RSTXPDF5. How to download this spool output as PDF file? I used RSPO_DOWNLOAD_SPOOLJOB for this. But no success. If anybody has any inputs, please let me know.
Thanks in advance.
Regards,
Naveen

check the following Code
Print any spool file from SAP in PDF format. Can be viewed/edited by using Acrobat. You need the full version of Acrobat to edit, but can view and print using the free version. This is a very simple but useful program and needs to be built on to make it into a real handy tool (put in your own code and change the SAPScript before downloading into PDF format).
report ZPDFPRNT no standard page heading.
TABLES: TST05.
DATA: BEGIN OF ITAB OCCURS 0,
TLINE(255),
END OF ITAB.
DATA: BEGIN OF ITAB2 OCCURS 0,
TLINE(255),
END OF ITAB2.
DATA: BEGIN OF ITAB3 OCCURS 0,
TLINE(255),
END OF ITAB3.
DATA: BEGIN OF OTF_TAB OCCURS 0,
TLINE(255),
END OF OTF_TAB.
DATA: LEN_OUT LIKE SOOD-OBJLEN.
DATA: LEN_IN LIKE SOOD-OBJLEN.
DATA: BEGIN OF DATA_SET OCCURS 200,
DATA_LENGTH(5),
PRECOL(1),
DATA_LINE(1000),
END OF DATA_SET.
DATA: BEGIN OF OTF_PAGE OCCURS 200.
INCLUDE STRUCTURE ITCOO.
DATA: END OF OTF_PAGE,
OTF_PAGES TYPE P,
OTF_MAX_PAGES TYPE P VALUE 10.
DATA: BEGIN OF OTF_CONTROL.
INCLUDE STRUCTURE ITCPP.
DATA: END OF OTF_CONTROL,
FORCE_RAW_OTF VALUE ' ',
L100_EXCLUDE(4) VALUE 'OTFJ',
BEGIN OF OTF_PAGE_INDEX OCCURS 20,
LINE_NUM TYPE P,
END OF OTF_PAGE_INDEX,
CUR_OTF_PAGE VALUE 1.
DATA: DATA_SET_LINECOUNT TYPE P,
DATA_SET_MAX_LINES TYPE P VALUE 100000,
DATA_SET_VALID TYPE C VALUE ' ',
DATA_SET_IS_OTF TYPE C VALUE ' ',
DATA_SET_LENGTH(5) TYPE C,
LINE_SPECIAL LIKE DATA_SET-DATA_LINE,
NEED_LINE_SPECIAL TYPE C,
DSN_TYPE(8) TYPE C.
DATA: FCODE(4) TYPE C,
DATE TYPE D,
TIME TYPE T,
RC(10) TYPE C,
ERRMSG(100) TYPE C,
PRINTJOB_CREATED(1) TYPE C,
PRINTJOB_CLEARED(1) TYPE C,
PRINTJOB_LIST(1) TYPE C,
DISPLAY_MODE(1) TYPE C,
LINE_MAX TYPE P VALUE '100000',
NEW_SCREEN_300(1) TYPE C,
MULTI_PRINT_300(1) TYPE C,
PRINT_ALL_300(1) TYPE C,
PRINT_COUNT_300 TYPE I,
SHOW_USER_100 TYPE C VALUE ' ',
ERROR_DISPLAY_LEVEL TYPE C VALUE '9',
NEXT_ERROR_DISPLAY_LEVEL TYPE C,
PREV_ERROR_DISPLAY_LEVEL TYPE C,
START_300(5) TYPE C, END_300(5) TYPE C,
SEP LIKE SY-VLINE,
DEFAULT_PRI,
TSP01_BUF LIKE TSP01,
TSP01_CURLINE LIKE SY-STARO,
TSP01_CURCOL LIKE SY-CUCOL,
TSP01_CURROW LIKE SY-CUROW.
DATA: BEGIN OF DATA_SET_LINE,
DATA_LENGTH(5),
PRECOL(1),
DATA_LINE(1000),
END OF DATA_SET_LINE.
DATA: STATUS LIKE SY-SUBRC.
DATA: WGF_MESSAGE(80).
DATA: H_PATH(20) TYPE C.
DATA: H_MASK(20) TYPE C VALUE ',.pdf ,.pdf. '.
DATA: FILE_NAME(20).
DATA: FILENAME LIKE RLGRAP-FILENAME.
DATA: IMPORT(132).
PARAMETERS: IDENT(5) TYPE C.
PERFORM GET_OTF_TAB.
LOOP AT OTF_PAGE.
OTF_TAB-TLINE = OTF_PAGE.
APPEND OTF_TAB.
ENDLOOP.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PDF'
DEVTYPE = 'ASCIIPRI'
LEN_IN = LEN_IN
IMPORTING
LEN_OUT = LEN_OUT
TABLES
CONTENT_IN = OTF_TAB
CONTENT_OUT = ITAB2
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2.
PERFORM GET_PATH USING 'PDF_FILE'.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FILENAME
FILETYPE = 'BIN'
BIN_FILESIZE = LEN_OUT
TABLES
DATA_TAB = ITAB2
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
*& Form GET_OTF_TAB
FORM GET_OTF_TAB.
DATA: PART(4) VALUE '0001',
BEGIN OF MSG,
A(40),
B(40),
C(40),
END OF MSG.
REFRESH DATA_SET.
DATA_SET_LINECOUNT = 0.
DATA_SET_IS_OTF = ' '.
OTF_PAGES = 0.
REFRESH OTF_PAGE_INDEX.
CALL 'RSPOACSD'.
SELECT * FROM TST05 WHERE DTHREAD = 'X'.
CALL 'RSPOAOSD'
ID 'ID' FIELD IDENT
ID 'TYPE' FIELD TST05-DTYPE
ID 'RECTYP' FIELD 'VYL----'
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
STATUS = SY-SUBRC.
IF STATUS = 0.
DSN_TYPE = TST05-DTYPE.
IF DSN_TYPE(3) = 'OTF'.
DATA_SET_IS_OTF = 'X'.
ENDIF.
ENDIF.
IF STATUS 24. EXIT. ENDIF.
ENDSELECT.
DATA_SET_VALID = 'X'.
DATA_SET_MAX_LINES = ( LINE_MAX * '1.1' ) + 100.
DO.
CLEAR: DATA_SET_LINE, DATA_SET_LENGTH.
CALL 'RSPOARSD'
ID 'BUFF' FIELD DATA_SET_LINE+5
ID 'DATALEN' FIELD DATA_SET_LENGTH
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
STATUS = SY-SUBRC.
IF STATUS = 36.
WHILE STATUS = 36.
CALL 'RSPOACSD'
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
ADD 1 TO PART.
IF DATA_SET_IS_OTF = ' '.
CALL 'RSPOAOSD'
ID 'ID' FIELD IDENT
ID 'TYPE' FIELD DSN_TYPE
ID 'PART' FIELD PART
ID 'RECTYP' FIELD 'VYL----'
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
ELSE.
CALL 'RSPOAOSD'
ID 'ID' FIELD IDENT
ID 'PART' FIELD PART
ID 'TYPE' FIELD DSN_TYPE
ID 'RECTYP' FIELD 'VYL----'
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
ENDIF.
IF SY-SUBRC NE 0. EXIT. ENDIF.
CLEAR: DATA_SET_LINE, DATA_SET_LENGTH.
CALL 'RSPOARSD'
ID 'BUFF' FIELD DATA_SET_LINE+5
ID 'DATALEN' FIELD DATA_SET_LENGTH
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
STATUS = SY-SUBRC.
ENDWHILE.
ENDIF.
IF STATUS 0 AND STATUS 40. EXIT. ENDIF.
DATA_SET = DATA_SET_LINE.
IF NOT ( DATA_SET_LENGTH IS INITIAL ).
DATA_SET-DATA_LENGTH = DATA_SET_LENGTH - 1.
ENDIF.
APPEND DATA_SET.
ADD 1 TO DATA_SET_LINECOUNT.
IF DATA_SET_IS_OTF = ' '.
IF DATA_SET_LINECOUNT >= DATA_SET_MAX_LINES.
CLEAR DATA_SET.
APPEND DATA_SET.
MOVE '----
' TO DATA_SET-DATA_LINE.
APPEND DATA_SET.
CLEAR DATA_SET.
APPEND DATA_SET.
WRITE: 'Abbruch nach'(029) TO MSG-A.
WRITE: DATA_SET_MAX_LINES TO MSG-B.
WRITE: 'Zeilen.'(030) TO MSG-C.
CONDENSE MSG.
DATA_SET-DATA_LINE = MSG.
APPEND DATA_SET.
EXIT.
ENDIF.
ELSE.
MOVE DATA_SET_LINE-DATA_LINE TO OTF_PAGE.
APPEND OTF_PAGE.
IF OTF_PAGE(2) = 'EP'.
ADD 1 TO OTF_PAGES.
IF OTF_PAGES >= OTF_MAX_PAGES.
MESSAGE S229(PO) WITH OTF_MAX_PAGES.
EXIT.
ENDIF.
ELSEIF OTF_PAGE(2) = 'OP'.
OTF_PAGE_INDEX-LINE_NUM = DATA_SET_LINECOUNT.
APPEND OTF_PAGE_INDEX.
ENDIF.
ENDIF.
ENDDO.
IF STATUS 0 AND STATUS 12.
CALL 'RSPOACSD'.
MESSAGE E112(PO) WITH STATUS RC ERRMSG.
ENDIF.
CALL 'RSPOACSD'.
STATUS = SY-SUBRC.
IF STATUS 0.
MESSAGE E112(PO) WITH STATUS RC ERRMSG.
ENDIF.
ENDFORM. " GET_OTF_TAB
*& Form GET_PATH
FORM GET_PATH USING P_FILENAME.
CLEAR: H_PATH, FILE_NAME.
FILE_NAME = P_FILENAME.
CALL FUNCTION 'WS_QUERY'
EXPORTING
QUERY = 'CD' "// Current Directory
IMPORTING
RETURN = H_PATH.
CONCATENATE FILE_NAME '.pdf' INTO FILE_NAME.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = FILE_NAME
DEF_PATH = H_PATH
MASK = H_MASK
MODE = 'O'
IMPORTING
FILENAME = FILENAME"dbname
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
ENDFORM. " GET_PATH
or
try these fun modules.
CONVERT_ITF_TO_RTF
LIST_CONVERT_TO_RTF
LIST_CONVERT_TO_RTF_FROM_LIST
SKTU_TEXT_GET_CONVERT_TO_RTF
reward if useful

Similar Messages

  • CONVERT_ABAPSPOOLJOB_2_PDF doesnt prompt to save the filename

    Dear all
       Here with this i m getting the spool but CONVERT_ABAPSPOOLJOB_2_PDF doesnt prompt to save the PDF file . Do i need to use GUI_DOWNLOAD along with this .
      PlllllZZZZZZ...... suggest
        SELECT SINGLE * FROM ZPLH WHERE VBELN = SSORD
                                  AND   POSNR = ITNO.
        IF SY-SUBRC EQ 0.
          DATA :   v_jobcount LIKE tbtcjob-jobcount,
                   ZTEST LIKE TBTCJOB-JOBNAME.
    *-- run in the background
          CALL FUNCTION 'JOB_OPEN'
               EXPORTING
                    jobname          = 'ZTEST'
               IMPORTING
                    jobcount         = v_jobcount
               EXCEPTIONS
                    cant_create_job  = 1
                    invalid_job_data = 2
                    jobname_missing  = 3
                    OTHERS           = 4.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            EXIT.
          ENDIF.
    *-- submit the program in the background
          SUBMIT ZPP_REP_ENCLOSURE_PACKLIST3
            WITH   JOBNO = SSORD
            WITH   LINENO = ITNO
            USER sy-uname
            TO SAP-SPOOL WITHOUT SPOOL DYNPRO
            DESTINATION 'LOHP'
            IMMEDIATELY 'X'
            KEEP IN SPOOL 'X'
            VIA JOB 'ZTEST' NUMBER v_jobcount AND RETURN.
          IF SY-SUBRC = 0.
             * Job scheduled successfully
          ENDIF.
          IF SY-SUBRC = 4.
           *Job scheduling terminated by user
          ENDIF.
          IF SY-SUBRC = 8.
           *Error in job scheduling (JOB_SUBMIT)
          ENDIF.
          IF SY-SUBRC = 12.
           *Error in internal number assignment .
          ENDIF.
    *-- close the job
          CALL FUNCTION 'JOB_CLOSE'
               EXPORTING
                    jobcount             = v_jobcount
                    jobname              = 'ZTEST'
                    strtimmed            = 'X'
               EXCEPTIONS
                    cant_start_immediate = 1
                    invalid_startdate    = 2
                    jobname_missing      = 3
                    job_close_failed     = 4
                    job_nosteps          = 5
                    job_notex            = 6
                    lock_failed          = 7
                    OTHERS               = 8.
                IF sy-subrc <> 0.
                    MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
                ENDIF.
           clear tbtcp.
             STEP = 1.
             select single listident from tbtcp
                                    into tbtcp-listident
                                   where jobname = 'ZTEST'
                                   and jobcount =  v_jobcount
                                   and stepcount = step.
            IF SY-SUBRC EQ 0.
              move tbtcp-listident to spool_id.
            ENDIF.
           CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
             EXPORTING
               SRC_SPOOLID                    = SPOOL_ID
               NO_DIALOG                      = ''
              DST_DEVICE                     = 'LOHP' "E_DEVTYPE
              PDF_DESTINATION                = 'LOHP'
            IMPORTING
               PDF_BYTECOUNT                  = BTC
             PDF_SPOOLID                    =
             LIST_PAGECOUNT                 =
             BTC_JOBNAME                    =
             BTC_JOBCOUNT                   =
            TABLES
               PDF                            = T_SPOOL_2_PDF
            EXCEPTIONS
              ERR_NO_ABAP_SPOOLJOB           = 1
              ERR_NO_SPOOLJOB                = 2
              ERR_NO_PERMISSION              = 3
              ERR_CONV_NOT_POSSIBLE          = 4
              ERR_BAD_DESTDEVICE             = 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 <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.
        ELSE.
           TEXT02 = ITNO.
           MESSAGE I014(ZQOTBANK) WITH TEXT02.
       ENDIF.
    Thnx
    Moni

    Hi MD,
    I download the result of the function like this :
        call function 'CONVERT_OTFSPOOLJOB_2_PDF'
          exporting
            src_spoolid                    = v_spoolid
            NO_DIALOG                      = 'X'
          IMPORTING
            PDF_BYTECOUNT                  = v_numbytes
          TABLES
            PDF                            = it_pdf.
        call function 'DOWNLOAD'
          exporting
            bin_filesize                  = v_numbytes
            filetype                      = 'BIN'
          importing
            act_filename                  = v_filename
          tables
            data_tab                      = it_pdf.
    Regards
    Frédéric

  • ALV o/p TO PDF Converison using  CONVERT_ABAPSPOOLJOB_2_PDF

    Hi Geeks,
    My rquirement is to attach the output of ALV report to the mail as PDF file.I am using FM "CONVERT_ABAPSPOOLJOB_2_PDF" for converting the ALV ouput to PDF format but when i check the data in PDF fomat table , it's corrupted and thus pdf file opens with error in the mail.
    Can anyone have some suggestion please !!!
    Usefull answer will be rewarded !!!

    Harmeet,
    Code is :
    Preparing the recepeint list
      LOOP AT S_EMAIL1.
        CLEAR : TBL_RECLIST.
        TBL_RECLIST-RECEIVER = S_EMAIL1-LOW.
        TBL_RECLIST-REC_TYPE = 'U'.
        APPEND TBL_RECLIST.
      ENDLOOP.
      LOOP AT S_EMAIl2.
        CLEAR : TBL_RECLIST.
        TBL_RECLIST-RECEIVER = S_EMAIL2-LOW.
        TBL_RECLIST-REC_TYPE = 'U'.
        APPEND TBL_RECLIST.
      ENDLOOP.
    PDF spooling (For generating spool number)
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        SRC_SPOOLID                    = lv_spool
        NO_DIALOG                      = c_no
        DST_DEVICE                     = c_device
      PDF_DESTINATION                =
      IMPORTING
        PDF_BYTECOUNT                  = LV_BYTE_COUNT
      PDF_SPOOLID                    =
      LIST_PAGECOUNT                 =
      BTC_JOBNAME                    =
      BTC_JOBCOUNT                   =
      TABLES
        PDF                            = TBL_PDF_OUTPUT[]
      EXCEPTIONS
        ERR_NO_ABAP_SPOOLJOB           = 1
        ERR_NO_SPOOLJOB                = 2
        ERR_NO_PERMISSION              = 3
        ERR_CONV_NOT_POSSIBLE          = 4
        ERR_BAD_DESTDEVICE             = 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 = 0.
            LOOP AT TBL_PDF_OUTPUT.
              TRANSLATE TBL_PDF_OUTPUT USING ' ~'.
              CONCATENATE LV_BUFFER TBL_PDF_OUTPUT INTO LV_BUFFER.
            ENDLOOP.
            TRANSLATE LV_BUFFER USING '~ '.
            DO.
              TBL_OBJBIN = LV_BUFFER.
              APPEND TBL_OBJBIN.
              SHIFT LV_BUFFER LEFT BY 255 PLACES.
              IF LV_BUFFER IS INITIAL.
                EXIT.
              ENDIF.
            ENDDO.
          ENDIF.
          DESCRIBE TABLE TBL_OBJBIN LINES LV_TBL_LINE.
        Prepare document
          LV_DOC-OBJ_NAME  = 'ERROR'.
          LV_DOC-OBJ_DESCR = 'ERROR IN OBZT MAINTENANCE – ACTION REQUIRED'.
        Prepare for attachement
          TBL_OBJPACK-TRANSF_BIN = 'X'.
          TBL_OBJPACK-HEAD_START = 1.
          TBL_OBJPACK-HEAD_NUM   = 0.
          TBL_OBJPACK-BODY_START = 2.
          TBL_OBJPACK-BODY_NUM   = LV_TBL_LINE.
          TBL_OBJPACK-DOC_TYPE = 'PDF'.
          TBL_OBJPACK-OBJ_NAME = 'ATTACHEMENT'.
          TBL_OBJPACK-OBJ_DESCR = 'Error in tax code with OBZT'.
          TBL_OBJPACK-DOC_SIZE = ( LV_TBL_LINE - 1 ) * 255  + STRLEN( TBL_OBJBIN ).
          APPEND TBL_OBJPACK .
          CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
            EXPORTING
              DOCUMENT_DATA                    = LV_DOC
            PUT_IN_OUTBOX                    = ' '
              COMMIT_WORK                      = 'X'
           IMPORTING
             SENT_TO_ALL                      =
             NEW_OBJECT_ID                    =
            TABLES
              PACKING_LIST                     = TBL_OBJPACK[]
             OBJECT_HEADER                    = TBL_OBJHEAD[]
              CONTENTS_BIN                     = TBL_OBJBIN[]
            CONTENTS_TXT                     =
            CONTENTS_HEX                     =
            OBJECT_PARA                      =
            OBJECT_PARB                      =
              RECEIVERS                        = TBL_RECLIST[]
            EXCEPTIONS
              TOO_MANY_RECEIVERS               = 1
              DOCUMENT_NOT_SENT                = 2
              DOCUMENT_TYPE_NOT_EXIST          = 3
              OPERATION_NO_AUTHORIZATION       = 4
              PARAMETER_ERROR                  = 5
              X_ERROR                          = 6
              ENQUEUE_ERROR                    = 7
              OTHERS                           = 8
        ENDIF.
    ENDIF.

  • Change of fontcolor in pdf (using CONVERT_ABAPSPOOLJOB_2_PDF)

    Hi,
    I'm  creating a PDF format from a report(list). This is the procedure I followed:
    1. Get print parameters
    2. Submit program using the statement
    SUBMIT sy_repid
    TO SAP-SPOOL WITHOUT SPOOL DYNPRO
    SPOOL PARAMETERS out_parameters
    AND RETURN.
    3. Get the spool number
    4. and use the Function module CONVERT_ABAPSPOOLJOB_2_PDF to generate PDF.
    Everything works, except for the fact that the font-color in the pdf is in blue.
    The customer wants to see in in black.
    Is it possible and if so, how?
    Tried the search, but no solution found yet.

    OK, thanx,
    no, i'm submitting a standard SAP-program, so I cant use the command there.
    Thanks anyway.

  • ABAP Rpt to PDF using CONVERT_ABAPSPOOLJOB_2_PDF issues in Batch

    Hi,
    We just upgraded to 731 level 09. Our program using CONVERT_ABAPSPOOLJOB_2_PDF works in the foreground. The PDF contains the report, It does not work in the background. The program does capture the spool number, but the PDF created is empty. The program did work in the background before the upgrade. Has anyone else experienced this? Any suggestions?
    Regards,
    Greg

    Hello,
    Check below note.
    1667737 - RSTXPDFT4: Conversion in background terminates
    Also, as per note check user profile for default printer.
    Regards,
    Sameer

  • CONVERT_ABAPSPOOLJOB_2_PDF  // PDF in email attachment

    Hello all,
    i have z report program that line-size 132 that write abap list (Write: / .....).
    1-Calling FM GET_PRINT_PARAMETERS, to print
    2-Calling FM JOB_OPEN, to get job name and number
    3-Calling my z-report program
        SUBMIT /sym/bb_q_perg01
               WITH prlos-low = prueflos
               VIA JOB job_name
               NUMBER job_count
               AND RETURN
               TO SAP-SPOOL
               SPOOL PARAMETERS ls_print_parameters
               ARCHIVE PARAMETERS ls_arc_params
               WITHOUT SPOOL DYNPRO.
    3-Calling FM CLOSE JOB
    4- getting spool # and convert spool via FM CONVERT_ABAPSPOOLJOB_2_PDF
    5- Call FM SCMS_BINARY_TO_XSTRING to convert script text line to hex string - byte sequence
    6-Call FM SCMS_XSTRING_TO_BINARY to convert hex string to binary
    7- send mail with PDF attachment
    Issue:
    All working fine only PDF recieved with small FONTs. which we print via attachment in email hard to see PDF contents.
    i tried many thing but no success. even i tried 132 to 255 no success same result
    Please, can any one help.

    Hi Mohammed,
    Use the page format functionality before calling the FM CONVERT_ABAPSPOOLJOB_2_PDF i.e. before 4th step.
    Below is the code:
    PERFORM page_format USING e_spool_no.
    FORM page_format USING e_spool_no TYPE rspoid.
    DATA: gt_spool TYPE TABLE OF rspodev,
          gs_spool TYPE rspodev.
      REFRESH: gt_spool[].
          CALL FUNCTION 'RSPO_R_SELECT_TSP01'
            EXPORTING
              rqident   = e_spool_no
            TABLES
              tsp01desc = gt_spool
            EXCEPTIONS
              error     = 1
              OTHERS    = 2.
          IF sy-subrc = 0.
    *Passing RQPAPER has the key and getting the paper format.
            READ TABLE gt_spool INTO gs_spool WITH KEY param = 'RQPAPER'.
            IF sy-subrc = 0.
              CASE gv_flag.
                WHEN 'X'.
                  gs_spool-value = gc_255.
                WHEN 'L'.
                  gs_spool-value = gc_512.
                WHEN OTHERS.
                  gs_spool-value = gc_200.
              ENDCASE.
              MODIFY gt_spool INDEX 21 FROM gs_spool.
            ENDIF.
          ENDIF.
      CALL FUNCTION 'RSPO_R_UPDATE_TSP01'
        TABLES
          tsp01desc = gt_spool.
      COMMIT WORK.
    ENDFORM.                    " PAGE_FORMAT
    Regards,
    Prathap

  • CONVERT_OTFSPOOLJOB_2_PDF / CONVERT_ABAPSPOOLJOB_2_PDF

    Hi,
    I have written a function module which calls CONVERT_OTFSPOOLJOB_2_PDF & CONVERT_ABAPSPOOLJOB_2_PDF depending on whether the input is OTF (SAPScript) or ABAP (text).
    Now my question :
    The PDF works fine with lower versions of Adobe, but it seems to be incompatible with higher versions of Adobe.
    Is there a way to make CONVERT_OTFSPOOLJOB_2_PDF & CONVERT_ABAPSPOOLJOB_2_PDF compatible with higher versions of Adobe, or is there any other standard function module which can support higher versions of PDF.
    SAP version which I am using is 4.0,
    Thanks in advance.

    if we craete spools from scripts or smart forms, OTF spool will be created
    TO CONVERT otf SPOOL TO PDF WE USE
    CONVERT_OTFSPOOLJOB_2_PDF and
    if we craete spools from REPORTS, ABAP spool will be created
    TO CONVERT ABAP SPOOL TO PDF WE USE
    CONVERT_ABAPSPOOLJOB_2_PDF
    Reward if useful

  • CONVERT_ABAPSPOOLJOB_2_PDF (font size)

    Hi.
    I am using function module <b>CONVERT_ABAPSPOOLJOB_2_PDF</b> in my program to create PDFs. This works fine, but recently I believe some system settings have been changed as the <b>font size</b> in the generated PDF has <b>increased</b> (no changes have been made to the program itself).
    If any, where do I get to see and/or change these settings?
    - Mari Virik

    Hi, thanks for your reply.
    Is there a standard SAP SmartForm that is used with CONVERT_ABAPSPOOLJOB_2_PDF? 
    In include <b>LSTXWFPL</b> (line 1371) which is used during processing of CONVERT_ABAPSPOOLJOB_2_PDF, I found this statement:
    <b>fontsize = 120.</b>
    This fontsize is then used when calling further function modules in the processing of CONVERT_ABAPSPOOLJOB_2_PDF, like in <b>FONT_EXCHANGE_ADD2TABLE</b>. If I <b>change</b> this fontsize value manually during debugging, say to 70, the PDF file is generated with the correct layout (suitable fontsize).
    ...what can I do to generate the PDF with correct fontsize?
    - Mari Virik

  • CONVERT_ABAPSPOOLJOB_2_PDF gives a diff result depending how it is run

    I will appoligize in advance for the lenght of this post, I just wanted to give enough details to be able present my problem.
    CONVERT_ABAPSPOOLJOB_2_PDF seems to give different reults when run in the foreground or background
    We have an old report that was designed to run in the foreground it is a multi step process:
    enter selection screen criteria
    build an internal table of data
    produce a report
    if the result is good
      the user saves the report as a PDF manually
      the user clicks a button to Build and Execute a BDC
      loop through the internal table
         write data a data set
         build an internal table for errors
         write a report with the errors
         submit another progam that reads the data set and builds the BDC
    Now without making any major design changes they want this report changed to be able to either run in the foreground without any user intervention or to be able to run in the background.
    Foreground:
    I have been able to:
    - open/close the spool
    - write to the spool
    - convert the spool to PDF using Function CONVERT_ABAPSPOOLJOB_2_PDF
    - download the file PDF to the local drive using Function 'DOWNLOAD'
    Background:
    I have been able to:
    - write to the spool
    - convert the spool to PDF using Function CONVERT_ABAPSPOOLJOB_2_PDF
    - write the PDF file to the UNIX server THIS HAD TO BE DONE PROGAMATICALLY
    If I run the same program with the same selection criteria in the foreground and background and I go into the SP02 and look at the spool they are identical.
    Problem:
    CONVERT_ABAPSPOOLJOB_2_PDF seems to give different reults when run in the foreground or background
    - the byte count
        Foreground - 14,935
        Background - 12,217
    - the PDF result is different
        Foreground - looks the same as the spool
        Background - does not contain the error section
    In the program I have do different things if I'm running in the foreground or background, but I'm using the same call to Function CONVERT_ABAPSPOOLJOB_2_PDF and the spool from either run looks the same.
    I have read in the forumn's that I function DOWNLOAD only works in the foreground.  OK so I had to write my own code to parse through the PDF table.
    Does anyone know why the result from CONVERT_ABAPSPOOLJOB_2_PDF would be different.
    Thanks for taking the time to read this.
    Jerry

    I believe I have figured it out.
    - I put a breakpoint at the call to CONVERT_ABAPSPOOLJOB_2_PDF
    - ran the program in the foreground
    - just prior to the call to CONVERT_ABAPSPOOLJOB_2_PDF I looked at the spool and it did not have the last page
    - execute CONVERT_ABAPSPOOLJOB_2_PDF byte count is 14,935
    - execute the rest of the program
    - look at the spool it now shows the last page
    - look at the PDF it matches the spool
    It appears that the last page of the spool may be buffered and may only show up in the spool when the program completes.
    It also appears that when CONVERT_ABAPSPOOLJOB_2_PDF is run in the foregound it includes the buffered spool information, but when CONVERT_ABAPSPOOLJOB_2_PDF is run in the background it does not.
    I added a 'NEW-PAGE' line after the last line in the report now the last page comes out when run in either the foreground or the background.
    Jerry

  • CONVERT_ABAPSPOOLJOB_2_PDF spools too wide

    Hi All
    I'm using function CONVERT_ABAPSPOOLJOB_2_PDF to convert our spools to PDF and then archive link it.
    However when you look at the spool in SP01, all our spools are 255 chars wide regardless of LINE-COUNT, LINE-SIZE and LAYOUT settings. You can look at the bottom of every spool to see there is a scrollbar that can scroll 255 chars to the right.
    Now when we create PDF and archive, it creates a very wide PDF document and when you view it as SD attached PDF document after archiving it is unacceptable. due to the landscape and tiny document to the left of the page. It looks the size of an A3 landscape.
    How can I define the width of the spool. As mentioned, defining LINE-SIZE or LAYOUT is of no use. The spool itself is much wider.
    Best regards,
    Adrian

    Supriya.ch answer was copied from http://forums.sdn.sap.com/thread.jspa?threadID=796083&tstart=0. His post has been rejected and the points removed.

  • Error in Spool to PDF conversion using 'CONVERT_ABAPSPOOLJOB_2_PDF'.

    Hi
    I am sending classical report output from the Spool to PDF using 'CONVERT_ABAPSPOOLJOB_2_PDF'.
    This is done through a batch job.
    Step 1 is RVKRED01 report
    Step 2 is a program that picks up the spool number of step1 and converts the spool to PDF.
    Now in step 2 I am getting following error.
    TEMSE_READ_LISTLINE error, TemssPart 1
    What can be the reason?
    What can be the solution?

    HI,
    I checked your FM CONVERT_ABAPSPOOLJOB_2_PDF.
    in the include LSTXWFPL line 1006, the IF condition is failing (if eop = 'X'. "end of part, read next part? )
    so you are getting that message,
    you can check that failing job in the debugging mode why it was failing at that point.
    Note: for checking the background job you need to do below things.
            1) go to sm37, and select you job.
            2) and just type "JDBG" in the command line it goes to the debugging mode of your job.
    by this way you will find. how and why its that error.
    Alternative to your FM ( CONVERT_ABAPSPOOLJOB_2_PDF ) you can also use the
    FM FPCOMP_CREATE_PDF_FROM_SPOOL.

  • Regarding FM : 'CONVERT_ABAPSPOOLJOB_2_PDF'

    While working on 2 different server I am getting different result from FM 'CONVERT_ABAPSPOOLJOB_2_PDF'
    Due to which attachment in PDF in second serever is not Proper...
    Does anyone have idea about it...
    Code for refernce is...
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid              = gd_spool_nr
          no_dialog                = c_no
          dst_device               = c_device
        IMPORTING
          pdf_bytecount            = gd_bytecount
        TABLES
          pdf                      = it_pdf_output
        EXCEPTIONS
          err_no_abap_spooljob     = 1
          err_no_spooljob          = 2
          err_no_permission        = 3
          err_conv_not_possible    = 4
          err_bad_destdevice       = 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.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_attach = gd_buffer.
        APPEND it_attach.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.

    Hii....
    Thanks for reply...
    But Bin_file M getting is also Blank, there is no data in Bin_file...
    The same program i had done in another server is working fine bt on this server output from the FM is getting smthing different.

  • Problem with CONVERT_ABAPSPOOLJOB_2_PDF through RFC

    Hi all,
    Basically I've copied the ABAP code from FM CONVERT_ABAPSPOOLJOB_2_PDF to an new FM Z_CONVERT_ABAPSPOOLJOB_2_PDF (and the same for CONVERT_OTFSPOOLJOB_2_PDF) and I've remotely enabled the new FM's for use with RFC (so I can use it with PHP saprfc).
    This works superb for OTF files (using Z_CONVERT_OTFSPOOLJOB_2_PDF) and I havn't had any problems at all.
    When I use it for ABAP spoollists (using Z_CONVERT_ABAPSPOOLJOB_2_PDF) 85% of the time I've get an error after opening the PDF in Adobe Reader:
    "An unrecognized token 'x,xxx' was found", where x is a number
    I think this probably has something to do with the fact that the ',' has to be a '.' (or vice versa), but I'm not sure...
    ... Maybe it has something to do with locale settings on sap server and the machine where the RFC function is called?
    Anyone has other ideas for solving this?
    Many thanks in advance.

    ... Please check this thread instead...
    ... thanks...
    Download spool as PDF with PHP problem

  • Problems with "convert_abapspooljob_2_pdf" and Adobe 8.0

    Hi
    I have created a report which converts a spool file to PDF using FM convert_abapspooljob_2_pdf, an sends  it as an email attachment using FM SO_DOCUMENT_SEND_API1.
    When using Adobe acrobat reader 7.0 on the client it works just fine, but if i'm trying to open the document with Adobe acrobat reader 8.0 ; I get the error message "There was an error opening this document. The file is damaged and could not be repaired".
    Have any of you faced this problem, and how do I solve this ?
    Regards
    Morten Nielsen

    Hi
    hmmm....   it looks like the report RSTXPDFT4 convert the spool file correctly - the error must be ind the send mail part of the report.  Do you have any Suggestions her ?
    Regards
    Morten Nielsen
    Source Code extract:
    FORM create_mail .
      DATA: lt_pdf       TYPE tline        OCCURS 0 WITH HEADER LINE,
            lt_pdf_out   TYPE solisti1     OCCURS 0 WITH HEADER LINE,
            lt_cont_bin  TYPE solisti1    OCCURS 0 WITH HEADER LINE,
            l_docdata    LIKE sodocchgi1,
            lt_plist     LIKE sopcklsti1   OCCURS 0 WITH HEADER LINE,
            lt_rec       LIKE somlreci1    OCCURS 0 WITH HEADER LINE,
            lt_cont      LIKE solisti1     OCCURS 0 WITH HEADER LINE,
            lt_attach    LIKE solisti1     OCCURS 0 WITH HEADER LINE,
            lt_objhead   LIKE solisti1     OCCURS  1 WITH HEADER LINE,
            l_sender     LIKE soextreci1-receiver,
            l_numbytes   TYPE i,
            l_pdfspoolid LIKE tsp01-rqident,
            l_jobname    LIKE tbtcjob-jobname,
            l_jobcount   LIKE tbtcjob-jobcount.
      DATA: wa_yum_sd_receiver TYPE yum_sd_receiver.
      DATA: tab_lines TYPE i.
      CONSTANTS: c_mail_subj_prefix type string  value 'IT Registration For '.
      LOOP AT lt_control .
        REFRESH: lt_pdf, lt_plist, lt_rec, lt_cont, lt_attach.
    Convert Spool File To PDF                                            *
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
          EXPORTING
            src_spoolid                    = lt_control-spool_id
      NO_DIALOG                      =
      DST_DEVICE                     =
      PDF_DESTINATION                =
          IMPORTING
            pdf_bytecount              = l_numbytes
            pdf_spoolid                = l_pdfspoolid
            btc_jobname                = l_jobname
            btc_jobcount               = l_jobcount
          TABLES
            pdf                            = lt_pdf
          EXCEPTIONS
            err_no_abap_spooljob           = 1
            err_no_spooljob                = 2
            err_no_permission              = 3
            err_conv_not_possible          = 4
            err_bad_destdevice             = 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 <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Collect Information For Sendmail Purpose                             *
    *Document Header data
        l_docdata-obj_name = 'OBJNAME'.
       l_docdata-obj_descr = 'Process RoleRequest for user'.
        CONCATENATE c_mail_subj_prefix
                    lt_control-yum_user
               into l_docdata-obj_descr.
    *Get Receiver
        SELECT SINGLE * FROM  yum_sd_receiver INTO wa_yum_sd_receiver
               WHERE  subsyst  = lt_control-subsystem.
        lt_rec-receiver = wa_yum_sd_receiver-receiver.
        lt_rec-rec_type = wa_yum_sd_receiver-rec_type.
        IF sy-subrc NE 0.
          MESSAGE e021(yum) WITH lt_control-subsystem.
      ERROR ! No Servicedesk mail-adress from for system & in YUM_SD_RECEIVER
        ENDIF.
        APPEND lt_rec.
    *Sender
        l_sender = lt_control-requester.
    *Create Mail Content
        CONCATENATE 'Please process approved role assignment for user'(017)
                    lt_control-yum_user
                    'in system'(018)
                    lt_control-subsystem
           INTO lt_cont-line SEPARATED BY space.
        APPEND lt_cont.
        DESCRIBE TABLE lt_cont LINES tab_lines.
        READ TABLE lt_cont INDEX tab_lines.
        l_docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( lt_cont ).
        CLEAR lt_plist.
        CLEAR lt_plist-transf_bin.
        lt_plist-head_start = 1.
        lt_plist-head_num = 0.
        lt_plist-body_start = 1.
        lt_plist-body_num = tab_lines.
        lt_plist-doc_type = 'TXT'.
        APPEND lt_plist.
    *Create Packing list
       create attachment
        CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
         EXPORTING
           line_width_src                    = 134
           line_width_dst                    = 255
      TRANSFER_BIN                      = ' '
          TABLES
            content_in                        = lt_pdf
            content_out                       = lt_pdf_out
          EXCEPTIONS
            err_line_width_src_too_long       = 1
            err_line_width_dst_too_long       = 2
            err_conv_failed                   = 3
            OTHERS                            = 4
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        APPEND LINES OF lt_pdf_out TO lt_cont_bin.
        lt_objhead = 'RoleRequest.PDF'.
        APPEND lt_objhead.
        DESCRIBE TABLE lt_cont_bin LINES tab_lines.
        READ TABLE lt_cont_bin INDEX tab_lines.
        l_docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( lt_cont_bin ).
       clear lt_plist.
       clear lt_plist-transf_bin.
        lt_plist-transf_bin = 'X'.
        lt_plist-head_start = 1.
        lt_plist-head_num = 1.
        lt_plist-body_start = 1.
        lt_plist-body_num = tab_lines.
        lt_plist-doc_type = 'PDF'.
        lt_plist-obj_name = 'Attachment'.
        lt_plist-obj_descr = 'RoleRequest'.
        lt_plist-doc_size = tab_lines * 255.
        APPEND lt_plist.
    Send Mail                                                            *
        IF p_send EQ 'X'. "Do Not Send in Test Mode
          CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
            EXPORTING
              document_data                    = l_docdata
              put_in_outbox                    = 'X'
              sender_address                   = l_sender
              sender_address_type              = 'B'
              commit_work                      = 'X'
        IMPORTING
          SENT_TO_ALL                      =
          NEW_OBJECT_ID                    =
          SENDER_ID                        =
            TABLES
              packing_list                     = lt_plist
              object_header                    = lt_objhead
              contents_bin                     = lt_cont_bin
              contents_txt                     = lt_cont
          CONTENTS_HEX                     =
          OBJECT_PARA                      =
          OBJECT_PARB                      =
              receivers                        = lt_rec
           EXCEPTIONS
             too_many_receivers               = 1
             document_not_sent                = 2
             document_type_not_exist          = 3
             operation_no_authorization       = 4
             parameter_error                  = 5
             x_error                          = 6
             enqueue_error                    = 7
             OTHERS                           = 8
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " create_mail

  • Using CONVERT_ABAPSPOOLJOB_2_PDF

    HI,
    I have a spool and passing it to CONVERT_ABAPSPOOLJOB_2_PDF to get converted to pdf. Though I don't get any errors data is not converted properly. I have around 2500 records and when I see the o/p table after fm it has got only 10 recs. Has anybody got an idea???? Please revert back it's urgent.

    Hi,
    I have sen that I'm getting output from there. Below is the sample o/p from that program.
    Test: GUI Download of Spool Request                                                                               
    Spool request has been read    25,849                                     
    Number of pages in spool request:           0                             
    Read Temse part    1                                                      
    00070  XOO   E       CO                   688        1        1           
    00070        90207560                                                     
    00070        Unprocessed future change recs for order 90207560 prevent del.
    00070  XOO   E       CO                   688        1        1           
    00070        90212423                                                     
    00070        Unprocessed future change recs for order 90212423 prevent del.
    00070  XOO   E       CO                   688        1        1           
    00070        90249539                                                     
    00070        Unprocessed future change recs for order 90249539 prevent del.
    00070  XOO   E       CO                   688        1        1           
    00070        90261266                                                     
    00070        Unprocessed future change recs for order 90261266 prevent del.
    00070  XOO   E       CO                   688        1        1           
    00070        90261277                                                     
    00070        Unprocessed future change recs for order 90261277 prevent del.
    00070  XOO   E       CO                   688        1        1           
    00070        90272206

  • Attachment size using fm convert_abapspooljob_2_pdf

    Is there any method to reduce the PDF size created by the FM convert_abapspooljob_2_pdf?  There is a 150+ page report that a few users need (well, that they think they need) via an email attachment.
    Right now it's converting to a 30+ MB attachment and the send fails.
    Thanx
    Mark

    This question has been discussed many times. That means: I hardly believe you didn´t find any relevant information source. Did you search? There are factors causing the PDF to be large, like coloring. If you would remove the coloring of the cells, the file size should shrink. In case you would like to create a PDF file like 100x smaller, why don´t you create an Adobe form for this purpose? Without any special magic, it would take you like half an hour.
    regards Otto

Maybe you are looking for