Create attachment of  a file stored on the app server for mail

Hello All:
I am working on sending a mail with attachemnts (file from the app server), i am aware of numerous solutions posted on the forum ....i am  able to create an attachment and send mail. the problem i am facing is the attachment is corrupted . can some one guide me as what i am ding wrong . here's the code
DATA: REC(80) TYPE C.
    DATA: L_SIZE TYPE DRAO-ORLN.
    DATA: L_LINES TYPE I.
    DATA: L_DATA_TAB TYPE TABLE OF RCGREPFILE.
    DATA: L_DATA_TAB1 TYPE TABLE OF RCGREPFILE.
    DATA: L_DATA_WA TYPE RCGREPFILE.
    DATA: N_FILE TYPE RCGIEDIAL-IEFILE.
    P_FILE = '/usr/sap/MIE/SYS/global/PDFSpools/30978.pdf'.
    N_FILE = P_FILE.
    CONCATENATE 'C:temp' RQ2NAME '.pdf' INTO ELPATH.
*   Read Data from the App server
    OPEN DATASET  P_FILE FOR INPUT IN BINARY MODE .
    DO.
      READ DATASET P_FILE INTO REC.
      IF SY-SUBRC NE 0.
        EXIT.
      ELSE.
        L_ANN = REC.
        APPEND  L_ANN TO T_PDF .
      ENDIF.
    ENDDO.
    CLOSE DATASET P_FILE.
*   How do i get the filesize ?
    CLEAR L_ANN.
    DESCRIBE TABLE T_PDF LINES LIN_TEXT.
    LOOP AT T_PDF INTO L_ANN.
      APPEND L_ANN TO T_ANN.
    ENDLOOP.
*    Using this i get the file size
*    CALL FUNCTION 'C13Z_RAWDATA_READ'
*      EXPORTING
*        I_FILE           = N_FILE
*      IMPORTING
*        E_FILE_SIZE      = L_SIZE
*        E_LINES          = L_LINES
*      TABLES
*        E_RCGREPFILE_TAB = L_DATA_TAB
*      EXCEPTIONS
*        NO_PERMISSION    = 1
*        OPEN_FAILED      = 2
*        OTHERS           = 3.
*    CLEAR L_ANN.
*    DESCRIBE TABLE L_DATA_TAB LINES LIN_TEXT.
*    LOOP AT L_DATA_TAB INTO L_DATA_WA.
*      L_ANN-LINE = L_DATA_WA-ORBLK.
*      APPEND L_ANN TO T_ANN.
*    ENDLOOP.
    DOC_CHNG-OBJ_NAME   = 'URGENT'.
    DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    DOC_CHNG-OBJ_DESCR  = TEXTS.
    DOC_CHNG-SENSITIVTY = 'O'.
*   DOC_CHNG-DOC_SIZE   = LIN_TEXT * 255.
    CLEAR OBJPACK-TRANSF_BIN.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM   = 0.
    OBJPACK-BODY_START = 1.
*   OBJPACK-BODY_NUM   = LIN_TEXT.
    OBJPACK-DOC_TYPE   = 'RAW'.
    APPEND OBJPACK.
    NOMFITXER = ELPATH.
    CALL FUNCTION 'SPLIT_FILENAME'
      EXPORTING
        LONG_FILENAME  = NOMFITXER
      IMPORTING
        PURE_EXTENSION = EXTENSIO.
    OBJPACK-TRANSF_BIN = 'X'.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM   = 1.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM   = LIN_TEXT.
    OBJPACK-DOC_TYPE   = EXTENSIO.
    OBJPACK-OBJ_NAME   = RQ2NAME.
    CONCATENATE RQ2NAME EXTENSIO
      INTO NOMFITXER SEPARATED BY '.'.
    OBJPACK-OBJ_DESCR = NOMFITXER.
    OBJPACK-DOC_SIZE  = L_SIZE * 255.
    APPEND OBJPACK.
    CALL FUNCTION 'BAPI_USER_GET_DETAIL'
      EXPORTING
        USERNAME = SY-UNAME
      TABLES
        RETURN   = BAPIRETUR
        ADDSMTP  = DADESUSER.
    READ TABLE BAPIRETUR WITH KEY TYPE = 'E'.
    IF SY-SUBRC NE 4.
    ELSE.
      READ TABLE DADESUSER INDEX 1.
*     REMITENT = DADESUSER-E_MAIL.
      REMITENT = SY-UNAME.
    ENDIF.
    TEXTS = 'TEST MAIL'.
    APPEND TEXTS.
    DESTINATARIS-RECEIVER   = SY-UNAME.
    DESTINATARIS-REC_TYPE   = 'B'.
    DESTINATARIS-EXPRESS    = 'X'.
*   DESTINATARIS-COM_TYPE   = 'INT'.
*   DESTINATARIS-NOTIF_DEL  = 'X'.
*   DESTINATARIS-NOTIF_NDEL = 'X'.
    APPEND DESTINATARIS.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
         DOCUMENT_DATA                    = DOC_CHNG
         PUT_IN_OUTBOX                    = 'X'
         SENDER_ADDRESS                   = REMITENT
*        SENDER_ADDRESS_TYPE              = 'SMTP'
         COMMIT_WORK                      = ' '
       IMPORTING
         SENT_TO_ALL                      = ENVIAT
*        NEW_OBJECT_ID                    =
*        SENDER_ID                        =
       TABLES
         PACKING_LIST                     = OBJPACK
*        OBJECT_HEADER                    =
         CONTENTS_BIN                     = T_ANN
         CONTENTS_TXT                     = TEXTS
*        CONTENTS_HEX                     =
*        OBJECT_PARA                      =
*        OBJECT_PARB                      =
        RECEIVERS                        = DESTINATARIS
      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.
Message was edited by: Poornanand Mandalika. Code was formatted using the <b>Code</b> button!!

Assuming you are using Apache?
You could place your Word docs in the same folder as your current Apex images directory (or a sub-directory off it) then reference them with a URL of the form http://yourserver/i/sample_word_file.doc. Alternatively you could add a new Alias entry to your dads.conf file (found in your Apache/modplsql/conf directory) to expose the folder on your webserver that contains your Word files via a URL such as http://yourserver/word_docs/
E.g.
Alias /word_docs/ "c:\my_docs\technical_word_docs/"
Andy

Similar Messages

  • How to link an  APEX button to a HTML file stored on the app server ??

    Hopefully this will be simple for someone
    We have some very technical word documents that I really didn't want to replicate in oracle reports
    So i have saved them as html docs , and when i open then in IE they look fine
    I have placed them in the folder where our reports are stored , but I cannot figure out how to create the URL to place behind a button in APEX ??
    Obviously the oracle reports url won't work as the uses pdf's and the servlet
    Thanks in advance
    Chris

    Assuming you are using Apache?
    You could place your Word docs in the same folder as your current Apex images directory (or a sub-directory off it) then reference them with a URL of the form http://yourserver/i/sample_word_file.doc. Alternatively you could add a new Alias entry to your dads.conf file (found in your Apache/modplsql/conf directory) to expose the folder on your webserver that contains your Word files via a URL such as http://yourserver/word_docs/
    E.g.
    Alias /word_docs/ "c:\my_docs\technical_word_docs/"
    Andy

  • Where is the install package stored from the app store for Lion?

    This is an all new way of deploying OS updates from Apple. From what I can see, this presents some issues:
    1. Where is the install package that I bought from the app store, and how can I save that offline?
    2. If there's a problem with my device in the future, I have no media of Lion to restart from- so what's the procedure to restore from a TM backup? Go back to 10.6, and then to the 10.7 update?
    3. What if I want to boot from disc or a drive? I don't have a copy of the install to make a bootable image.
    Thanks for the help

    OK, once you install Lion the Installation Package gets deleted. However once you have installed Lion, do following:
    - Open the AppStore Application
    - With pressed Option (on German Keyboard ALT) Key klick on the "Purchased" Tab!
    - You will now see that the prviously greyed out "Install" key for Lion becomes active
    - Download the install package
    - Do not start installation
    - In order to create a bootable DVD or USB drive containing the installer follow instructions posted on
    http://www.macworld.com/article/161069/2011/07/make_a_bootable_lion_installer.ht ml
    This is how you can create installation media.
    For maintenance options (means your Lion installation has some problems but your drive is still OK)
    you can boot from the hidden recovery partitions that was created when you installed Lion.
    To do so, press the Option (ALT) Key while booting. You will have now the option to boot from
    Lion or recovery partition.
    Hope this helps!

  • Download of files stored in the database

    I am using FireFox and my users IE. Download of files stored in the database worked for me but not for my users. I recieve a choice of downloading the file or opening it with a full file name and file type. IE users have some strange behaviour - no name of the file and they can only save it to their local drive - some kind of weird microsoft security option. I was searching for it but couldn't find. Anyone here who would know where to search for it?
    Denes Kubicek

    Hello Jens,
    I am using the standard procedure from the manual:
    CREATE OR REPLACE PROCEDURE download_my_file_pr (p_file IN NUMBER)
    AS
    v_mime VARCHAR2 (255);
    v_length NUMBER;
    v_file_name VARCHAR2 (2000);
    lob_loc BLOB;
    BEGIN
    SELECT mime_type, blob_content, NAME, DBMS_LOB.getlength (blob_content)
    INTO v_mime, lob_loc, v_file_name, v_length
    FROM my_file_table
    WHERE ID = p_file;
    -- set up HTTP header
    -- use an NVL around the mime type and
    -- if it is a null set it to application/octect
    -- application/octect may launch a download window from windows
    OWA_UTIL.mime_header (NVL (v_mime, 'application/octet'), FALSE);
    -- set the size so the browser knows how much to download
    HTP.p ('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    HTP.p ('Content-Disposition: attachment; filename="' || v_file_name || '"');
    -- close the headers
    OWA_UTIL.http_header_close;
    -- download the BLOB
    wpg_docload.download_file (lob_loc);
    END download_my_file_pr;
    Denes Kubicek

  • Including static html file (WebServer)  with JSP (App server)?

    Hi,
    I want to know how can a static html file that runs on a Web Server (iPlanet) in a JSP that runs on an App Server (WebLogic 6.1).
    What would be the tag used and how the html file is referenced? Is there any other extra settings involved while integrating iPlanet with WebLogic 6.1?
    Responses are highly appreciated.
    Thanks and Regards,
    Madanlal.

    Web servers usually work with the MIME Types. In the mime type settings will determine how a request for a particular mime type is served. Usually HTML, JPG,GIF... are served by the web server itself. A JSP request will be forwarded to the APP Server for peocessing.
    The HTML and the image files need to be in a directory visible to the web server from the document root.
    See the files
    config\mime.types
    config\obj.conf
    under the web server installation directory.
    Refer to the web server's admin guide for more info.

  • 10G Forms-How 2 create link of searched file stored in DB?

    1. I've table named document which stores File_NAME, DOC_SIZE, LAST_UPDATED, etc. info;
    2. I have .doc, .pdf, .txt files stored in the document table;
    3. Using Oracle 10G Form Builder:
    -I've created form in which I can view the columns (NAME, DOC_SIZE, LAST_UPDATED, etc.); and then able to do search for NAME using LOV.
    I want to create a link or button just in front of queried data/record from where I can download that particular file stored in the DB.
    Pl help me out.
    Thanks.
    Gaurav

    Hi ,
    configure the webutil ... then download the webutil demo ....:
    http://www.oracle.com/technology/products/forms/htdocs/webutil/Webutil_demo.zip
    and then adjust your program requirements suitably....!!!!!!!!!!
    Good luck
    Simon

  • How do I open a PDF file stored on the iCloud drive with my iPad?

    How do I open a PDF file stored on the iCloud drive with my iPad?

    This document explains how:
                     Opening PDF Files in Reader for iOS (iPhone and iPad)

  • Best ways to view/display PDF/Excel files stored in the Database

    What are best ways to display/view PDF/Excel files stored in the Database? thanks L

    Thanks tom, sorry let me explain. Currently we have oracle forms screen, using webutil to store/view files into DB. client won't like the interface, they want us to make it more friendly, drag and drop if possible, load multiple files, as possible.. So I am exploring different ways to improve may be java (or jdev/any any other), different screen designs, different features for fileupload/download/view options.

  • Oracle reports to display PDF/Excel files stored in the Database

    can we use Oracle reports to view/display PDF/Excel files stored in the Database? Thanks Lalitha

    A document stored in the database can be easily retrieved in or via the browser using mod_plsql. Simplified:
    select content, mime_type
    into v_blob, v_mime_type
    from ...
    owa_util.mime_header(nvl(v_mimetype,'application/octet'),false);
    htp.p('Content-length: ' || dbms_lob.getlength(v_blob));
    owa_util.http_header_close;
    wpg_docload.download_file(v_blob);So, the link in your report should point to this database procedure.
    Edited by: InoL on Mar 1, 2011 4:17 PM

  • Can I access my files stored in the hard disk connected to airport extreme when I am away? how?

    Can I access my files stored in the hard disk connected to airport extreme when i am away? How?

    You can't technically. iPads cannot directly read HDDs like a computer can. 
    You will need an app liie FileBrowser to do this. Of course all file operations will be done through the App itself.
    https://itunes.apple.com/us/app/filebrowser-access-files-on/id364738545?mt=8

  • Using files stored on remote web server/cdn as content repository

    Hello,
    Is it possible to create a document/asset in WCC that does not have it's physical file stored within the local file system/database but instead is stored in a CDN?
    We want to develop a system whereby files that are stored in a CDN are searchable/viewable/downloadable by users. The file metadata (name, description, mime type, size etc) including the URL for the file within the CDN is known. If we could send the metadata to WCC, is it possible to create the asset such that when the user clicks to view the web-viewable format the CDN URL is used and, likewise, when they click to download the video the file URL for the CDN is used.
    Thanks
    Iain

    With the direction given by SnakeEyez02, I was able to solve my issues. Going to get very detailed here....
    I was somewhat stuck because I couldn't understand that when you create the site locally, how do you get it to work online. When I created the DB locally and had usernames and pwords to access, it worked fine. I thought that I could 'preview' the remote site in dreamweaver, which can be done, but takes a bit of work around (create new DB connection, add your IP to remote access list, etc). So I was stuck trying to 'preview' my site on my machine, which won't happen because the hostname should be 'localhost' even on the remote. This is because the website AND db are running on 'localhost' because my host (Bluehost) runs off 'localhost'. So I could never 'preview' the remote site due to the db running "locally" on the remote.
    With Bluehost, they automatically change a few things:
    Bluehost places certain characters in front of any username and the database. So when I export from local and import to remote, my DB went from "TBO_Golf" on the local to "(Bluehost characters)_TBO_Golf" on the remote.
    The username and pword combo I was using on my local test had to be changed to match my remote credentials. Bluehost limits the amount of characters on usernames and places specific characters in front of any username. So I had to change it from "(Local username)" to "(bluehost inserted characters)_(username)" and matching password. I could have left it and it would have worked, but every time I wanted to update, I would have to change the username/pword combo every time I went from local to remote and vice versa. So I'd rather save myself the headache and just change the local to match.
    So, when I uploaded the site to the remote, the only thing I had to do was update the DB name. I went to the website and 'TA-DA!!!' My dynamic pages now work!
    Thanks so much to SnakeEyez02 and Rob Hecker2 for their help!

  • When filling out a job application, how can you attach a reseme that stored in a app like ifiles or PDF expert?

    When filling out a job application, how can you attach a reseme that stored in a app like ifiles or PDF expert?

    From Safari on iOS (iPad or iPhone) you can't. Teh only files you can upload are image files.
    There are some other browser available, such as iCab Mobile, that include document storage and do permit this. No guarantee it would work on every site however (depends on how the upload field is set up).

  • Error in loading the WSDL file. Check the error log for more details

    Hello,
    I am trying to create a Import Adaptive Webservice Model. I am using the WSDL:
    http://www.abysal.com/soap/AbysalEmail.wsdl
    I am getting the below error when I choose WSDL source as UDDI or file (I am not using any logical destination)
    "Error in loading the WSDL file. Check the error log for more details."
    Where can i see the error log? And what is the solution to fix this?
    I am able to create the model if i save the wsdl locally on my machine and choose Local File System or File as the WSDL source. But at runtime this fails as the application tries to read the WSDL for metadata info and it looks into the application server for this file.
    I also tried creating the old webservice model. And it is able to create the model. But I feel I need to use the new model as this one is deprecated.
    Thanks,
    Sachin

    Hi
    For the logs you can search in this directory
    Goto Window->Show view->Other->PDE Runtim->Error Log
    please try this may it would help you out, try to create a model for you Web Service using Web Service Model (DEPRECATED)
    See this link:
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/ep/integration%2bof%2bweb%2bservices%2b-%2bdifferent%2bscenarios

  • How to deploy a war file from a different app server to the SAP one

    Hello,
    I hve recieved a war file from Tomcat that needs to be deployed on the SAP Java App server. As far as I know the SDM only allows to deploy ear files. How can I deploy this war to the app server?

    Hi Roy,
    in order to deploy the WAR file you have to wrap an EAR around it. I had the same problem.
    You can do this using Netweaver Developer studio.
    Perform the following steps:
    - Start NWDS
    - Create a New Enterprise Application Project
    - Create a New Web Module Project (name it like your war file => e.g. your war file is called myApp.war => call your Web Module myApp)
    - Edit the application.xml of your Enterprise App if necessary (description, Displayname etc.)
    - Link your Web Archive to your application archive (right Mouse click on Application Archive and from the Context Menu choose "Add Modules" => In the list choose your Web Module)
    => You can also perform a right mouse click on your web Module and from the context menu choose "Add to EAR Project" => In the list choose your Enterprise Application!
    - Build Web Archive (right mouse click on your Web Module and from the context menu choose "Build Web Archive" => This will create a war file that has the same name as your war file! => If you do not see it try to switch to resource perspective!)
    - Build Application archive (right mouse click on Application archive => from the context menu choose "Build Application Archive")
    You are done
    The EAR file is generated and will be created in your workspace.
    Now browse to your workspace. Unpack the EAR using WinZip or any other Archiver program.
    Replace the contained war with your war and repack the ear file (You can also use tools like Total Commander to directly replace the war file in the EAR with your war without having to unpack the war). You can also import your war into NWDS and rebuild it so you won't have to replace the WAR in the EAR but as your WAR is already built I would just replace it as described!
    You can now deploy the ear file to SAP J2EE
    Hope this helps (Reward points for helpful answers are appreciated!)
    Cheers

  • Where are the "exercise files" referenced in the video tutorial for After Effects?

    Where are the "exercise files" referenced in the video tutorial for After Effects?  A search yielded no results.

    Creating your first project | Learn After Effects CC | Adobe TV

Maybe you are looking for