Skip to Content
author's profile photo Former Member
Former Member

Download spool data in pdf format

Hi All,

When i am downloading spool data in pdf format,data is truncated due to large number of columns in spool.

Is there any possible way so that i can download proper data of spool in pdf format.

Thanks in Adv.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 05:17 AM

    dear friend

    this is for you and

    if there is any problem pls keep in touch.

    rewards are expecting.

    vivek

    &----


    *& Report Y_SD_PRE_SHIPMENT

    *&

    &----


    *&

    *&

    &----


    REPORT y_sd_pre_shipment.

    **************DATA DECLARATION****************************************

    DATA : BEGIN OF i_vbrk OCCURS 0,

    vbeln TYPE vbrp-vbeln,

    END OF i_vbrk.

    DATA: prog TYPE sy-repid,

    dynnr TYPE sy-dynnr,

    FNAM TYPE RS38L_FNAM,

    v_vbeln type ZSDTANNXINV-vbeln,

    idx type i,

    cnt type i.

    DATA: I_FINAL TYPE TABLE OF YPSHIP,

    W_FINAL TYPE YPSHIP.

    DATA: I_HEAD TYPE TABLE OF YPSHIP1,

    W_HEAD TYPE YPSHIP1.

    ************************************************************************

    DATA: it_otf TYPE STANDARD TABLE OF itcoo,

    it_docs TYPE STANDARD TABLE OF docs,

    it_lines TYPE STANDARD TABLE OF tline,

    st_job_output_info TYPE ssfcrescl,

    st_document_output_info TYPE ssfcrespd,

    st_job_output_options TYPE ssfcresop,

    st_output_options TYPE ssfcompop,

    st_control_parameters TYPE ssfctrlop,

    v_len_in TYPE so_obj_len,

    v_language TYPE sflangu VALUE 'E',

    v_e_devtype TYPE rspoptype,

    v_bin_filesize TYPE i,

    v_name TYPE string,

    v_path TYPE string,

    v_fullpath TYPE string,

    v_filter TYPE string,

    v_uact TYPE i,

    v_guiobj TYPE REF TO cl_gui_frontend_services,

    v_filename TYPE string.

    ****************************************************************

    ******USER INTERACTION OPTION FOR THE INVOICE NO

    ****************************************************************

    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE r.

    PARAMETERS: invoice LIKE ZSDTANNXINV-vbeln obligatory .

    SELECTION-SCREEN : END OF BLOCK b1.

    *********************************************************************

    *********************************************************************

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR invoice.

    REFRESH i_vbrk.

    SELECT vbeln FROM vbrk INTO TABLE i_vbrk.

    IF sy-subrc IS INITIAL.

    prog = sy-repid.

    dynnr = sy-dynnr.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    • DDIC_STRUCTURE = ' '

    retfield = 'VBELN'

    dynpprog = prog

    dynpnr = dynnr

    dynprofield = 'INVOICE'

    value_org = 'S'

    TABLES

    value_tab = i_vbrk.

    • FIELD_TAB =

    • RETURN_TAB =

    • DYNPFLD_MAPPING =

    • exceptions

    • parameter_error = 1

    • no_values_found = 2

    • others = 3

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDIF.

    *************************************************************************

    at selection-screen on invoice.

    if invoice is not initial.

    clear v_vbeln.

    select single vbeln from ZSDTANNXINV into v_vbeln where vbeln = invoice.

    if sy-subrc is not initial.

    message 'Enter Valid Document No' type 'E'.

    endif.

    endif.

    *************************************************************************

    START-OF-SELECTION.

    perform get_data.

    perform process_data.

    &----


    *& Form get_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form get_data .

    IF INVOICE IS NOT INITIAL.

    SELECT VBELN

    VTEXT

    NETWT

    GROSSWT

    vsslname

    kindofpack

    INCO1

    INCO2

    REMDATE

    DESTINATION

    SHPNGLIN1

    CNTRNO

    TRAILERNO1

    ETDDATE

    ETADATE

    baanr

    FROM ZSDTANNXINV

    INTO TABLE I_HEAD

    WHERE VBELN = INVOICE.

    ENDIF.

    IF I_HEAD[] IS NOT INITIAL.

    select vbeln

    POSNR

    MATNR

    MAKTX

    meins

    RATE

    VALUE

    WAERK

    PRPOSNR

    from zsafii

    into corresponding fields of table i_final

    for all entries in i_head

    where vbeln = i_head-vbeln.

    ENDIF.

    describe table i_final lines cnt.

    idx = 1.

    loop at i_final into w_final.

    if idx le cnt.

    read table i_head into w_head with key vbeln = w_final-vbeln.

    if sy-subrc is initial.

    move-corresponding w_head to w_final.

    modify i_final from w_final index idx.

    idx = idx + 1.

    endif.

    endif.

    endloop.

    endform. " get_data

    &----


    *& Form process_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form process_data .

    ***********************************************

    CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

    EXPORTING

    i_language = v_language

    i_application = 'SAPDEFAULT'

    IMPORTING

    e_devtype = v_e_devtype.

    st_output_options-tdprinter = v_e_devtype.

    *st_output_options-tdprinter = 'locl'.

    st_control_parameters-no_dialog = 'X'.

    st_control_parameters-getotf = 'X'.

    ***************************************************

    sort i_final by vbeln.

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

    formname = 'Y_SSF_PRESHIPMENT'

    • VARIANT = ' '

    • DIRECT_CALL = ' '

    IMPORTING

    FM_NAME = FNAM

    • EXCEPTIONS

    • NO_FORM = 1

    • NO_FUNCTION_MODULE = 2

    • OTHERS = 3

    .

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    if fnam is not initial.

    CALL FUNCTION FNAM

    EXPORTING

    • ARCHIVE_INDEX =

    • ARCHIVE_INDEX_TAB =

    • ARCHIVE_PARAMETERS =

    CONTROL_PARAMETERS = st_control_parameters

    • MAIL_APPL_OBJ =

    • MAIL_RECIPIENT =

    • MAIL_SENDER =

    OUTPUT_OPTIONS = st_output_options

    • USER_SETTINGS = 'X'

    IMPORTING

    DOCUMENT_OUTPUT_INFO = st_document_output_info

    JOB_OUTPUT_INFO = st_job_output_info

    JOB_OUTPUT_OPTIONS = st_job_output_options

    TABLES

    itab = I_FINAL

    i_head = I_HEAD

    • EXCEPTIONS

    • FORMATTING_ERROR = 1

    • INTERNAL_ERROR = 2

    • SEND_ERROR = 3

    • USER_CANCELED = 4

    • OTHERS = 5

    .

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ******************************************************************************

    .........................CONVERT TO OTF TO PDF.......................

    CALL FUNCTION 'CONVERT_OTF_2_PDF'

    IMPORTING

    bin_filesize = v_bin_filesize

    TABLES

    otf = st_job_output_info-otfdata

    doctab_archive = it_docs

    lines = it_lines

    EXCEPTIONS

    err_conv_not_possible = 1

    err_otf_mc_noendmarker = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ........................GET THE FILE NAME TO STORE....................

    CONCATENATE 'smrt' '.pdf' INTO v_name.

    CREATE OBJECT v_guiobj.

    CALL METHOD v_guiobj->file_save_dialog

    EXPORTING

    default_extension = 'pdf'

    default_file_name = v_name

    file_filter = v_filter

    CHANGING

    filename = v_name

    path = v_path

    fullpath = v_fullpath

    user_action = v_uact.

    IF v_uact = v_guiobj->action_cancel.

    EXIT.

    ENDIF.

    ..................................DOWNLOAD AS FILE....................

    MOVE v_fullpath TO v_filename.

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    bin_filesize = v_bin_filesize

    filename = v_filename

    filetype = 'BIN'

    TABLES

    data_tab = it_lines

    EXCEPTIONS

    file_write_error = 1

    no_batch = 2

    gui_refuse_filetransfer = 3

    invalid_type = 4

    no_authority = 5

    unknown_error = 6

    header_not_allowed = 7

    separator_not_allowed = 8

    filesize_not_allowed = 9

    header_too_long = 10

    dp_error_create = 11

    dp_error_send = 12

    dp_error_write = 13

    unknown_dp_error = 14

    access_denied = 15

    dp_out_of_memory = 16

    disk_full = 17

    dp_timeout = 18

    file_not_found = 19

    dataprovider_exception = 20

    control_flush_error = 21

    OTHERS = 22.

    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.

    ********************************************************************8

    endform. " process_data

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hio,

      Try this sample code using a function module to convert ur spool into PDF.

      TABLES TSP01.
      DATA: MTAB_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE,
      MC_FILENAME LIKE RLGRAP-FILENAME.
      DATA: MSTR_PRINT_PARMS LIKE PRI_PARAMS,
      MC_VALID(1) TYPE C,
      MI_BYTECOUNT TYPE I.
      PARAMETERS: P_RQIDET LIKE TSP01-RQIDENT, "SPOOL TO CONVERT
      P_PDFILE LIKE SY-REPID. " PDF FILENAME
      
      START-OF-SELECTION.
      
      CONCATENATE 'C:\' P_PDFILE '.PDF' INTO MC_FILENAME.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
      COPIES = '1'
      COVER_PAGE = SPACE
      DESTINATION = SPACE
      EXPIRATION = '1'
      IMMEDIATELY = SPACE
      LAYOUT = SPACE
      MODE = SPACE
      NEW_LIST_ID = 'X'
      NO_DIALOG = 'X'
      USER = SY-UNAME
      IMPORTING
      OUT_PARAMETERS = MSTR_PRINT_PARMS
      VALID = MC_VALID
      EXCEPTIONS
      ARCHIVE_INFO_NOT_FOUND = 1
      INVALID_PRINT_PARAMS = 2
      INVALID_ARCHIVE_PARAMS = 3
      OTHERS = 4.
      IF SY-SUBRC EQ 0.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
      SRC_SPOOLID = P_RQIDET
      NO_DIALOG = SPACE
      DST_DEVICE = MSTR_PRINT_PARMS-PDEST
      IMPORTING
      PDF_BYTECOUNT = MI_BYTECOUNT
      TABLES
      PDF = MTAB_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 EQ 0.
      CALL FUNCTION 'DOWNLOAD'
      EXPORTING
      BIN_FILESIZE = MI_BYTECOUNT
      FILENAME = MC_FILENAME
      FILETYPE = 'BIN'
      IMPORTING
      ACT_FILENAME = MC_FILENAME
      TABLES
      DATA_TAB = MTAB_PDF
      EXCEPTIONS
      INVALID_FILESIZE = 1
      INVALID_TABLE_WIDTH = 2
      INVALID_TYPE = 3
      NO_BATCH = 4
      UNKNOWN_ERROR = 5
      GUI_REFUSE_FILETRANSFER = 6
      CUSTOMER_ERROR = 7
      OTHERS = 8.
      IF SY-SUBRC EQ 0.
      WRITE:/ MC_FILENAME, 'CONVERTED TO PDF AND DOWNLOADED'.
      ELSE.
      WRITE:/ 'PROBLEM WITH DOWNLOAD'.
      ENDIF.
      ELSE.
      WRITE:/ 'PROBLEM WITH PDF CONVERSION'.
      ENDIF.
      ELSE.
      WRITE:/ 'PROBLEM GETTING PRINT PARAMETERS'.
      ENDIF.

      Hope this will help you.

      Thanks

      Vikranth

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 06:53 AM

    Plz anyone tell how can i doenload spool data in proper format.

    i have tred both option provided but still i am not getting proper data

    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.