File to Mail with report format

Hi
I have a requirement in which I have to send the email to the user and all the information should be present in the email content no attachment.
I have to pick the xml file for the FTP location and then send the email to the user in the specific format which is mention below.
FTP.........................XI..........................MAIL (No Attachment)
Example
abc.xml
Output must be in this format
Original File name.             Original Creation date and time     Customer ID     File level Ack  Name     File level Ack 
xxxxxxx                                     xxxxxxxxx                                xxxxxx               xxxxx                    xxx     
xxxxxxx                                     xxxxxxxxx                                xxxxxx               xxxxx                    xxx     
xxxxxxx                                     xxxxxxxxx                                xxxxxx               xxxxx                    xxx     
Creation date and time     Total number of trasnsactions     Status code      Error Description
xxxxxxxxx                            xxxxxx                                         xxxxx          SYNTAX ERROR
xxxxxxxxx                            xxxxxx                                         xxxxx          SYNTAX ERROR
xxxxxxxxx                            xxxxxx                                         xxxxx          SYNTAX ERROR
Can somebody please tell me how to generate the output like that. I am concatenating all the fields but I have to do too many padding to generate the output like that which I think is not the correct way to generate the output.
Is there any way to generate the required output with UDF or any other way except concat.
Is there any way I can convert the output in Excel or Word file.
Thanks,

Hi Kumar,
Could you please tell me the complete UDF
My Requirement is to generate the output in 1 or multi line along with the heading.
Original File name.      Original Creation date and time     Customer ID     File level Ack Name     File level Ack
Where ....... represent the values.

Similar Messages

  • How to send the form data through mail with pdf format?

    forms 6i
    Hi to all,
    i am developed one master detail form.example is based on the dept number emp details will be displayed.here my requirment is whatever displayed on the form
    the data ,these data send to mail with any format.is it possible? if is possible any one give a proper solution.
    Regards,
    Stevie
    Edited by: 994418 on 6 May, 2013 11:15 PM

    Hello,
    you can create a Report that accepts the search parameters from the Forms mask and generates a PDF. You also have the option to send the report via mail.
    Personally I would generate the report with a tool like as_pdf
    http://technology.amis.nl/2012/04/11/generating-a-pdf-document-with-some-plsql-as_pdf_mini-as_pdf3/
    Then you can send the mail using utl_mail or utl_smtp.
    www.google.com/search?q=site:forums.oracle.com+utl_mail+utl_smtp
    Regards
    Marcus

  • File to Mail with content as excel attachment

    Hi there,
    Can somebody please guide me in achieving this goal.
    I have a requirement in which I have to send the email content as an excel attachment which is very new to me.
    Requirement
    File.............XI............Mail
    Sender File: xyz.xml
    Mapped with standard mail.xsd and concat all the requested filed to the content but now the requirement is changed and I need to send the content as an excel attachment.
    I don't know JAVA & ABAP and this is the first time I am using mail adapter.
    Can somebody please guide me how to achieve this.
    In Another interface I have to send the source file name as a mail attachment, By Default mail adapter send the filename as untitled.
    Is there easy way to changed the name of the attachment to the source file name.
    File ............... XI.........Mail.
    Source file: xyz.xml
    No mapping required just send the file to the mail adapter but condition is that the file name should be the same.
    Mail (Attachment: xyz.xml)
    Please can somebody suggest me how to achieve this.
    Thanks,

    Hi,
    Please refer the blogs given which help you a lot regarding your requirement.
    /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    /people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible
    /people/sap.user72/blog/2005/07/04/read-excel-instead-of-xml-through-fileadapter
    /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    /people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems

  • Attach file to mail with "unusual" characters

    Hi
    I have made a procedure that can send mail with attached file/files. But when I attach a text file that contains characters like (Å, Ä or Ö) these characters gets like (A, A and ?) when I recieve the mail to my mail client. When I look at the file on the disk before I attach it the characters is OK but when I attach the file and mails it the characters get replaced. So why does the charaters get messed up when I attach the file to a mail??
    My procedure looks like this:
    procedure mail_files(from_name varchar2,
    to_name varchar2,
    subject varchar2,
    message varchar2,
    max_size number default 9999999999,
    filename1 varchar2 default null,
    filename2 varchar2 default null,
    filename3 varchar2 default null,
    debug number default 0) is
    mottagare VARCHAR2(2048) := to_name;
    v_smtp_server varchar2(32) := 'mail.telia.se';
    v_smtp_server_port number := 25;
    v_directory_name varchar2(100);
    v_file_name varchar2(100);
    v_line varchar2(1000);
    crlf varchar2(2) := chr(13) || chr(10);
    mesg varchar2(32767);
    conn UTL_SMTP.CONNECTION;
    type varchar2_table is table of varchar2(200) index by binary_integer;
    file_array varchar2_table;
    i binary_integer;
    v_file_handle utl_file.file_type;
    v_slash_pos number;
    mesg_len number;
    mesg_too_long exception;
    invalid_path exception;
    mesg_length_exceeded boolean := false;
    begin
    -- first load the three filenames into an array for easier handling later ...
    file_array(1) := filename1;
    file_array(2) := filename2;
    file_array(3) := filename3;
    -- Open the SMTP connection ...
    conn := utl_smtp.open_connection(v_smtp_server, v_smtp_server_port);
    -- Initial handshaking ...
    utl_smtp.helo(conn, v_smtp_server);
    utl_smtp.mail(conn, from_name);
    WHILE (mottagare IS NOT NULL) LOOP
    utl_smtp.rcpt(conn, get_element(mottagare));
    END LOOP;
    --utl_smtp.rcpt( conn, to_name );
    utl_smtp.open_data(conn);
    -- build the start of the mail message ...
    mesg := 'Date: ' || TO_CHAR(SYSDATE, 'dd Mon yy hh24:mi:ss') || crlf ||
    'From: ' || from_name || crlf || 'Subject: ' || subject || crlf ||
    'To: ' || to_name || crlf || 'Mime-Version: 1.0' || crlf ||
    'Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"' || crlf || '' || crlf ||
    'This is a Mime message, which your current mail reader may not' || crlf ||
    'understand. Parts of the message will appear as text. If the remainder' || crlf ||
    'appears as random characters in the message body, instead of as' || crlf ||
    'attachments, then you''ll have to extract these parts and decode them' || crlf ||
    'manually.' || crlf || '' || crlf ||
    '--DMW.Boundary.605592468' || crlf ||
    'Content-Type: text/html; charset=8859-1' || crlf ||
    'Content-Disposition: inline;' || crlf ||
    'Content-Transfer-Encoding: 8bit' || crlf || '' || crlf ||
    message || crlf;
    mesg_len := length(mesg);
    if mesg_len > max_size then
    mesg_length_exceeded := true;
    end if;
    utl_smtp.write_data(conn, mesg);
    --utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(mesg));
    -- Append the files ...
    for i in 1 .. 3 loop
    -- Exit if message length already exceeded ...
    exit when mesg_length_exceeded;
    -- If the filename has been supplied ...
    if file_array(i) is not null then
    begin
    -- locate the final '/' or '\' in the pathname ...
    v_slash_pos := instr(file_array(i), '/', -1);
    if v_slash_pos = 0 then
    v_slash_pos := instr(file_array(i), '\', -1);
    end if;
    -- separate the filename from the directory name ...
    v_directory_name := substr(file_array(i), 1, v_slash_pos - 1);
    v_file_name := substr(file_array(i), v_slash_pos + 1);
    -- open the file ...
    v_file_handle := utl_file.fopen(v_directory_name, v_file_name, 'r');
    -- generate the MIME boundary line ...
    mesg := crlf || '--DMW.Boundary.605592468' || crlf ||
    'Content-Type: application/octet-stream; name="' ||
    v_file_name || '"' || crlf ||
    'Content-Disposition: attachment; filename="' ||
    v_file_name || '"' || crlf ||
    'Content-Transfer-Encoding: 8bit' || crlf || crlf;
    mesg_len := mesg_len + length(mesg);
    utl_smtp.write_data(conn, mesg);
    -- and append the file contents to the end of the message ...
    loop
    utl_file.get_line(v_file_handle, v_line);
    if mesg_len + length(v_line) > max_size then
    mesg := '*** truncated ***' || crlf;
    utl_smtp.write_data(conn, mesg);
    mesg_length_exceeded := true;
    raise mesg_too_long;
    end if;
    mesg := v_line || crlf;
    utl_smtp.write_data(conn, mesg);
    mesg_len := mesg_len + length(mesg);
    end loop;
    exception
    when utl_file.invalid_path then
    -- All other exceptions are ignored ....
    when others then
    null;
    end;
    mesg := crlf;
    utl_smtp.write_data(conn, mesg);
    -- close the file ...
    utl_file.fclose(v_file_handle);
    end if;
    end loop;
    -- append the final boundary line ...
    mesg := crlf || '--DMW.Boundary.605592468--' || crlf;
    utl_smtp.write_data(conn, mesg);
    -- and close the SMTP connection ...
    utl_smtp.close_data(conn);
    utl_smtp.quit(conn);
    end;
    Any help is highly appreciated.
    Regards
    Nils

    Hi Madhu,
         Using the default modules PayloadSwapBean and MessageTransformBean you can able to send multiple attachments.
    swap.keyName  :payload-name or payload-description or content-type, content-description. swap.keyValue: If you have  a multiple attachments then give the multiple key value.
    Like you have payload name
      Attachment1, Attachment2 then
    swap.keyName  payload-name
    swap.keyValue  Attachment1, Attachment2
    Using the MessageTransformBean you can able to change the file name.
    PayloadSwapBean:
    [http://help.sap.com/saphelp_nw70/helpdata/EN/2e/bf37423cf7ab04e10000000a1550b0/content.htm]
    MessageTransformBean:
    [http://help.sap.com/saphelp_nw70/helpdata/EN/57/0b2c4142aef623e10000000a155106/content.htm]
    Regards,
    Prakasu

  • Convert Script output data to Text(.txt) file & send mail with attachment.

    Hi All,
    Requirement: I shulb be able to conver th Script output data to Text(.text) file & send a maill with attachment with this text file. Formant of text file should be like output of Print priview.
    Plese sugget with Function modules to cover as Text file.
    I am able to converting the Script output data to PDF and sending mail with attachment. So I don't want PDF file now.
    Thanks in advance.

    Hi, Thanks for responst.
    We can convert the Scirpt output to PDF file by using OTF function module and the PDF file looks like Print Privew output.
    Same like this I want Script out in NOTEPAD (.txt). Is that possible, Plz sugget with relavent Function Modules.
    Thanks.

  • File to Mail with XML Attachment

    Hi Ravi,
    Just have look into the configuration of sender file adapter configuration.
    The sender file adapter is configured to pick the normal payload, which is specified in the File access parameters, and the additional image file  that is to be sent as an attachment is configured under the Additional File(s).The file type would still remain binary.
    Also check out the Module c onfiguration if you did it correctly and check out the transform.ContentType values inside.
    Hope this will help you.
    Regards
    Aashish Sinha

    Hi Shabarish,
    In the module tab i have specified the below beans
    localejbs/AF_Modules/MessageTransformBean                           contentType
    AF_Modules/PayloadZipBean                                                    zip
    sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean           mail
    In the module configuration i mentioned as
    Transform.ContentDescription   file
    Transform.ContentDisposition   attachment:filename="file.xml"
    zip.filenameKey                      contentType
    zip.mode                                zipOne
    Now i am getting the mail with zip file as an attachment.But the name of the attachment i got is MainDocument.zip
    Even the file name inside the zip is MainDocument.xml.
    How can i specify my own file name for both zip file and the file inside the archieve folder.Please help me.
    Regards
    Divia

  • Convert Screen(spool) to PDF file sending mail with attach file

    Hi :
    I'd like convert spool list to pdf and sending file...
    so, I read thread about spool convert to PDF before,
    and know how to convert Spool to PDF file and send mail with attach file.
    but I have a problem.
    my solution as:
    step 1. Call function: "CONVERT_ABAPSPOOLJOB_2_PDF"
    step 2. Call function: "SO_NEW_DOCUMENT_ATT_SEND_API1"
    then, I got a mail with attached PDF file, but the PDF file display limited 255 line.( SO_NEW_DOCUMENT_ATT_SEND_API1 limited)
    I want to showing word is wider that 255.
    and then I find a manual method as:
    After program finished.
    Function Menu -> system -> List -> Send
    use Prog: "Create Document and Send"
    I use this prog sending mail and attached file ,
    PDF file do <b>NOT</b> have 255 word limit !
    finally. my question is, If I want sending mail as Prog: "Create Document and Send", how to do?
    which Function I have to use?...
    Please help me, Thanks!

    Hi,
    Check this sample code of sending spool as attachment to an email address..
    Parameters.
    PARAMETERS: p_email(50) LOWER CASE.
    PARAMETERS: p_spool LIKE tsp01-rqident.
    Data declarations.
    DATA: plist         LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: document_data LIKE sodocchgi1.
    DATA: so_ali        LIKE soli OCCURS 100 WITH HEADER LINE.
    DATA: real_type     LIKE soodk-objtp.
    DATA: sp_lang       LIKE tst01-dlang.
    DATA: line_size     TYPE i VALUE 255.
    DATA: v_name        LIKE soextreci1-receiver.
    DATA rec_tab        LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    Get the spool data.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
         EXPORTING
              rqident              = p_spool
              first_line           = 1
              last_line            = 0
              desired_type         = '   '
         IMPORTING
              real_type            = real_type
              sp_lang              = sp_lang
         TABLES
              buffer               = so_ali
         EXCEPTIONS
              no_such_job          = 1
              job_contains_no_data = 2
              selection_empty      = 3
              no_permission        = 4
              can_not_access       = 5
              read_error           = 6
              type_no_match        = 7
              OTHERS               = 8.
    IF sy-subrc <> 0.
      MESSAGE s208(00) WITH 'Error'.
      LEAVE LIST-PROCESSING.
    ENDIF.
    Prepare the data.
    plist-transf_bin = 'X'.
    plist-head_start = 0.
    plist-head_num = 0.
    plist-body_start = 0.
    plist-body_num = 0.
    plist-doc_type = 'RAW'.
    plist-obj_descr = 'Test ALV'.
    APPEND plist.
    plist-transf_bin = 'X'.
    plist-head_start = 0.
    plist-head_num = 0.
    plist-body_start = 1.
    DESCRIBE TABLE so_ali LINES plist-body_num.
    plist-doc_type = real_type.
    Get the size.
    READ TABLE so_ali INDEX plist-body_num.
    plist-doc_size = ( plist-body_num - 1 ) * line_size
                     + STRLEN( so_ali ).
    APPEND plist.
    Move the receiver address.
    MOVE: p_email  TO rec_tab-receiver,
          'U'      TO rec_tab-rec_type.
    APPEND rec_tab.
    IF NOT sp_lang IS INITIAL.
      document_data-obj_langu = sp_lang.
    ELSE.
      document_data-obj_langu = sy-langu.
    ENDIF.
    v_name = sy-uname.
    Send the email.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
         EXPORTING
              document_data              = document_data
              sender_address             = v_name
              sender_address_type        = 'B'
         TABLES
              packing_list               = plist
              contents_bin               = so_ali
              receivers                  = rec_tab
         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.
    IF sy-subrc <> 0.
      MESSAGE e208(00) WITH 'Error'.
    ENDIF.
    COMMIT WORK.
    Send the email immediately.
    SUBMIT rsconn01
    WITH mode = 'INT'
    AND RETURN.
    Thanks,
    Naren

  • File to Mail with multiple attachments

    Hi All,
    I am doing file to mail scenario in which iam including attachments.
    I am able to send one attachment(i.e., .txt) from file to mail.
    My requirement is i need to send both .txt and .xls .Please let me know the procedure for sending multiple attachments(probabaly without any abap coding or .jar files usage).
    regards
    Madhu

    Hi Madhu,
         Using the default modules PayloadSwapBean and MessageTransformBean you can able to send multiple attachments.
    swap.keyName  :payload-name or payload-description or content-type, content-description. swap.keyValue: If you have  a multiple attachments then give the multiple key value.
    Like you have payload name
      Attachment1, Attachment2 then
    swap.keyName  payload-name
    swap.keyValue  Attachment1, Attachment2
    Using the MessageTransformBean you can able to change the file name.
    PayloadSwapBean:
    [http://help.sap.com/saphelp_nw70/helpdata/EN/2e/bf37423cf7ab04e10000000a1550b0/content.htm]
    MessageTransformBean:
    [http://help.sap.com/saphelp_nw70/helpdata/EN/57/0b2c4142aef623e10000000a155106/content.htm]
    Regards,
    Prakasu

  • File to Mail with body content and attachment

    Hi Experts,
    Here my scenario;
    I receive an xml file, this xml file content need to be mapped to body of the eMail as well formatted email. and also the original xml file which I receive need to be sent as attachment.
    I searched in sdn, help and checked many blogs..
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    If I want to send email with message in body then I need to select message protocol XIPAYLOAD and use mail package, but Iam not able to send the original file as attachment.
    How could I achieve both??
    please help.
    If not clear please let me know, I will explain in detail.
    rgds
    skr

    Hi SKR,
    Check the below blogs, this will throw some light on your issue.
    /people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
    /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    /people/michal.krawczyk2/blog/2006/02/23/xi-dynamic-name-in-the-mail-attachment--pseudo-variable-substitution
    Thanks,

  • Sending E-mail with Excel format

    HI all,
    I am sending an Email with Excel as attached,the internal table(l_t_objbin) for e-mail content is 225(char) but my records contains more than 255 chars, so i am splitting the record into < 255 char(240) and concadinating as given below...
    INTO l_t_objbin SEPARATED BY con_tab .
        CONCATENATE l_t_objbin con_tab  INTO l_t_objbin .
        APPEND l_t_objbin.
    after doing the above i am getting whole record inot single but the issues is the file in which i am concodinating gets Expanded some extra length ,, i need to Tirm those spaces,,i have tried to use condense but it is not working..please anybody have idea.plz let me know..thx

    Hi palani,
    1. There is some trick involved
    in the binary files.
    2. I have made a program (and it works fantastic)
    ONLY 6 LINES FOR EMAILING
    BELIEVE ME
    ITS A FANTASTIC PROGRAM.
    IT WILL WORK LIKE OUTLOOK EXPRESS !
    3. The user is provided with
    a) file name
    b) email address to send mail
    and it sends ANY FILE (.xls,.pdf .xyz..)
    Instantaneously !
    4. Make two things first :
    1. Include with the name : ZAMI_INCLFOR_MAIL
    2. Report with the name : ZAM_TEMP147 (any name will do)
    3. Activate both and execute (2)
    4. After providing filename, email adress
    5. Code for Include :
    10.08.2005 Amit M - Created
    Include For Mail (First Req F16)
    Modification Log
    Data
    DATA: docdata LIKE sodocchgi1,
    objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
    objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objhex LIKE solix OCCURS 10 WITH HEADER LINE,
    reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    DATA: tab_lines TYPE i,
    doc_size TYPE i,
    att_type LIKE soodk-objtp.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    FORM
    FORM ml_customize USING objname objdesc.
    Clear Variables
    CLEAR docdata.
    REFRESH objpack.
    CLEAR objpack.
    REFRESH objhead.
    REFRESH objtxt.
    CLEAR objtxt.
    REFRESH objbin.
    CLEAR objbin.
    REFRESH objhex.
    CLEAR objhex.
    REFRESH reclist.
    CLEAR reclist.
    REFRESH listobject.
    CLEAR listobject.
    CLEAR tab_lines.
    CLEAR doc_size.
    CLEAR att_type.
    Set Variables
    docdata-obj_name = objname.
    docdata-obj_descr = objdesc.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addrecp USING preceiver prec_type.
    CLEAR reclist.
    reclist-receiver = preceiver.
    reclist-rec_type = prec_type.
    APPEND reclist.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addtxt USING ptxt.
    CLEAR objtxt.
    objtxt = ptxt.
    APPEND objtxt.
    ENDFORM. "ml_customize
    FORM
    FORM ml_prepare USING bypassmemory whatatt_type whatname.
    IF bypassmemory = ''.
    Fetch List From Memory
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = listobject
    EXCEPTIONS
    OTHERS = 1.
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'LIST_FROM_MEMORY'.
    ENDIF.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    COMPRESSED_SIZE =
    TABLES
    in = listobject
    out = objbin
    EXCEPTIONS
    OTHERS = 1
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ENDIF.
    Header Data
    Already Done Thru FM
    Main Text
    Already Done Thru FM
    Packing Info For Text Data
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'TXT'.
    APPEND objpack.
    Packing Info Attachment
    att_type = whatatt_type..
    DESCRIBE TABLE objbin LINES tab_lines.
    READ TABLE objbin INDEX tab_lines.
    objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = att_type.
    objpack-obj_name = 'ATTACHMENT'.
    objpack-obj_descr = whatname.
    APPEND objpack.
    Receiver List
    Already done thru fm
    ENDFORM. "ml_prepare
    FORM
    FORM ml_dosend.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = docdata
    put_in_outbox = 'X'
    commit_work = 'X' "used from rel. 6.10
    IMPORTING
    SENT_TO_ALL =
    NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    CONTENTS_HEX = objhex
    OBJECT_PARA =
    object_parb =
    receivers = reclist
    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
    IF sy-subrc <> 0.
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH docdata-obj_name.
    ENDIF.
    ENDFORM. "ml_customize
    FORM
    FORM ml_spooltopdf USING whatspoolid.
    DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    Call Function
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = whatspoolid
    TABLES
    pdf = pdf
    EXCEPTIONS
    err_no_otf_spooljob = 1
    OTHERS = 12.
    Convert
    PERFORM doconv TABLES pdf objbin.
    ENDFORM. "ml_spooltopdf
    FORM
    FORM doconv TABLES
    mypdf STRUCTURE tline
    outbin STRUCTURE solisti1.
    Data
    DATA : pos TYPE i.
    DATA : len TYPE i.
    Loop And Put Data
    LOOP AT mypdf.
    pos = 255 - len.
    IF pos > 134. "length of pdf_table
    pos = 134.
    ENDIF.
    outbin+len = mypdf(pos).
    len = len + pos.
    IF len = 255. "length of out (contents_bin)
    APPEND outbin.
    CLEAR: outbin, len.
    IF pos < 134.
    outbin = mypdf+pos.
    len = 134 - pos.
    ENDIF.
    ENDIF.
    ENDLOOP.
    IF len > 0.
    APPEND outbin.
    ENDIF.
    ENDFORM. "doconv
    CODE FOR PROGRAM
    5.
    REPORT zam_temp147 .
    INCLUDE zami_inclfor_mail.
    DATA
    DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : file_name TYPE string.
    data : path like PCFILE-PATH.
    data : extension(5) type c.
    data : name(100) type c.
    SELECTION SCREEN
    PARAMETERS : receiver TYPE somlreci1-receiver lower case.
    PARAMETERS : p_file LIKE rlgrap-filename
    OBLIGATORY.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CLEAR p_file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM ml_customize USING 'Tst' 'Testing'.
    PERFORM ml_addrecp USING receiver 'U'.
    PERFORM upl.
    PERFORM doconv TABLES itab objbin.
    PERFORM ml_prepare USING 'X' extension name.
    PERFORM ml_dosend.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    FORM
    FORM upl.
    file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_name
    filetype = 'BIN'
    TABLES
    data_tab = itab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    path = file_name.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    CHECK_DOS_FORMAT =
    IMPORTING
    DRIVE =
    EXTENSION = extension
    NAME = name
    NAME_WITH_EXT =
    PATH =
    EXCEPTIONS
    INVALID_DRIVE = 1
    INVALID_EXTENSION = 2
    INVALID_NAME = 3
    INVALID_PATH = 4
    OTHERS = 5
    ENDFORM. "upl
    regards,
    amit m.

  • Problem to upload file in SE78 with REPORT

    Hi, the problem is:
    I must upload in SE78 from report some files .bmp that are located on server. In the report i use this code:
    PERFORM import_bitmap_bds
                      IN PROGRAM saplstxbitmaps
                          USING    filename
                                   name
                                   'GRAPHICS'     "Object
                                   'BMAP'         "ID
                                   'BCOL'         "B/W
                                   'BMP'          "Extension
                                   title
                                   space
                                   'X'
                                CHANGING l_docid
                                         l_resolution.
    Many PC don't have access to the directory of the file on server, so i used to download first the file on local PC (with OPEN DATASET in internal table and then GUI_DOWNLOAD to import on local) because the PERFORM above use in standard code the WS_DOWNLOAD. This work on many PC, but on few don't work because the directories on local are protected from writing (i use the root C:\). There's another solution to do that bypassing GUI_DOWNLOAD, or (more better!) a completely different way?

    Hi,
    if You are Facing the Access problem then it will be difficult to access the path.Try to use some shared folder that way you can prevent this problem,..
    Regards
    vijay

  • File to Mail with the same name

    Hi SAP Heros,
    Can somebody please tell me how to generate the same file name on the receiver mail adapter.
    Example
    File (file name =unknown.xml) -
    > XI -
    > Mail (file name =unknown.xml)
    I don't know the name of the sender file name , I only know the location so I have write *.xml in input file name but not sure how to  generate the same file name for mail adapter.
    My scenario is that I need to send the email with payload attachment but with with the same file name.
    Can somebody please help me in regards to this issue.
    Thanks,
    Iqbal

    Hello,
    I also had the same requirement and I too used adapter module.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/02706f11-0d01-0010-e5ae-ac25e74c4c81?quicklink=index&overridelayout=true. THis link will help you to create the module and implement in XI.
    Implement  the code which Stefan provided in the above link.
    Regards,
    Tiny Mampilly
    Edited by: TINY MAMPILLY on Jul 5, 2010 1:29 PM

  • Email attachment for text file using ABAP with funny format output

    Hi All,
    I am developing an ABAP program to generate an email to an external email address by using Function Module FUNCTION 'SO_DOCUMENT_SEND_API1. There is an attachment included in this program. The attachment is generated by reading through a data file from an Application Server and place it in the internal table before attaching it to the function module.
    Currently when I download the data file through SO01, I found that the data file looks a bit funny as below. It seems that all the letters are separated with an additional space in between.
    Funny Output:
    A B C D  1 2 3  A B C
    Suppose Output:
    ABCD 123 ABC
    I am not too sure if there is any output format that I need to set in order to make it works?

    hi Sree Ram,
    Thanks for your quick reply. The following is my code. I am not too sure if your reply will help to change the format of my data file or attachment sent through email.
    Thanks.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = w_doc_data
          put_in_outbox              = 'X'
          sender_address             = ld_sender_add
          sender_address_type        = ld_sender_add_type
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = w_sent_all
        TABLES
          packing_list               = t_packing_list
          contents_bin               = t_attachment
          contents_txt               = it_message
          receivers                  = t_receivers
        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.

  • Display text file in servlet with preserved formatting(newlines, etc)

    how do i display a text file in servlet, but all the blanks and newlines are preserved.
    this is what i did:
    RandomAccessFile text = new RandomAccessFile("D:/FYP/tempMessage.txt","r");
    long length = text.length();
    byte[] bytes = new byte[(int)length];
    //Read in the bytes
    int offset = 0;
    int numRead = 0;
    while (offset < bytes.length
    && (numRead=deCiphered.read(bytes, offset, bytes.length-offset)) >= 0) {
    offset += numRead;
    // Close the input stream and return bytes
    text.close();
    String plainText=new String(bytes);
    //display in servlet
    pw.println("<center>Plain text: " + plainText + "</center>");
    the problem here is the newlines are seem to be omitted when they're displayed in a web browser, rendering the displayed text in a mess.
    any help are greatly appreciated. thanks in advance :)

    display text in between <pre></pre> tags.
    or display it inside a text area,dont worry abt the text area border, u can change that using style sheets.

  • Sproxy to  mail with table format

    Hi experts ,
    my requirement  is sproxy to mail successfully executed in this scenario i wrote one user defined function like combine five fields in message mapping the fields are TransactionID,TransactionDate, CustomerID, TransactionAmount,RefundAmount
    UDF code
    public void CombineText(String[] var1, String[] var2, String[] var3, String[] var4, String[] var5, ResultList result, Container container) throws StreamTransformationException{
    String s = "";
    for( int i = 0 ; i < var1.length ; i++)
         if ( var1<i> != ResultList.CC)
         s = s +  var1<i> + "     " + var2<i> + "     " + var3<i> + "     " + var4<i> + "     " + var5<i>  + "\n" ;
    result.addValue( s );
    var1 -- TransactionID ,var2 -- TransactionDate   var2--CustomerID var3-TransactionAmount     var5-RefundAmount
    3988765433221899,20110425,BILLDESK3983,11100,11100
    4878000000011118,20110429,BILLDE911094,55100,55100
    ABCD000111122222,20110424,YJANARDHAN,222300,222300
    now i want below  structure pattern
    TransactionID                TransactionDate     CustomerID              TransactionAmount     RefundAmount
    3988765433221899    20110425                BILLDESK3983      11100                               11100
    4878000000011118     20110429              BILLDE911094        55100                               55100
    ABCD000111122222   20110424               YJANARDHAN      222300                              222300
    so please kindly provide UDF code or other inputs

    sorry, what is a problem?
    please show me nowly your UDF output and your ideal UDF out put.
    dont worry, maybe this is not difficlt problem, I think.

Maybe you are looking for