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

PO in PDF Format

Hi all,

I want to view the PO O/P in PDF Format. The Layout is a "Z" layout.In case I'm using a "Z" report to call this layout.Instead of seeing the O/P in Sapscript O/P , I want to see it in a PDF Format. Any FM"s or any BAPI's or any Methods? Any help would be helpful.

I'm working in SAP R/3 4.7 version.Is it Possible?

Regards,

Ramky.G

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2006 at 10:19 AM

    hi ,

    it is possible , so please search in this Forum before posting .

    Regards

    prabhu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2006 at 10:23 AM

    In the parameter switch on the GET_OTF parameter, then you will get the output in the OTFTABLE. Use this as input to CONVERT_OTF_2_PDF function.

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2006 at 10:27 AM

    try the FM ECP_PDF_DISPLAY.

    there is some info given in its source code regarding its execution procedure.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2006 at 10:27 AM

    hi ,

    THE following code will solce it completely.

    • generated result: PDF format

    data: ls_line type tline,

    l_pdf_len type i.

    data: r_string type string.

    data: R_XSTRING type xstring.

    data: result type tlinetab.

    DATA: cached_response TYPE REF TO if_http_response.

    data: guid type GUID_32 .

    data: po_num type ebeln.

    po_num = '4500000001'.

    CALL FUNCTION 'ZSP_PO_DOWNLOAD'

    EXPORTING

    PO_NUM = po_num

    • IMPORTING

    • RETURN =

    TABLES

    PDF = result .

    if sy-subrc = 0.

    status = 1.

    endif.

    loop at result into ls_line.

    TRANSLATE ls_line USING ' ~'.

    CONCATENATE r_string ls_line INTO r_string IN CHARACTER MODE.

    endloop.

    TRANSLATE r_string USING '~ ' .

    ****Convert the Character String to Binary String

    call function 'SCMS_STRING_TO_XSTRING'

    EXPORTING

    text = r_string

    IMPORTING

    buffer = R_XSTRING.

    CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING

    add_c_msg = 1.

    l_pdf_len = xstrlen( R_XSTRING ).

    cached_response->set_data( data = R_XSTRING

    length = l_pdf_len ).

    cached_response->set_header_field( name =

    if_http_header_fields=>content_type

    value = 'application/pdf' ).

    cached_response->set_status( code = 200 reason = 'OK' ).

    cached_response->server_cache_expire_rel( expires_rel = 180 ).

    CALL FUNCTION 'GUID_CREATE'

    IMPORTING

    ev_guid_32 = guid.

    CONCATENATE runtime->application_url '/' guid '.pdf' INTO

    display_url.

    cl_http_server=>server_cache_upload( url = display_url

    response = cached_response ).

    RETURN.

    **********Funtion ZSP_PO_DOWNLOAD***********

    FUNCTION ZSP_PO_DOWNLOAD.

    *"----


    ""Local Interface:

    *" IMPORTING

    *" VALUE(PO_NUM) TYPE EBELN

    *" VALUE(PATH) TYPE RLGRAP-FILENAME DEFAULT 'C:\TEMP\FILE.PDF'

    *" EXPORTING

    *" VALUE(RETURN) TYPE FLAG

    *" TABLES

    *" PDF TYPE TLINETAB

    *"----


    fullpath = PATH.

    RETURN = 1.

    select single * into ex from NAST

    where OBJKY = PO_NUM and kschl = 'NEU'.

    .

    CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'

    EXPORTING

    IX_NAST = ex

    IX_SCREEN = 'X'

    IMPORTING

    EX_RETCO = EX_RETCO

    DOC = DOC

    EX_NAST = EX_NAST

    CHANGING

    CX_DRUVO = CX_DRUVO

    .

    .

    CALL FUNCTION 'ME_PRINT_PO'

    EXPORTING

    IX_NAST = ex_nast

    IX_DRUVO = cx_druvo

    DOC = doc

    IX_SCREEN = ' '

    IMPORTING

    EX_RETCO = ex_retco

    SPID = SPID

    .

    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'

    EXPORTING

    SRC_SPOOLID = SPID

    NO_DIALOG = ' '

    IMPORTING

    PDF_BYTECOUNT = numbytes

    PDF_SPOOLID = id

    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 <> 0.

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

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

    ENDIF.

    if cancel = space.

    RETURN = '0'.

    endif.

    ENDFUNCTION.

    regards

    Aashish Garg

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2006 at 10:27 AM

    Two suggestions.

    1). Check the possibility of using FM :<b>CONVERT_ABAPSPOOLJOB_2_PDF</b>.

    2).There is Standard prog in SAP for PDF upload/download files viz : <b>RSTXPDFT5 or RSTXPDFT4</b>. You can follow the functionality used over there.

    rgds,

    TM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 19, 2006 at 10:32 AM
    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.