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

Printing PDF format (Xstring)data from ABAP report

Hi,

I need to print the PDF format data retrieved from the archived data objects from abap report,can anybody throw some light on this,tried with print on command,nothing worked.

your reaponse will be appreciated

Thanks

Thiru.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 28, 2007 at 08:30 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 28, 2007 at 08:39 PM

    Hi DJ,

    I have to print the Xstring data directly from the report without calling any smartform/PDF forms.

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 29, 2007 at 05:09 AM

    Please go throught the code ...followin is salary sending program to all the employees as pdf attach file of his salary breakup ......Hope this helps you.

    DATA W_OPTIONS LIKE ITCPO OCCURS 0 WITH HEADER LINE.

    DATA : z_itcpp LIKE itcpp OCCURS 0 WITH HEADER LINE.

    DATA : otfdt like ITCOO OCCURS 0 WITH HEADER LINE.

    DATA : pdfdt like TLINE OCCURS 0 with header line.

    DATA: NUMBYTES TYPE I.

    DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.

    DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.

    DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

    DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

    DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.

    DATA: DOC_CHNG LIKE SODOCCHGI1.

    DATA: TAB_LINES LIKE SY-TABIX.

    DATA: Begin of i_errors occurs 0,

    type(1) type c,

    descr(100) type c,

    End of i_errors.

    w_options-tdprinter = 'POSTSCPT'.

    W_options-TDRDIDEV = 'XP45'.

    W_options-TDGETOTF = 'X'.

    APPEND W_options.

    call function 'OPEN_FORM'

    exporting

    device = 'PRINTER'

    dialog = ' '

    form = 'ZHRPAYSLIP'

    language = sy-langu

    options = w_options

    • IMPORTING

    • LANGUAGE =

    • NEW_ARCHIVE_PARAMS =

    • RESULT =

    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

    others = 10 .

    CALL FUNCTION 'CLOSE_FORM'

    • IMPORTING

    *

    • RDI_RESULT =

    TABLES

    OTFDATA = otfdt

    EXCEPTIONS

    UNOPENED = 1

    BAD_PAGEFORMAT_FOR_PRINT = 2

    SEND_ERROR = 3

    OTHERS = 4.

    EXPORT otfdt TO MEMORY ID 'PDFT'.

    CALL FUNCTION 'CONVERT_OTF'

    EXPORTING

    FORMAT = 'PDF'

    • MAX_LINEWIDTH = 132

    • ARCHIVE_INDEX = ' '

    • COPYNUMBER = 0

    • ASCII_BIDI_VIS2LOG = ' '

    • PDF_DELETE_OTFTAB = ' '

    IMPORTING

    BIN_FILESIZE = NUMBYTES

    • BIN_FILE =

    TABLES

    otf = otfdt

    lines = pdfdt

    • EXCEPTIONS

    • ERR_MAX_LINEWIDTH = 1

    • ERR_FORMAT = 2

    • ERR_CONV_NOT_POSSIBLE = 3

    • ERR_BAD_OTF = 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 .

    Refresh OBJTXT. clear OBJTXT.

    Refresh OBJPACK. clear OBJPACK.

    Refresh objbin. clear objbin.

    Refresh OBJHEAD. clear OBJHEAD.

    Refresh RECLIST. Clear RECLIST.

    • Creation of the document to be sent

    • File Name

    DOC_CHNG-OBJ_NAME = 'PAYSLIP'.

    • Mail Subject

    DOC_CHNG-OBJ_DESCR = 'Payslip'.

    • Mail Contents

    OBJTXT = 'This e-mail was sent from an automated system...'.

    APPEND OBJTXT.

    OBJTXT = 'Do not reply to this message.'.

    APPEND OBJTXT.

    OBJTXT = 'Please open the attachment to view the Payslip'.

    APPEND OBJTXT.

    OBJTXT = ''.

    APPEND OBJTXT.

    if not msgtxt1 is initial.

    OBJTXT = msgtxt1.

    APPEND OBJTXT.

    endif.

    if not msgtxt2 is initial.

    OBJTXT = msgtxt2.

    APPEND OBJTXT.

    endif.

    if not msgtxt3 is initial.

    OBJTXT = msgtxt3.

    APPEND OBJTXT.

    endif.

    DESCRIBE TABLE OBJTXT LINES TAB_LINES.

    READ TABLE OBJTXT INDEX TAB_LINES.

    DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).

    • Creation of the entry for the compressed document

    CLEAR OBJPACK-TRANSF_BIN.

    OBJPACK-HEAD_START = 1.

    OBJPACK-HEAD_NUM = 0.

    OBJPACK-BODY_START = 1.

    OBJPACK-BODY_NUM = TAB_LINES.

    OBJPACK-DOC_TYPE = 'RAW'.

    APPEND OBJPACK.

    • Creation of the document attachment

    CALL FUNCTION 'QCE1_CONVERT'

    TABLES

    t_source_tab = pdfdt

    t_target_tab = objbin

    EXCEPTIONS

    convert_not_possible = 1

    OTHERS = 2.

    describe table objbin lines tab_lines.

    OBJHEAD = 'Payslip.PDF'.

    APPEND OBJHEAD.

    • Creation of the entry for the compressed attachment

    OBJPACK-TRANSF_BIN = 'X'.

    OBJPACK-HEAD_START = 1.

    OBJPACK-HEAD_NUM = 1.

    OBJPACK-BODY_START = 1.

    OBJPACK-BODY_NUM = TAB_LINES.

    OBJPACK-DOC_TYPE = 'PDF'.

    OBJPACK-OBJ_NAME = 'Payslip'.

    OBJPACK-OBJ_DESCR = 'Payslip'.

    OBJPACK-DOC_SIZE = TAB_LINES * 255.

    APPEND OBJPACK.

    • Completing the recipient list

    • Read table i_pa0105 with key pernr = pernr-pernr binary search.

    loop at i_pa0105 where pernr = pernr-pernr and USRTY = '0010'.

    endloop.

    if sy-subrc = 0.

    RECLIST-RECEIVER = i_pa0105-USRID_LONG.

    RECLIST-REC_TYPE = 'U'.

    APPEND RECLIST.

    endif.

    if RECLIST[] is initial.

    loop at i_pa0105 where pernr = pernr-pernr and USRTY = 'MAIL'.

    endloop.

    if sy-subrc = 0.

    RECLIST-RECEIVER = i_pa0105-USRID.

    RECLIST-REC_TYPE = 'U'.

    APPEND RECLIST.

    endif.

    endif.

    if not RECLIST[] is initial.

    • Sending the document

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

    DOCUMENT_DATA = DOC_CHNG

    PUT_IN_OUTBOX = ''

    COMMIT_WORK = 'X'

    TABLES

    PACKING_LIST = OBJPACK

    OBJECT_HEADER = OBJHEAD

    CONTENTS_BIN = OBJBIN

    CONTENTS_TXT = OBJTXT

    RECEIVERS = RECLIST

    EXCEPTIONS

    TOO_MANY_RECEIVERS = 1

    DOCUMENT_NOT_SENT = 2

    OPERATION_NO_AUTHORIZATION = 4

    OTHERS = 99.

    CASE SY-SUBRC.

    WHEN 0.

    LOOP AT RECLIST.

    • Concatenate pernr-pernr '-' RECLIST-RECEIVER(48)

    into error1.

    IF RECLIST-RETRN_CODE = 0.

    • Concatenate error1 ': The document was sent' into

    error1.

    i_errors-descr = pernr-pernr.

    i_errors-type = 'S'.

    append i_errors.

    ELSE.

    Concatenate error1 ': The document could not be

    sent' into error1.

    i_errors-descr = error1.

    i_errors-type = 'E'.

    append i_errors.

    ENDIF.

    ENDLOOP.

    WHEN 1.

    Concatenate pernr-pernr '-' RECLIST-RECEIVER(48) into

    error1.

    Concatenate error1 ': No authorization for sending to the

    recipients' into error1.

    i_errors-descr = error1.

    i_errors-type = 'E'.

    append i_errors.

    WHEN 2.

    Concatenate pernr-pernr '-' RECLIST-RECEIVER(48) into

    error1.

    Concatenate error1 ': Document could not be sent to the

    recipient' into error1.

    i_errors-descr = error1.

    i_errors-type = 'E'.

    append i_errors.

    WHEN 4.

    Concatenate pernr-pernr '-' RECLIST-RECEIVER(48) into

    error1.

    Concatenate error1 ': No send authorization' into error1.

    i_errors-descr = error1.

    i_errors-type = 'E'.

    append i_errors.

    WHEN OTHERS.

    Concatenate pernr-pernr '-' RECLIST-RECEIVER(48) into

    error1.

    Concatenate error1 ': Error occurred while sending' into

    error1.

    i_errors-descr = error1.

    i_errors-type = 'E'.

    append i_errors.

    ENDCASE.

    else.

    error1 = pernr-pernr.

    • Concatenate error1 ': Maintain Infotype 0105.' into error1.

    i_errors-descr = error1.

    i_errors-type = 'M'.

    append i_errors.

    endif.

    regards

    dinesh

    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.