Sent file from app. server vie mail

Hi all,
is there any standart program/function module that can be use to sent any file from application server via mail (as attachement), or i have to write it for myself? I have tried to search for it, but without success.
Thank you,
Ondrej Sustacek

Hi Ondrej,
Once I had the same requirement. Please feel free to use my code. I placed it for you in Wiki:
[Sending Application Server file via emial as attachement|https://wiki.sdn.sap.com/wiki/x/UwVqBg]
Small description how it works is included with the code.
Regards
Marcn

Similar Messages

  • Transfer a file from App Server to a FTP site.

    Hi, Abapers.
    I need your help. Probably, this topic has already been posted in a similar way, but we need an answer to solve our problem.
    We have to sent a PDF file from a directory of our app server (AIX) to a FTP directory... which would the FM sequence we should use to goal it?
    Best Regards.

    Hi Santiago,
    create fm to send file from APP server to FTP site.
    if you want to Post file from desktop to Appl use Transaction - CG3Y
    if you want to Post file from Appl to Desktop use Transaction - CG3Z
    copy the code below....
    *  Author: Prabhudas                            Date:  02/21/2006  *
    *  Name: Z_FTP_FILE_TO_SERVER                                          *
    *  Title: FTP File on R/3 Application Server to External Server        *
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(DEST_HOST) TYPE  C
    *"     REFERENCE(DEST_USER) TYPE  C
    *"     REFERENCE(DEST_PASSWORD) TYPE  C
    *"     REFERENCE(DEST_PATH) TYPE  C
    *"     REFERENCE(SOURCE_PATH) TYPE  C
    *"     REFERENCE(FILE) TYPE  C
    *"     REFERENCE(BINARY) TYPE  CHAR1 OPTIONAL
    *"     REFERENCE(REMOVE_FILE) TYPE  CHAR1 OPTIONAL
    *"  TABLES
    *"      FTP_SESSION STRUCTURE  ZMSG_TEXT OPTIONAL
    *"  EXCEPTIONS
    *"      CANNOT_CONNECT
    *"      SOURCE_PATH_UNKNOWN
    *"      DEST_PATH_UNKNOWN
    *"      TRANSFER_FAILED
    *"      COMMAND_FAILED
      DATA: w_password     TYPE zftppassword,
            w_length       TYPE i,
            w_key          TYPE i                  VALUE 26101957,
            w_handle       TYPE i,
            w_command(500) TYPE c.
      REFRESH ftp_session.
    * Scramble password (new Unicode-compliant routine)
      w_length = STRLEN( dest_password ).
      CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = dest_password
          sourcelen   = w_length
          key         = w_key
        IMPORTING
          destination = w_password.
    * Connect to FTP destination (DEST_HOST)
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          user            = dest_user
          password        = w_password
          host            = dest_host
          rfc_destination = 'SAPFTPA'
        IMPORTING
          handle          = w_handle
        EXCEPTIONS
          not_connected   = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
          RAISING cannot_connect.
      ENDIF.
    * Optionally, specify binary file transfer
      IF binary = 'X'.
        w_command = 'bin'.
        CALL FUNCTION 'FTP_COMMAND'
          EXPORTING
            handle        = w_handle
            command       = w_command
          TABLES
            data          = ftp_session
          EXCEPTIONS
            command_error = 1
            tcpip_error   = 2.
        IF sy-subrc <> 0.
          CONCATENATE 'FTP command failed:' w_command
            INTO w_command SEPARATED BY space.
          MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
              WITH w_command
              RAISING command_failed.
        ENDIF.
      ENDIF.
    * Navigate to source directory
      CONCATENATE 'lcd' source_path INTO w_command SEPARATED BY space.
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          handle        = w_handle
          command       = w_command
        TABLES
          data          = ftp_session
        EXCEPTIONS
          command_error = 1
          tcpip_error   = 2.
      IF sy-subrc <> 0.
        CONCATENATE 'FTP command failed:' w_command
          INTO w_command SEPARATED BY space.
        MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
            WITH w_command
            RAISING source_path_unknown.
      ENDIF.
    * Navigate to destination directory
      CONCATENATE 'cd' dest_path INTO w_command SEPARATED BY space.
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          handle        = w_handle
          command       = w_command
        TABLES
          data          = ftp_session
        EXCEPTIONS
          command_error = 1
          tcpip_error   = 2.
      IF sy-subrc <> 0.
        CONCATENATE 'FTP command failed:' w_command
          INTO w_command SEPARATED BY space.
        MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
            WITH w_command
            RAISING dest_path_unknown.
      ENDIF.
    * Transfer file
      CONCATENATE 'put' file INTO w_command SEPARATED BY space.
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          handle        = w_handle
          command       = w_command
        TABLES
          data          = ftp_session
        EXCEPTIONS
          command_error = 1
          tcpip_error   = 2.
      IF sy-subrc <> 0.
        CONCATENATE 'FTP command failed:' w_command
          INTO w_command SEPARATED BY space.
        MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
            WITH w_command
            RAISING transfer_failed.
      ENDIF.
    * Disconnect from destination host
      CALL FUNCTION 'FTP_DISCONNECT'
        EXPORTING
          handle = w_handle.
    * Optionally, remove file from source directory
      IF remove_file = 'X'.
       CONCATENATE source_path '/' file INTO w_command.
      CONCATENATE 'rm' w_command INTO w_command SEPARATED BY space.
       OPEN DATASET '/dev/null' FOR OUTPUT FILTER w_command.
       CLOSE DATASET '/dev/null'.
    ENDIF.
    Regards,
    Prabhudas

  • System exception while deleting the file from app server in background job

    Hi All,
    I have a issue while the deleting the file from application server.
    I am using the statement DELETE DATASET in my program to delete the file from app server.
    I am able to delete the file from the app server when i run the program from app server.
    When i run the same report from background job i am getting the message called System exception.
    Is there any secuirity which i need to get the issue.
    Thank You,
    Taragini

    Hi All,
    I get all the authorization sto delete the file from application serever.
    Thing is i am able to run the program sucessfully in foreground but not in the background .
    It i snot giving any short dump also just JOB is cancelled with the exception 'Job cancelled after system exception ERROR_MESSAGE'.
    Can anybody please give me suggestion
    Thanks,
    Taragini

  • Problem in downloading file from app server using CG3Y in to .XLS fomat

    hi All,
    I have uploaded file in to application server through a program using open data set with the separater as "|" ( pipe ) . Now the user should be able to download the file from apps server to presenataion server in .XLS format using txn CG3Y. but when we download, the format appears wierd and the data is not consistent across columns in excel. i.e the data which is supposed to be in one column in the excel is in the other column. what precautaions should i take  before moving data to apps server so that it will be downloaded in a good format.
    Appreciate your help...
    Regards,
    Sreekanth.

    Separate each values with TAB space present in the application server .
    Currently u r using | pipe character. Instead of that use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB as delimiter.
    Each value will displayed in separate cells in excel sheet when u download it frm app.server
    Regards,
    Lakshman.

  • Download PDF file from APP server!

    Hi!
    Has anyone tried uplaoding and downloding a PDF table from app server as I tried from a normal method by Open dataset, Transfer but it wont work.
    Please provide any inputs.
    Thanks.

    Hi park,
    1. Using open data set, transfer , close etc,
       also it will work.
       ( it will download / upload any kind of file from app server)
    2. Just make sure the
       FULL PATHNAME and the FILENAME
       are mentioned in EXACT CASE
      (small/CAPITAL).
    3. U can check thru transaction AL11, to see the file and path.
    regards,
    amit m.

  • Problem with READ DATASET when reading file from app server

    Hi,
    wondering if anyone can help, I'm using the following code to read from a file on app server, the file is of type .rtf
    OPEN DATASET file_rtf FOR INPUT IN TEXT MODE
                                 ENCODING DEFAULT
                                 WITH SMART LINEFEED.
    DO.
    READ DATASET file_rtf INTO string.
    IF SY-SUBRC = 0.
    EXIT.
    ENDIF.
    ENDDO.
    the open dataset part works sy-subrc = 0, but the read returns sy-subrc = 8 and no data is passed to string.
    Any ideas as to what is causing this problem appreciated, <removed>
    Thanks
    Edited by: Thomas Zloch on Mar 17, 2010 3:57 PM - please don't offer p...

    Hi Adam,
    The source code in the below link has details about how to read/write to application server.
    [Application server file operartions|http://www.divulgesap.com/blog.php?p=NDk=]
    Please let us know if you have any issues.
    Regards,
    Ravi

  • Issue with uploading flat file from App Server

    Hi,
    Im loading a flat file to an ODS.
    When I try to load in from my Local Workstation, it works fine.
    All data is loaded green.
    However, when I try to load the file after i copied it to my App Server, it cannot load.
    The error is get is:
    Error 2 while splitting CSV data: see long text
    Message no. RSDS_ACCESS011
    Diagnosis
    Error 2 occurred while splitting the CSV data string.
    1 = Could not find a closing escape character
    2 = Invalid escape character
    3 = Conversion error
    4 = OTHERS
    The thing is that it worked fine (exact same file no changes) when I loaded from my Desktop.
    Appreciate any help or input.
    Rgds,
    Gary.

    Gary,
    You can load it from the App server. Just check the file name whther you are giving it correctly and also check the readio button from App Server.
    Go to AL11 (Tcode) and cross check whther your file is there. See in which directory your file is there. Mention the same path in the extraction tab in IP.
    Thanks...
    Shambhu

  • How to fetch file from app. server without complete filename?

    Hi,
    In my report I have to read data from txt file on application server.
    My file name on App. server conatain system id and date and time stam.
    my file path :- /User/IDD/S10009112007101525
    here,'User'  is dirctory
            'IDD' is folder in directory
            'S100' is system id
             '09112007' is date
             '101525'  is time in hour,miniute,second format.
    From my program I can only pass directory , Folder name,System Id,Date only. I don't have time value in my program.
    So please tell me how to fetch files without having time stamp value from app. server.
    Plz send me exact code.It's urgent.
    Message was edited by:
            Manisha Kadam
    Title was edited by:
            Alvaro Tejada Galindo

    Do you want to return the file to the user on click of button or something?
    Then, use web_show_document with http link which you are speaking about.
    Else download the file to client using Webutil.

  • Load Flat File from App Server

    HI, all.
    I want load flat file from appliation server. I created CSV file and loaded it on app. server with FM ARCHIVEFILE_CLIENT_TO_SERVER. After I created datasource and tried load data in the infocube. In this procedure I encountered with two problem
    1. When I look file in AL11, I doesn't see cyrillic symbols, instead this symbols I see #.
    2. When I try load data with data source, I get exception RS_EXCEPTION 000 "File don't open"
    Anybody can help me resolve this problem?
    wbr, Fanil.

    Hi, kodanda pani KV.
    2. File is was closed.
    1. Can me you clearly explain what you meen?
    wbr, Fanil

  • Delete file from app server

    hi, i am running a background job in bw and for that created a file on the application server.now how do i delete that file.to create the file i just gave the name in the bw and the file got created.i am not able to find how to delete it.
    or
    rather than deleting the file how can we delete the data it is containing.please do let me know

    hi,
    but using DELETE DATASET u can remove file for app server.
    If u want to delete the data alone then give the same name without data it will overwrite.
    U can check it in AL11.
    regards
    md zubair sha
    U can also use the function module - EPS_DELETE_FILE
    Message was edited by:
            md zubair sha

  • Validate the file from app. server before uploading

    Hi All,
    I am trying to upload the data from application server into an internal table.
    My requirement is I need to validate the data before I upload the data into internal table.(i.e I open the file from application server using FM Open_Dataset.Now before I upload the data into an internal table,I need to first validate each record in the file).I have some 7-8 lakhs of records in the file.
    Any input for the above requirement would be of great help
    Regards,
    nsp.

    hi Nsp,
      I guess validation of data will be only possible after uploading the data in to an internal table ...
    Regards,
    Santosh

  • Reading uploaded file from app. server

    Hi All,
    I am trying to upload a .csv format file to app. server thru txn CG3Z....
    When i try to open the file in my code thru open dataset and read dataset ...it is giving it in the form of 
    30002058,1000#50055501,2000#
    Now i want it to be in
    30002058,1000
               50055501,2000
    format...
    pleas suggest..
    thnx
    Rk

    Hi Rahul,
    have you tried reading it in BINary format?
    Kind regards,
    Alvaro

  • Move file from App server to same server on different path

    Hi All,
    I have to move a file from Application server to a folder in the same server....
    pls tell me how can i do this....
    its very urgent....
    Thanks...............

    Hi
    First you read the file in output mode using Open dataset and Read dataset statement with the initial application server path.
    Then write this data back to another file path by opening the file in Input mode and using Transfer statement.
    Example.
    open dataset <file1> mode output encding default.
    if sy-subrc = 0.
    do.
    read dataset <file1> into wa_itab.
    if sy-subrc = 0.
    append wa_itab to itab.
    else.
    exit.
    endif.
    enddo.
    open dataset <file2> mode input encding default.
    if sy-subrc = 0.
    loop at itab into wa_itab.
    transfer wa_itab to <file2>.
    endloop.
    endif.
    ~ Ranganath
    PS : Reward points for all useful answers !

  • Webutil download file from app server

    i am calling a report from forms. report uses text_io to write delimited data to app server disk. report info also displays in browser using web.show_document. when i call report from forms i run report, use web.show_document to display in browser and then call webutil to download file to client form appserver. sequence would be in a manner as below:
    run_report_object (report_id);
    when report = finished then
    web.show_document;
    end if;
    webutil.download_file (filename);
    the problem is this: the web.show_document code runs but while this is running the webutil code also is running. but the report has not completed yet so when webutil runs looking for the file the report is supposed to write it cannot find it since the report has not completed. web.show_document fires off a browser session and then immediately runs the webutil code. but i dont want the webutil code to run until the report has successfully completed. does anyone know how to integrate these two functions into one step instead of running the report and allowing it to complete and then executing a separate step to download the file.
    thank you

    You might want to try this code snippet....
    --- code to set parameters, declare variables etc...
    l_report_return := run_report_object(l_report_id);
    l_report_status := report_object_status(l_report_return);
    WHILE l_report_status in ('RUNNING','OPENING_REPORT','ENQUEUED') LOOP
         l_report_status := report_object_status(l_report_return);
    END LOOP;
    IF l_report_status = 'FINISHED' THEN
         /*Display report in the browser*/
         web.show_document(......);
    ELSE
         message('Error when running report ');
    END IF;

  • Downloading a file from App Server to User's Desktop

    Hi All,
    I know that there are many threads on file upload and download :-)
    I have tried to browse through most of them and could not find my solution.
    The requirement is to place a file in the unix app server directory and allow the user to download it using a link, to the user's desktop. In case you think that this has already been answered in an old thread, kindly give me the pointer. Any sample code for doing this, would be great.
    I know how to upload a file from desktop to table/app server. I know how to download a file from a BLOB column in database.
    Thanks,
    Amit

    You would not be able to use file upload or download beans, as they interact with the database and not the filesystem.
    You would need to write a simple file reader routing in plain java.
    Tapash

Maybe you are looking for