Output report name sent to email PDF

HI
If I send an Email from designmode it names the the attacment file REPORTNAME.PDF
when I email from a published app calls it
test?????????????????????????????????????????????????.pdf
are there any properties that I can control to be able to give the attachment file a more intuitive name
using CR that is attached to VS2010
regard
Lou

Hi Lou,
Did you write the app?
If you did not write the app then please contact the makers of the software for support. If you did then...
How CR works is when you open a report the Report Engine will copy the report to the \temp folder and give it a unique name as you have seen.
To get the name of the report and in C# do this:
string MyRptName = rpt.FileName.ToString();
MyRptName = MyRptName.Substring(MyRptName.LastIndexOf(@"\") + 1, (rpt.FileName.Length - 3) - (MyRptName.LastIndexOf(@"\") + 1)) + "pdf";
Thank you
Don

Similar Messages

  • Output to be Sent via Email

    Hi,
    We have an Output Type for Delivery, where the Packing List Output is sent automatically to one Mail ID that is maintained in Customer Master of Ship to Party. But we would like to send the Output via Mail for more than one Mail ID, which we maintain in Customer Master of Ship to Party. How to Maintain???
    Regards,

    Hi
    Maintain the Condition Record for that Output Type with Field Catalogs u2013 u201CDelvy Typeu201D / u201CPartner Functionu201D / u201CMediumu201D / u201CDate & timeu201D u2013 u201Crequired delivery typeu201D / u201CSHu201D / u201DExt Sendu201D / u201CSend immediately (when saving the application)u201D.
    Also maintain the Communication Strategy (whether via Internet or Fax) for this record. Now, when the delivery document is saved, the output will be sent to the email Id maintained in Ship to Party Customer Master.
    For sending mail to 2 ID's simultaneously:
    Option 1 - Appropriate enhancement to be made in the Program assigned to that Output Type, so that the 2 mail ID's maintained in the Ship to Party customer master is picked for sending output via email.
    Option 2 - Convince the client saying that it will be sent to one mail ID as mentioned above and that person can forward to whomsoever it has to go.
    Regards,
    Ravi.

  • Payment advices in F110 to be sent by email (PDF format) - step by step

    Hi SDN,
    We have a requirement to automatically send payment advices in F110 via email. The requirement is to send the file in PDF format. I've done a lot of browsing through in the forums, as well as check SAP notes, but none has really detailed a step by step process on how to go about it.
    I've also checked SAP NOTE 836169, but it is also not that detailed.
    Assuming that SCOT has been already set up by BASIS, I've done the following steps to test if the auto-email works, and here are the steps I did.
    1. Vendor Master Data -Define u2018Std communication methodu2019 as SMTP (Internet mail) and maintain an email address in the vendor master data.
    3. T-Code BERP u2013 Code to find the relevant BTE. Use the Selection Attribute to browse for your business area. In my case, it is AP-Payment Transactions hence FI-AP-AP-PT.
    00002040 is the relevant process. This is a Function called SAMPLE_PROCESS_00002040. In this case, the FM only checks for an email address in the Vendor Master. If more logic is required a Z-version would need to be created.
    4. Use t-code FIBF to create the enhancement.
    a) Create a product.
    A product groups together customer enhancements to BTEu2019s developed in the customer's namespace. All customer enhancements assigned to a certain customer product can be released with the Activate Customer Product indicator. The OPEN_FI function module for a certain customer enhancement cannot find the corresponding customer function modules, until this has been done.
    Create the product name (for example ZMAIL) and make it active.
    FIBF->Settings->Products->u2026of a Customer
    b) Assign the BTE to the FM:
    Settings->Process Modules->u2026of a customer
    Assign the 00002040 process to the FM and Product.
    5. Run the autopayment program F110.
    After I run the following steps, no email is being generated by the system. Is there anything that I still need to do? Or could anybody please kindly provide a step-by-step process? I'm a functional person, so I won't be able to do ABAP programming for this. Thanks and regards to all

    Hello,
    Check SCOT and SOST transactions.
    At a previous client using 4.6C we did a program and allocated it in F110.  The program reviewed the payment tables and sent the payment advice (basic list) to the employee vendors. 
    Also check http://wiki.sdn.sap.com/wiki/display/sandbox/SendMailwithPDFAttachment
    Regards
    Waza

  • PDF attachment not getting sent via email. This occurs intermittently.

    Hi All,
    There is a concurrent program which sends report on Purchase Orders. The report is sent as a PDF attachment via email.
    The report is getting attached sometimes and not getting attached sometimes giving an empty email. Checked the log files and output files of the program and couldnt find any issue. There is no specific time/PO/vendor pattern wherein the program fails.
    Please let me know what needs to be done to get this resolved.
    Regards,
    Radhika.

    Hi,
    I am facing this issue with Oracle 11i - US Purchasing SuperUser responsiblity.
    There is a concurrent program which generates a report and then sends the report to printer. The report is not getting stored in a temp file in any directory. It is directly emailed as a PDF attachment.
    Sometimes the attachment is getting sent while sometimes it is not getting attached.
    Please let me know if any other information is required.
    Regards,
    Radhika.

  • Report output to be sent via mail

    Hi Experts,
    I want to send my customized ABAP report output to an email address (e.g my own email ID) as I need to send to the vendor (who doesn't have SAP access) as per the requirement.
    Can you please let me know is there any transaction or any other way with the help of which i can just input this report name and the email Id and then it will automatically send the output of the report to that email id.
    Thanks in advance.
    Any helpful entry will be rewarded.
    Warm regards,
    Raman.

    You might want to write a small program that retrieves your spool information, and send the corresponding ALV (internal table) by converting it and sending it via SAP Connect. Here is a sample of hos to attach and send your internal table:
    FORM send_file .
      DATA: send_request       TYPE REF TO cl_bcs,
            text               TYPE bcsy_text,
            document           TYPE REF TO cl_document_bcs,
            recipient          TYPE REF TO if_recipient_bcs,
            copy               TYPE ad_smtpadr,
            bcs_exception      TYPE REF TO cx_bcs,
            sent_to_all        TYPE os_boolean,
            att_name           TYPE sood-objdes,
            subject            TYPE so_obj_des.
    Get attachment name
      CONCATENATE g_ret_id '_' sy-datum sy-uzeit '_' g_fileid '.CSV' INTO
      att_name.
      TRY.
    Create the send request
          send_request = cl_bcs=>create_persistent( ).
    Create the document with attachments
    Main document
            APPEND 'Attachment test' TO text.
          document = cl_document_bcs=>create_document(
                        i_type    = 'RAW'
                        i_text    = text
                        i_subject = subject ).
    Add text attachment to document
          document->add_attachment( i_attachment_type    = 'CSV'
                                    i_attachment_subject = att_name
                                    i_att_content_text   = itab_file ).
          send_request->set_document( document ).
    Create recipient and add to send request
          LOOP AT itab_recipients INTO wa_recipients.
            IF wa_recipients-copy IS INITIAL.
              "To recipient
              MOVE wa_recipients-address TO g_rec_send.
              recipient = cl_cam_address_bcs=>create_internet_address(
              g_rec_send ).
              send_request->add_recipient( i_recipient = recipient ).
              CLEAR g_rec_send.
            ELSE.
              "CC
              MOVE wa_recipients-address TO g_rec_send.
              recipient = cl_cam_address_bcs=>create_internet_address(
              g_rec_send ).
              send_request->add_recipient( i_recipient = recipient
                                           i_copy = 'X' ).
              CLEAR g_rec_send.
            ENDIF.
          ENDLOOP.
    Send
          sent_to_all = send_request->send( i_with_error_screen = 'X' ).
          IF sent_to_all = 'X'.
            MESSAGE s022.
          ENDIF.
        CATCH cx_bcs INTO bcs_exception.
          MESSAGE e865 WITH bcs_exception->error_type.
      ENDTRY.
    ENDFORM.                    " send_file
    REPORT TO EMAIL
    ALV output to email
    How to send ALV Grid report to Email?
    Check the code...on http://sap4.com/wiki/index.php?title=ZOUTLOOK
    sending the output of a program through an email
    report output to email
    Sending ABAP Report by email
    Rewards if useful..............
    Minal

  • Passing report name to be used in distrubute destination file?

    How can I pass the report_name used in %1 in my cgicmd.dat file to be used in my dest.xml file. Otherwise I am going to have to have a lot of destination xml files (one for each report)
    In my cgicmd.dat file i have the following:
    pm_report:report=%1 destype=cache DISTRIBUTE=YES destination=/home/oracle9i/dst/dest.xml server=rep userid=x/x@x %*
    which uses the dest/xml of:
    <destinations>
    <file id="MyFiles1" name="/home/reports/output/Daily_Volume_Delays.pdf" format="pdf">
    <include src="report"/>
    </file>
    <file id="MyFiles2" name="/home/reports/output/Daily_Volume_Delays.htm" format="html">
    <include src="report"/>
    </file>
    </destinations>

    Hi,
    One distribution file can be used to output to different output formats like html, pdf, rtf, etc. For example, the sample distribution file you wrote in your earlier post will output the report into html and pdf formats. So you do not need to have a separate distribution file for every output format.
    Similarly, passing the report name is not an issue. The distribution file does not care about the report name. You can use a single distribution file for all reports - just pass the report name in the command.
    However, you may still need a separate distribution file for every report definition. The reason is that if you use a single file for all report definition files, then the output report name will be the same for all reports (eg, "Daily_Volume_Delays.pdf"), that is, they will overwrite the previous output with same filename.
    You can get more information about distribution in Publishing Reports 10g Chapter 15 (Creating Advanced Distributions):
    http://otn.oracle.com/documentation/reports.html
    Navneet.

  • Templates and Passing a Report Name

    I need to create a template and have the report name passed on to that template, but I need a bit more detailed of an explanation then the following:
    Create a user parameter on the template and then pass the report name to the parameter at run time.

    I wish to have the report name sent to the template so that at runtime the report name will show. I have created a parameter for this to be passed to, and put a field in the header of the template to accept the parameter: what I need to know is how do you send the name of the report which exists in the property palette under -Report -General Information - Name node to the field on the template so it shows at runtime.
    Thanks

  • Report Name on Template

    I wish to have the report name sent to the template so that at runtime the report name will show. I have created a parameter for this to be passed to, and put a field in the header of the template to accept the parameter: what I need to know is how do you send the name of the report which exists in the property palette under -Report -General Information - Name node to the field on the template so it shows at runtime.

    hello,
    with patch 4 there is a procedure called srw.get_report_name(v_name); that retuns the report-name.
    regards,
    the oracle reports team

  • Email PDF file name issue via output determination - order confirmation etc

    Hi,
    I can email pdf files via output determination. Unfortunately the file name is same as sapscript name. How do I change it to the name I want for example document number.
    Thanks,
    Jai

    Hi Jaideep,
    You can change the mail title at Output determination.
    T/code NACE--> Application > Outputtype> Select O/P --> select Mail title and texts --> specify your text( with language) in "title" .
    Whenever Script send via e-mail the text you have entered will apear as mail title.
    Hope this may help you.
    Lanka

  • Questions on invoice sent by email as PDF

    Hello,
    I have set up my invoice output to be sent to an external address by email as a PDF.  This works fine but I have 3 questions:
    1.  How can I dynamically generate an email subject ?  Right now I can enter a fix subject but I would like it to be dynamic such as ex.: Invoice # xxxxxxxxxx sent by <cie name>.
    2.  The invoice is a PDF found as an attachment to the email.  How can I have text, besides the subject, in the email body ?  Where do we set up that in the system ?
    3.  I want to create a report that would show if the output was properly generated for the invoice and what's the status in sost.  I can't find a link between the entry in table NAST and the entry in SOST.  How can I link my output from NAST with the status in SOST in a report ?
    Thanks in advance for the help.

    Hi, on question 3, we had a simular request and solved it by storing the 'mail request number' in the application log.
    The 'mail request number' (SO_REC_NO) is returned by the smartfrom function module in SYST-MSGID, MSGNO,...
    The print application log can (think it should) be updated by calling function module 'NAST_PROTOCOL_UPDATE' after the call to the smartfrom function module.
    CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
        EXPORTING
          MSG_ARBGB = SYST-MSGID
          MSG_NR    = SYST-MSGNO
          MSG_TY    = SYST-MSGTY
          MSG_V1    = SYST-MSGV1
          MSG_V2    = SYST-MSGV2
          MSG_V3    = SYST-MSGV3
          MSG_V4    = SYST-MSGV4
    After that via field NAST-CMFPNR (Error management number) the application log can be retrieved. Application log messages are in table CMFP where field APLID = 'WFMC' (Output control) and NR = NAST-CMFPNR.
    The mail request number is stored in the log under CMFP-ARBGB = 'SSFCOMPOSER' and MSGNR = '024' in MSGV1. MSGV1 holds SO_REC_NO that is the key or index to tables SOST, SOSC, SOOD     
    Regards Jack

  • AR Invoice XMLP Report does not show as pdf in email Attachment

    Hi,
    I have developed a AR Invoice Report using XMLP. My requirement is to generate the output in pdf and also send the file as an attachment
    to the recipient email address with specified subject and body.
    I have developed the xmlp report rtf template and the report.rdf such that
    After report in report.rdf :
    function AfterReport return boolean is
    v_conc_request_id NUMBER;
    p_email_address VARCHAR2(100);
    v_set_layout_option boolean;
    BEGIN
         v_set_layout_option := fnd_request.add_layout('APPLN SHORT NAME','PROG_SHORT_NAME for report file','EN','US','PDF');
         IF (NOT v_set_layout_option) THEN
         srw.message( 10001,'Unable to apply template');
         ELSE      
              srw.message( 10001,'template applied');
    v_conc_request_id := FND_REQUEST.SUBMIT_REQUEST( application => 'APPLN SHORT NAME',
    program => 'PROG_SHORT_NAME for prog file',
                             description => NULL,
                                  start_time => TO_CHAR(SYSDATE, 'DD-MON-YY HH:MI:SS'),
                                  sub_request => FALSE,
                                  argument1 => :p_email_address,
                                  argument2 => :P_CONC_REQUEST_ID,
                                  argument3 => NULL,
                                  argument4 => NULL .... upto argument100                                                                                               );
    END IF;
    commit;
    return (TRUE);
    SRW.MESSAGE (10001,'CONC REQ ID:' ||v_conc_request_id );
    SRW.MESSAGE (10001,'Email Address:' ||p_email_address );
    srw.user_exit( 'FND SRWEXIT' );
    end;
    The FND_REQUEST.SUBMIT_REQUEST will call another Host program which will send an email with the specified Body and Subject.
    The report pdf output will be an attachment along with the email.
    Issues faced
    When I click on the Report Concurrent Program output, I can see the XMLP pdf output, but when the pdf file comes to my email address, it does not open,
    because, it is actually an xml file with the extension of pdf.
    I am actually picking up the file output from fnd_concurrent_requests. When I check the file it is xml, but in the conc manager it opens as a pdf,
    Is there a way by which I can pick up the pdf file and not the xml file. Is there any other location where this pdf file gets stored, which I see in the Conc manager output window, but not in the fnd_concurrent_requests table.
    I also notice that the pdf file gets generated in the Conc manager output window, irrespective of whether or not I use the code for
    fnd_request.add_layout.
    But when I use : fnd_request.add_layout, the Host program ends with a Warning, whereas if I don''t use it, then it completes successfully.
    But still the problem of the attachment persists.
    Warning
    ------------- 1) PUBLISH -------------
    Beginning post-processing of request 435302 on node NACRTCDELL005 at 31-OCT-2008 11:37:12.
    Post-processing of request 435302 failed at 31-OCT-2008 11:37:12 with the error message:
    One or more post-processing actions failed. Consult the OPP service log for details.
    ------------- 2) PRINT   -------------
    Not printing the output of this request because post-processing failed.
    Finished executing request completion options.
    Concurrent request completed
    Current system time is 31-OCT-2008 11:37:12
    Can someone please respond to this issue asap, the requirement is very critical.
    Thanks to all

    1. Bursting: You need to call the standard bursting program in the after report trigger, request id is the parameter,
    function AfterReport return boolean is
    G_REQUEST_ID number;
    begin
         G_REQUEST_ID := fnd_request.submit_request('XDO',
    'XDOBURSTREP',
    'XML Publisher Report Bursting Program',
    SYSDATE,
    FALSE,
    :P_CONC_REQUEST_ID,
    NULL,
                   Null,
                   Null,
                   Null,
                   NULL,
                   NULL,
                   NULL,NULL,NULL,
                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
    COMMIT;
    SRW.USER_EXIT('FND SRWEXIT');
    return (TRUE);
    Exception
    when others then return true;
    end;
    You need to create Bursting control file (.xml) and upload in the data definitions. If you want only one file as attachment, (<xapi:request select="/MODULE1/LIST_G_EMPNO/G_EMPNO"> here reduce the tree length) so only one file will be send as an email.
    <?xml version="1.0" encoding="UTF-8"?>
    <xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi" type ="bursting">
    <xapi:request select="/MODULE1/LIST_G_EMPNO/G_EMPNO">
    <xapi:delivery>
    <xapi:email id ="123" server="smtp_serverl.net" port="25"
    from="[email protected]" reply-to="[email protected]">
    <xapi:message id="123" to="[email protected]" cc="" attachment="true"
    content-type="text/html" subject="Purchase Order Number: ${EMPNO}">Please
    see attached Purchase Order File: ${EMPNO}</xapi:message>
    </xapi:email>
    </xapi:delivery>
    <xapi:document output="PO_${EMPNO}" output-type="pdf" delivery="123">
    <xapi:template type="rtf" location="xdo://CUS.TEST_BURST_1.en.US/?getSource=true"
    filter=""></xapi:template>
    </xapi:document>
    </xapi:request>
    </xapi:requestset>
    2. another way is,
    in your after report trigger, call another program. In that program, wait until your original program completes. After it is done, get the path and PDF file name, call your host program, passing the PDF file name as parameter. You need to modify your host program, a bit.

  • Emailing PDF Reports from Workspace in 10GR3

    Hi all,
    There is an option in the workspace of 10GR3 to generate PDF and Excel reports of instances Aborted/Completed/InProcess by filtering them and then hitting the Output Options button to generate a PDF or Excel reports out of these.
    But this has be done manually by somebody logging into the workspace, filtering out the data required and then generating PDF or Excel reports out of the data filtered and then saving the report to one's own desktop and then emailing the report to the managers.
    Can this be automated?
    Can OBPM 10GR3 automatically filter, generate these PDF reports and send them to the Participants which required to be emailed with the PDF reports as attachments?

    You could use PAPI inside a method in a Global Automatic to create a list of the aborted, completed and in process instances. You'd want to have this Global Automatic's property set to run as often as you want the email recipients to receive their emails.
    There is no OOTB PDF generation capability in Oracle BPM, but the iText Java library works very well for this.
    You'd need to:
    1. Write a little Java class that accepts a hash table as an incoming parameter and uses the values received to create and populate a PDF. This class calls methods in the iText library (http://www.lowagie.com/iText/) that populate the PDF document with the values it's passed.
    2. Jar the class and expose this and the iText "iText-2.1.7.jar" file as an External Resource in Oracle BPM.
    3. In a method in Oracle BPM, set the values in a hash table from the values in your BPM Object and call the Java method you wrote using the hash table as an incoming parameter.
    Rather than creating a PDF from scratch each time, you can also start with an Adobe AcroForm. You'd use this as a template and fill the form's bookmarked fields in using the fields sent in from the hash table.
    Once the PDF has been created, you'd use the Catalog's Fuego.Net.Mail component method to attach the file to the instance (see the "attachments[]" attribute) and send the email.
    Hope this helps,
    Dan

  • Report output different when sent directly to printer

    I have a report that if formated for 8.5 x 11 paper and has an address at the bottom of the page. When the report is generated as a pdf the address is in the corrent postion. When the report is sent directly to a printer from the report server the bottom 2 inches of the report are not printed. If i send the pdf version to the same printer it prints correctly.
    Any help with this issue would be greatly appreciated.

    Thanks for your answer, Ramachandra!
    However I need some more specific information to solve this.
    Which printer layout settings are relevant for the handling of margins and duplex printing for Adobe Forms?
    I have not set up the printer myself but when talking to the printer guy which settings should I recommend him to look at?
    I can see in transaction SPAD that there are settings specific to SmartForms but there is nothing said about Adobe Forms. Is there some way to make Adobe Forms related setting appear in SPAD for a device type?
    Maybe my problem is not related to the printer device settings but rather to the way the printer is being called. When printing duplex we will have to override the default settings of the printer anyway.
    Function module FP_JOB_OPEN has a parameter structure of the type SFPOUTPUTPARAMS. Which fields in this parameter structure are to be manipulated to get duplex print and output fitted to page size?

  • Output of ALV report as attachment in email

    Dear all ,
    I would like to send output of ALV report as attachment in email.
    i already written code for this using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    I can able to send list output as HTM format. But I want to send ALV report output
    As a attachment. How can I do this….please explain…
    Thanks in advance…
    Regards
    Manohar

    Hello,
    U can sent like this.
    Check this report
    REPORT ZV_SEND_MAIL .
    TABLES: EKKO.
    PARAMETERS: P_EMAIL   TYPE SOMLRECI1-RECEIVER
                                      DEFAULT '[email protected]'.
    TYPES: BEGIN OF T_EKPO,
      EBELN TYPE EKPO-EBELN,
      EBELP TYPE EKPO-EBELP,
      AEDAT TYPE EKPO-AEDAT,
      MATNR TYPE EKPO-MATNR,
    END OF T_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF T_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE T_EKPO.
    TYPES: BEGIN OF T_CHAREKPO,
      EBELN(10) TYPE C,
      EBELP(5)  TYPE C,
      AEDAT(8)  TYPE C,
      MATNR(18) TYPE C,
    END OF T_CHAREKPO.
    DATA: WA_CHAREKPO TYPE T_CHAREKPO.
    DATA:   IT_MESSAGE TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   IT_ATTACH TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
            T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
            T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            W_CNT TYPE I,
            W_SENT_ALL(1) TYPE C,
            W_DOC_DATA LIKE SODOCCHGI1,
            GD_ERROR    TYPE SY-SUBRC,
            GD_RECIEVER TYPE SY-SUBRC.
    *START_OF_SELECTION
    START-OF-SELECTION.
    *   Retrieve sample data from table ekpo
      PERFORM DATA_RETRIEVAL.
    *   Populate table with detaisl to be entered into .xls file
      PERFORM BUILD_XLS_DATA_TABLE.
    *END-OF-SELECTION
    END-OF-SELECTION.
    * Populate message body text
      PERFORM POPULATE_EMAIL_MESSAGE_BODY.
    * Send file by email as .xls speadsheet
      PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
                                   TABLES IT_MESSAGE
                                          IT_ATTACH
                                    USING P_EMAIL
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 CHANGING GD_ERROR
                                          GD_RECIEVER.
    *   Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN EBELP AEDAT MATNR
       UP TO 10 ROWS
        FROM EKPO
        INTO TABLE IT_EKPO.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
    *       Build data table for .xls document
    FORM BUILD_XLS_DATA_TABLE.
      CONSTANTS: CON_CRET TYPE X VALUE '0D',  "OK for non Unicode
                 CON_TAB TYPE X VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
    *    con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
    *    con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO IT_ATTACH SEPARATED BY CON_TAB.
      CONCATENATE CON_CRET IT_ATTACH  INTO IT_ATTACH.
      APPEND  IT_ATTACH.
      LOOP AT IT_EKPO INTO WA_CHAREKPO.
        CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP
                    WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR
               INTO IT_ATTACH SEPARATED BY CON_TAB.
        CONCATENATE CON_CRET IT_ATTACH  INTO IT_ATTACH.
        APPEND  IT_ATTACH.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    *       Send email
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
                                              PIT_ATTACH
                                        USING P_EMAIL
                                              P_MTITLE
                                              P_FORMAT
                                              P_FILENAME
                                              P_ATTDESCRIPTION
                                              P_SENDER_ADDRESS
                                              P_SENDER_ADDRES_TYPE
                                     CHANGING P_ERROR
                                              P_RECIEVER.
      DATA: LD_ERROR    TYPE SY-SUBRC,
            LD_RECIEVER TYPE SY-SUBRC,
            LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
            LD_EMAIL LIKE  SOMLRECI1-RECEIVER,
            LD_FORMAT TYPE  SO_OBJ_TP ,
            LD_ATTDESCRIPTION TYPE  SO_OBJ_NAM ,
            LD_ATTFILENAME TYPE  SO_OBJ_DES ,
            LD_SENDER_ADDRESS LIKE  SOEXTRECI1-RECEIVER,
            LD_SENDER_ADDRESS_TYPE LIKE  SOEXTRECI1-ADR_TYP,
            LD_RECEIVER LIKE  SY-SUBRC.
      LD_EMAIL   = P_EMAIL.
      LD_MTITLE = P_MTITLE.
      LD_FORMAT              = P_FORMAT.
      LD_ATTDESCRIPTION      = P_ATTDESCRIPTION.
      LD_ATTFILENAME         = P_FILENAME.
      LD_SENDER_ADDRESS      = P_SENDER_ADDRESS.
      LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    * Fill the document data.
      W_DOC_DATA-DOC_SIZE = 1.
    * Populate the subject/generic message attributes
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME  = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
      W_DOC_DATA-SENSITIVTY = 'F'.
    * Fill the document data and get size of attachment
      CLEAR W_DOC_DATA.
      READ TABLE IT_ATTACH INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
         ( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
      W_DOC_DATA-OBJ_LANGU  = SY-LANGU.
      W_DOC_DATA-OBJ_NAME   = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR  = LD_MTITLE.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = PIT_ATTACH[].
    * Describe the body of the message
      CLEAR T_PACKING_LIST.
      REFRESH T_PACKING_LIST.
      T_PACKING_LIST-TRANSF_BIN = SPACE.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 0.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = 'RAW'.
      APPEND T_PACKING_LIST.
    * Create attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM   = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE   =  LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR  =  LD_ATTDESCRIPTION.
      T_PACKING_LIST-OBJ_NAME   =  LD_ATTFILENAME.
      T_PACKING_LIST-DOC_SIZE   =  T_PACKING_LIST-BODY_NUM * 255.
      APPEND T_PACKING_LIST.
    * Add the recipients email address
      CLEAR T_RECEIVERS.
      REFRESH T_RECEIVERS.
      T_RECEIVERS-RECEIVER = LD_EMAIL.
      T_RECEIVERS-REC_TYPE = 'U'.
      T_RECEIVERS-COM_TYPE = 'INT'.
      T_RECEIVERS-NOTIF_DEL = 'X'.
      T_RECEIVERS-NOTIF_NDEL = 'X'.
      APPEND T_RECEIVERS.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = W_DOC_DATA
                PUT_IN_OUTBOX              = 'X'
                SENDER_ADDRESS             = LD_SENDER_ADDRESS
                SENDER_ADDRESS_TYPE        = LD_SENDER_ADDRESS_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.
    * Populate zerror return code
      LD_ERROR = SY-SUBRC.
    * Populate zreceiver return code
      LOOP AT T_RECEIVERS.
        LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
      ENDLOOP.
    ENDFORM.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
    *       Instructs mail send program for SAPCONNECT to send email.
    FORM INITIATE_MAIL_EXECUTE_PROGRAM.
      WAIT UP TO 2 SECONDS.
      SUBMIT RSCONN01 WITH MODE = 'INT'
                    WITH OUTPUT = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
    *        Populate message body text
    FORM POPULATE_EMAIL_MESSAGE_BODY.
      REFRESH IT_MESSAGE.
      IT_MESSAGE = 'Please find attached a list test ekpo records'.
      APPEND IT_MESSAGE.
    ENDFORM.                    " POPULATE_EMAIL_MESSAGE_BODY
    If useful reward.
    Vasanth

  • No Payment document attachement (PDF) sent via email

    Hi,
    We have been running the auto-email with PDF payment attachement via F110 for quite some times. Recently my user feedback that some of the vendors receive the email sent by SAP system, however, no attachement being sent to them.
    I have checked the F110 log, which the requested email is generated successfully. However, i couldn't check whether there is email attachement being to them via SOST.
    We are in ECC6. The reported cases are perhaps 5% of the batch payment document running affected with no pdf file attachement sent via email.
    I have been searching around any similar case and how we trace the problem. Can someone share on it?
    Thank you very much in advance.

    Hi
    Ask to these vendor what kind of software they have to avoid SPAM, or if they manage black lists, 'grey' list. There are other software tools managing these messages. Sometimes these tools remove the attachments.
    I hope this helps you
    Regards
    Eduardo
    Edited by: E_Hinojosa on Dec 16, 2011 10:22 AM

Maybe you are looking for

  • How do I install the Macro Media Player?

    Im currently taking an online test for my college course and I cannot proceed without first downloading the macromedia player but Im unable to click the download link because I "need a plugin". PLease help.

  • Deletion in application table

    When I am trying to delete a row from application table , after selecting a row from table and clicking the 'X' icon in application table and the clicking on commit , I am getting "JBO-25019: Entity row with key oracle.jbo.Key[13000 1 ] is not found

  • Inventory management analysis

    Hello, I would like to analyse deliveries and missing parts in stock. I used MCBC and MCBZ tcode. The result is quite fine, but it is only monthly splitting. Is there a solution to split weekly or even daily result ? Or with another tcode ? Thanks

  • Additional Expenses In GRPO

    Hi All, We are using SAP 8.8 PL 15. We take following steps for a import cycle. PURCHASE ORDER GOODS RECEIPT PO LANDED COST AP INVOICE WHEN WE RECEIVE FREIGHT , CLEARING , INSURANCE ETC BILLS (The additional expenses occured in import) we book them .

  • Puddle and reflection effects in After Effects CS4

    I am currently using After Effects CS4 (will be upgrading to CS6 in a couple of days) and I am currently trying out a test project using basic lighting animation.  However, one element I want to create is a puddle on the ground.  I was wondering if a