• ABAP Online Training @ $50

    Now you can learn ABAP by watching and listening video classes by experienced consultant.

  • ABAP Tutorials N Materials

    Read, Surf and Download useful ABAP tips, tutorials, code and download many eBooks and documents free

  • Latest ABAP Job in India

    Get all latest opening for SAP ABAP and related jobs, vaccancies across India and apply for the same.

    Thursday, May 24, 2012

    We can use  the below function modules to convert text/attachments(pdf,word doc,excel) files to XSTRING format and then later open them as original document.

    First convert the Document as Binary. That we can find easily.

     

    call function 'SCMS_BINARY_TO_XSTRING'

                 exporting

                      input_length =

                      first_line   =

                      last_line    =

                 importing

                      buffer       =

                 tables

                      binary_tab   = l_content_bin

                 exceptions

                      failed       = 1

                      others       = 2.

     

     

    call function 'SCMS_FTEXT_TO_XSTRING'

                 exporting

                      input_length =

                      first_line   =

                      last_line    =

                      mimetype     =

                 importing

                      buffer       =

                 tables

                      ftext_tab    = l_content_txt

                 exceptions

                      failed       = 1

                      others       = 2.

     

    call function 'SCMS_TEXT_TO_XSTRING'

                 exporting

                      first_line =

                      last_line  =

                      mimetype   =

                 importing

                      buffer     =

                 tables

                      text_tab   = l_content_txt

                 exceptions

                      failed     = 1

                      others     = 2.

     

    To open the document from a Webdynpro abap window, try the below code.

     

    CALL METHOD cl_wd_runtime_services=>attach_file_to_response

      EXPORTING

        i_filename      = lv_text

        i_content       = = l_content_bin / l_content_txt

        i_mime_type     = 'application/pdf'

        i_in_new_window = ABAP_FALSE

        i_inplace       = ABAP_FALSE .

     

    Here just pass the MIME TYPE based on your attachment.

    application/octet-stream

    Binary file. Default if data is primarily binary.

    application/postscript

    PostScript (.ai, .eps, or .ps) file.

    application/base64

    Base64-encoded bytes.

    application/macbinhex40

    BinHex for Macintosh.

    application/pdf

    Portable Document Format (PDF).

    application/xml

    XML data. Must be server-supplied. See also "text/xml" type.

    application/atom+xml

    Internet Explorer 7 and later. Atom Syndication Format feed.

    application/rss+xml

    Internet Explorer 7 and later. Really Simple Syndication (RSS) feed.

    application/x-compressed

    UNIX tar file, Gzipped.

    application/x-zip-compressed

    Compressed archive file.

    application/x-gzip-compressed

    Gzip compressed archive file.

    application/java

    Java applet.

    application/x-msdownload

    Executable (.exe or .dll) file.


    1 comment:

    1. I’m wondering how I might be notified whenever a new post has been made. I’ve subscribed to your RSS feed which must do the trick! Have a great day! android app development

      ReplyDelete

    Easy2learnabap.co.in @ 2012 All product names on this web site are trademarks of the companies that own them .

    Easy2learnabap.co.in is not affiliated with SAP AG in any way. SAP AG is the registered trademark holder of SAP, SAP R/3, mySAP, ABAP, xApps, NetWeaver, and other proprietary terms.

    The technical information on this site is verified to the greatest extent possible, however, any information found on this site is used at the site visitor's own risk. All the tutorials are collected from various sources, if anyone is having problem with the content, report this to us. We will take action accordingly.

    Easy2learnabap.co.in reserves the right to correct any errors or omissions in any portion of this site at any time without obligation.

    This website is created to teach people about ABAP technology. The Video contents provided in Premium service are completely owned by us and copyrighted.