Submit Report as an attachement Excel via mail using planified job SM37

Hi,
I'm executing a program in background via job to get back the result of a report as an attachment XLS on mail.
the result of my program give me just title of Excel columns , but when i execute it manually , the result is perfect.
my code is :
******************************FORM MAIL*******************************
FORM mail.
CONCATENATE 'Expédition' 'TExp' 'PtOT' 'Crée' 'Crée le' 'St.' 'Déb.
chargt'
'Désignation' 'Div.' 'Doc. vente' 'Réceptionnaire' 'Nom1' 'Nom2'
'Volume' 'UQ' INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
CONCATENATE SPACE SPACE INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
*CLEAR it_mess_att.
LOOP AT it_tab into wa_tab.
*VAL = it_tab-ZQTEMAX.
CONCATENATE wa_tab-SHNUMBER wa_tab-SHTYPE
wa_tab-TPLST wa_tab-CRE_NAME
wa_tab-CRE_DATE wa_tab-OIG_SSTSF
wa_tab-LOAD_STDTA wa_tab-VMODE_TEXT
wa_tab-WERKS wa_tab-VBELN
wa_tab-KUNNR wa_tab-NAME1
wa_tab-CARRIER_DE
wa_tab-WGT_UOM INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
*CLEAR it_mess_att.
ENDLOOP.
ENDFORM.
*************************FORM SEND_MAIL*******************************
FORM send_mail .
DATA: send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
recipient TYPE REF TO cl_cam_address_bcs,
bcs_exception TYPE REF TO cx_bcs,
sent_to_all TYPE os_boolean,
lt_fields TYPE TABLE OF w3fields,
lt_html TYPE TABLE OF w3html.
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 sopcklsti1-obj_descr,
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.
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.
*MOVE p_email TO mailid.
***************ADD ADRESS MAIL**************
p_email1-RECEIVER = mail .
append p_email1.
ld_email = mail.
ld_mtitle = gd_attachment_desc.
ld_format = 'XLS'.
ld_attdescription = gd_attachment_desc.
ld_attdescription = 'Liste expéditions PN'.
CONCATENATE ld_attdescription '.XLS' INTO ld_attfilename.
ld_attfilename = p_filename.
  ld_sender_address = w_sender.
  ld_sender_address_type = 'INT'.
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_mess_att INDEX 1.
  w_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ).
  w_doc_data-obj_langu = sy-langu.
  w_doc_data-obj_name = 'SAPRPT'.
  w_doc_data-obj_descr = gd_attachment_desc.
  w_doc_data-sensitivty = 'F'.
  CLEAR t_attachment.
  REFRESH t_attachment.
t_attachment[] = it_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_mess_bod 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 it_mess_att 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.
  loop at p_email1.
  t_receivers-receiver = p_email1-receiver.
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  APPEND t_receivers.
  endloop.
  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 = it_mess_att
        contents_txt = it_mess_bod
        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.
  WAIT UP TO 5 SECONDS.
  SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN.
ENDFORM. " send_mail

Hi,
I'm executing a program in background via job to get back the result of a report as an attachment XLS on mail.
the result of my program give me just title of Excel columns , but when i execute it manually , the result is perfect.
my code is :
******************************FORM MAIL*******************************
FORM mail.
CONCATENATE 'Expédition' 'TExp' 'PtOT' 'Crée' 'Crée le' 'St.' 'Déb.
chargt'
'Désignation' 'Div.' 'Doc. vente' 'Réceptionnaire' 'Nom1' 'Nom2'
'Volume' 'UQ' INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
CONCATENATE SPACE SPACE INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
*CLEAR it_mess_att.
LOOP AT it_tab into wa_tab.
*VAL = it_tab-ZQTEMAX.
CONCATENATE wa_tab-SHNUMBER wa_tab-SHTYPE
wa_tab-TPLST wa_tab-CRE_NAME
wa_tab-CRE_DATE wa_tab-OIG_SSTSF
wa_tab-LOAD_STDTA wa_tab-VMODE_TEXT
wa_tab-WERKS wa_tab-VBELN
wa_tab-KUNNR wa_tab-NAME1
wa_tab-CARRIER_DE
wa_tab-WGT_UOM INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
*CLEAR it_mess_att.
ENDLOOP.
ENDFORM.
*************************FORM SEND_MAIL*******************************
FORM send_mail .
DATA: send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
recipient TYPE REF TO cl_cam_address_bcs,
bcs_exception TYPE REF TO cx_bcs,
sent_to_all TYPE os_boolean,
lt_fields TYPE TABLE OF w3fields,
lt_html TYPE TABLE OF w3html.
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 sopcklsti1-obj_descr,
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.
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.
*MOVE p_email TO mailid.
***************ADD ADRESS MAIL**************
p_email1-RECEIVER = mail .
append p_email1.
ld_email = mail.
ld_mtitle = gd_attachment_desc.
ld_format = 'XLS'.
ld_attdescription = gd_attachment_desc.
ld_attdescription = 'Liste expéditions PN'.
CONCATENATE ld_attdescription '.XLS' INTO ld_attfilename.
ld_attfilename = p_filename.
  ld_sender_address = w_sender.
  ld_sender_address_type = 'INT'.
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_mess_att INDEX 1.
  w_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ).
  w_doc_data-obj_langu = sy-langu.
  w_doc_data-obj_name = 'SAPRPT'.
  w_doc_data-obj_descr = gd_attachment_desc.
  w_doc_data-sensitivty = 'F'.
  CLEAR t_attachment.
  REFRESH t_attachment.
t_attachment[] = it_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_mess_bod 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 it_mess_att 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.
  loop at p_email1.
  t_receivers-receiver = p_email1-receiver.
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  APPEND t_receivers.
  endloop.
  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 = it_mess_att
        contents_txt = it_mess_bod
        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.
  WAIT UP TO 5 SECONDS.
  SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN.
ENDFORM. " send_mail

Similar Messages

  • Submit Report as an attachement Excel via mail

    Hi,
    I want to send an email with the result of report O4B1 as attachment Excel with columns separated in Excel.
    Best regards.

    REPORT  YJAJUR_EMAILOPTIONS                     .
    tables: kna1.
    data: begin of it_kna1 occurs 0," with header line,
          kunnr like kna1-kunnr,
          land1 like kna1-land1,
          name1 like kna1-name1,
          end of it_kna1.
    data: w_sender like somlreci1-receiver.
    CONSTANTS:
    con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
    con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
    data: it_mess_att like solisti1 occurs 0 with header line,
            gd_attachment_desc type sopcklsti1-obj_descr.
    data: gd_subject   like sodocchgi1-obj_descr,
          it_mess_bod like solisti1 occurs 0 with header line,
          gd_sender_type     like soextreci1-adr_typ,
           gd_attachment_name type so_obj_des.
    select-options: p_email for w_sender no intervals.
    PARAMETER mailid TYPE adr6-smtp_addr NO-DISPLAY.
    data : it_kna2 type kna1 occurs 0 with header line.
      select kunnr
             land1
             name1
             from kna1 into table it_kna1 .
       select * from kna1 into table it_kna2.
       concatenate 'EMSIL OPTIONS DONE BY sANTOSH.s.jAJU' 'MODEL WISE upto' Into gd_attachment_desc separated by space.
    concatenate  'Custmer' 'custmer name' 'custmer land1'      con_tab into
    it_mess_att separaTED BY con_tab.
    CONCATENATE con_cret it_mess_att INTO it_mess_att.
       APPEND it_mess_att.
       CLEAR it_mess_att.
    *loop at p_email.
    *endloop.
    data: i1 type string.
    perform email.
    loop at p_email.
    i1 = i1 + 1.
    concatenate 'email' ':' i1 space p_email-low into it_mess_bod.
    it_mess_bod = p_email-low..
    APPEND it_mess_bod.
    clear it_mess_bod.
    perform send_mail.
    endloop.
    perform display_data..
    *&      Form  email
          text
    -->  p1        text
    <--  p2        text
    FORM email .
    loop at it_kna2.
          concatenate con_cret  it_kna2-kunnr con_tab
                    it_kna2-name1 con_tab it_kna2-land1 into it_mess_att.
            APPEND it_mess_att.
       CLEAR it_mess_att.
    endloop.
    ENDFORM.                    " email
    *&      Form  send_mail
          text
    -->  p1        text
    <--  p2        text
    FORM send_mail .
    DATA: send_request  TYPE REF TO cl_bcs,
          document      TYPE REF TO cl_document_bcs,
          recipient     TYPE REF TO cl_cam_address_bcs,
          bcs_exception TYPE REF TO cx_bcs,
          sent_to_all   TYPE os_boolean,
          lt_tab        TYPE TABLE OF makt,
          lt_fields     TYPE TABLE OF w3fields,
          lt_html       TYPE TABLE OF w3html.
    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  sopcklsti1-obj_descr,
            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.
      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.
    MOVE P_EMAIL TO MAILID.
    SELECT * FROM makt UP TO 10 ROWS INTO TABLE lt_tab WHERE spras = 'E'.
    CALL FUNCTION 'WWW_ITAB_TO_HTML'
      TABLES
        html   = lt_html[]
        fields = lt_fields
        itable = lt_tab.
    TRY.
        send_request = cl_bcs=>create_persistent( ).
        document = cl_document_bcs=>create_document(  i_type    = 'HTM'
                                                      i_text    = lt_html
                                                      i_subject = 'Table' ).
        send_request->set_document( document ).
        recipient = cl_cam_address_bcs=>create_internet_address( MAILID ).
        send_request->add_recipient( EXPORTING i_recipient = recipient
                                               i_express   = 'X' ).
        send_request->set_send_immediately( 'X' ).
        send_request->send( EXPORTING i_with_error_screen = 'X'
                            RECEIVING result              = sent_to_all ).
        COMMIT WORK.
      CATCH cx_bcs INTO bcs_exception.
        EXIT.
    ENDTRY.
      ld_email   = p_email-low.
      ld_mtitle = gd_attachment_desc.
      ld_format              = 'XLS'.
      ld_attdescription      = gd_attachment_desc.
      concatenate gd_attachment_desc '.XLS' into ld_attfilename.
    ld_attfilename         = p_filename.
      ld_sender_address      = w_sender.
    ld_sender_address_type = 'INT'.
    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_mess_att index 1.
      w_doc_data-doc_size =  ( w_cnt - 1 ) * 255 + strlen( it_mess_att ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = gd_attachment_desc.
      w_doc_data-sensitivty = 'F'.
      clear t_attachment.
      refresh t_attachment.
    t_attachment[] = it_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_mess_bod 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 it_mess_att 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               = it_mess_att
          contents_txt               = it_mess_bod
          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.
      wait up to 5 seconds.
      submit rsconn01 with mode   = 'INT'
                      with output = 'X'
                      and return.
    ENDFORM.                    " send_mail
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    FORM display_data .
    loop at it_kna2.
         write:/ it_kna2-kunnr,it_kna2-land1,it_kna2-name1.
    endloop.
    ENDFORM.                    " display_data
    ref this code i guess this will works

  • Sending attachment in a mail using SO_DOCUMENT_SEND_API1

    Hi,
    I am trying to send an attachment in a mail using the FM SO_DOCUMENT_SEND_API1.
    The contents of the body and the attachement are same.
    The contents of the body are coming in proper format but the attachements are not.
    The body contents are in this way:
    1000013559     0010004994     PBG BROOKF     1000013559     000100     010052000328667000     GA LQ CRE 20OZ 24CS FRT PUN              0.000     CS
    1000013559     0010004994     PBG BROOKF     1000013559     000200     010052000328681000     GA LQ CRE 20OZ 24CS LL              0.000     CS
    But the attachement contents are:
    1000013559     0010004994     PBG BROOKF     1000013559     000100     010052000328667000     GA LQ CRE 20OZ 24CS FRT PUN
             ⸀        䌀匀ഀ਀                                                                                                         u2020
    1000013559     0010004994     PBG BROOKF     1000013559     000200     010052000328681000     GA LQ CRE 20OZ 24CS LL
        ⸀        䌀匀ഀ਀                                                                                                              u2020
    Also the last 2 fields which are quantity and unit fields, are not coming at all in the attachment.
    Please help me solve this issue.
    Thanks,
    Abhishek

    what is the document type of attachment? is it excel?

  • Report to send a List via mail

    Hi everybody,
    at the moment we hava a report which we have to start every day to generate a customer List. Via SAP Office we can send this list via email to a specific person. Now I like to automate this report and start it as a job which automativly send this list via mail.
    Do you have an idea how this will work?
    Thanks a lot for your help.
    Kind regards
    Christian

    Hi Christian.
    You could put the lines of your list in a table of type SOLISTI1 and then use the function module SO_NEW_DOCUMENT_SEND_API1 to send the content of this table. You have to fill the table RECEIVERS with the address you want to send the report to.
    Hope that helps,
    Timo.

  • How to send ALV list report as html attachment in a mail??

    Hi all,
    I have an ALV report which I want to send as an HTML attachment in a mail to an external id. I know that spool can be converted to HTML attachment in a mail. But I don't want to have 2 programs - one for generating ALV and the other to send mail with the spool-converted of the first report as attachment. I want to send the mail in the same program itself. Is it possible? Helpful answers will be suitably rewarded.

    Hi Sandip,
    In your ALV program after the alv output is build in the program do the following steps.
    1). Export the list to memory
    2). Import the list from mempry
    3). Do a COmpress of the data
    4). Send an email as an attachment using the normal FM.
    Take a look at the following links which will explain how to do the above steps.
    http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
    http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    remember to change the doc type as 'HTM' in the FM to send email.
    Cheers
    VJ

  • Error while opening PDF attachment sent via mail

    Hi,
    I am attaching PDF file to PO in me22n and sending the same file as attachment in the mail to the vendor using class CL_BCS.
    The mail is sent to the vendor successfully and they are able to successfully open the PDF attachment. But in some cases the mail is successfully received but while opening the attachment it is giving the error as file is corrupted.
    Please help me to resolve this issue.
    Thanks and regards,
    Jayashree

    Hi,
    I would like to know what font type, you are using in the forms.
    Ideally it should be HELVETICA .
    If you are using any other font in your style/form,try changing it to HELVETICA & Test.
    Also Check the OTF data at the call of gen. FM,before converting it to PDF.
    Regds,
    AS
    Edited by: abheesawant on Oct 12, 2011 7:48 AM

  • Can't download attachements on yahoo mail using firefox. IE will open them

    Can't download attachments on yahoo mail using firefox. IE will open them
    == This happened ==
    Every time Firefox opened
    == 5/4/2010

    You don't have to disable any addons or extentions!!!You guys are not going to believe this I figured out the problem it's really dumb...ok here goes the attachment uploader loads seperate so I got to thinking it's a popup so I went to options content and under block pop ups there is an option exceptions click on that and in the box type firefox.com and hit allow pow its fixed!!!!! :-)

  • 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

  • Fm to attach excel in mail

    Hi,
    can anyone send me the FM which is used to send mail with excel attachment other than 'SO_DOCUMENT_SEND_API'.
    IS there anyother document which illustrates the above?
    Regards,
    Storm.

    Hi,
    Check these FM...
    ISR_FI_SEND_EMAIL
    ISR_FI_SEND_EMAIL_NEW_USER
    SLS_CUST_SEND_EMAIL_TOOL
    ********Reward points ,if useful

  • TS3276 Corrupt Attachment in Apple Mail (using IMAP)(on Mountain Lion too)

    I got corrupt attachments by using Apple Mail, IMAP on both Gmail and my company email. The problem continues since Lion, Mountain Lion is the same still. Any suggestion?
    This is really a trouble to me...
    Look, the main reason I bought Mountain Lion on 25th this month is Mail improvement. And seems the hug problem is not solved at all... what a pity...
    I might have to go back to the less integrated 3rd party apps... Can some one answer me?

    Well no particular file, any file can be corrupted in my experience. I've seen corrupted JPG files, PDF files, MS word files, excel files, and even .zip files.
    It doesn't matter who send the email, it could happen on any email in my mail box. When I use other application like Thunderbird or Sparrow doesn't cause such issue.
    Believe me I know what I'm doing, with the latest Mountain Lion, Latest Adobe Reader I can get from official website and it does not matter which version I'm having. No antivirus program involved, even if there is antivirus program involved, why I don't get trouble in other mail apps?
    The problem is, the attachment files in the email was not correctly downloaded. It doesn't matter which program I use to view it. If I save the attached files onto my desktop, situation remain the same. The only possible way I can do is to rebuild the entire mail database. However, the rebuilding process could be hours for I have tons of emails saved on the server, and it does not guarantee will solve the problem. Why bother spending so much time only simply want to get a file? The point is, by using Thunderbird I can get the file instantly, with Mail I can't?
    The following is part of the corrupted file's MIME header. I'm not sure if this is enough for I didn't copy the entire header for it contains some sender information. I would probably not sharing those email addresses.
    MIME-Version: 1.0
    Content-Type: multipart/mixed; boundary="=_997f4b2baebbe275a574812f1ca64cdf"
    --=_997f4b2baebbe275a574812f1ca64cdf
    Content-Type: multipart/ALTERNATIVE;
              boundary="=_44f440161c4f3bd3273d9805e6f1454b"
    --=_997f4b2baebbe275a574812f1ca64cdf
    Content-Disposition: attachment;
              filename*0="=?UTF-8?Q?GMOs=20=E0=B9=80=E0=B8=A1=E0=B8=A5=E0=B9=87=E0=B8=94 =E";
              filename*1="0=B8=9E=E0=B8=B1=E0=B8=99=E0=B8=98=E0=B9=8C=E0=B8=82=E0=B9=89= E0";
              filename*2="=B8=B2=E0=B8=A7=E0=B9=82=E0=B8=9E=E0=B8=94=E0=B8=AB=E0=B8=A7=E 0=";
              filename*3="B8=B2=E0=B8=9927072555_0000.pdf?="
    Content-Type: APPLICATION/PDF;
              name*0="=?UTF-8?Q?GMOs=20=E0=B9=80=E0=B8=A1=E0=B8=A5=E0=B9=87=E0=B8=94=E";
              name*1="0=B8=9E=E0=B8=B1=E0=B8=99=E0=B8=98=E0=B9=8C=E0=B8=82=E0=B9=89=E0";
              name*2="=B8=B2=E0=B8=A7=E0=B9=82=E0=B8=9E=E0=B8=94=E0=B8=AB=E0=B8=A7=E0=";
              name*3="B8=B2=E0=B8=9927072555_0000.pdf?="
    Content-Transfer-Encoding: base64

  • Oracle report output in MS Excel sheet version used oracle apps 11.5.9

    Hi guys,
    I need ur help........plz tell me how to convert rdf report output in excel sheet format currently it come in pdf format. actually oracle apps version 11.5.9 there is no option for xml publisher report that's why i m facing prob.
    used:
    report builder version : 6i
    database : 9i
    Report belong from AR module......................... Debtor Ledger Report of AR.
    I hv tried Text,xml report output option but not worked.......plz give me idea how to resolve this issue...................................thanks

    How To View / Open Concurrent Requests With The Excel Application [ID 377424.1]
    Please also see old threads for similar discussion -- http://forums.oracle.com/forums/search.jspa?threadID=&q=Excel+AND+Concurrent&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Can I change the thumbnail size while I am browsing photos to add as attachment in Mac mail using Mountain Lion OS X?

    I am new to Mac and I love my new computor, but I am still getting used to the features and how to use them more effectively.  I am interested in finding an answer to this because it can take up a lot of time going into preview mode everytime I want to add a specific photo in a folder but I am unsure of which one is the photo I had in mind.

    I don't see a slider at the bottom, but there is a slider above the list and under the thumbnails.  I didn't see it before, thank you!

  • Can I get a mail if a job (sm37) fails or is cancelled?

    I have defined a couple of jobs in transaction SM36 which run every night.
    Sometimes a job fails because of a dump, a system downtime, etc.
    Can I define the job in some way that I get a E-Mail when it fails?

    Hey Dan,
    Check out this link below:
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/2c/abb2e7ff6311d194c000a0c93033f7/frameset.htm
    This will surely help what you wanted to do.
    Lemme know if it helped you.
    Thanks,
    Jai

  • Sending mail using a job and a package

    Dear all,
    I would like to request your help in this task:
    in fact I have a package p$job_sendmail used for sending emails and a job
    that calls this package.
    after doing an insert of a single row in a table x, for each row inserted in that table the job runs and an email is sent.
    The code of the package is:
    create or replace package p$job_sendmail is
    g_pck           varchar2(256):='job_sendmail';
    procedure lance;
    procedure arret;
    end;
    create or replace package body p$job_sendmail is
    procedure lance is
         l_error               varchar2(256);
         l_message               varchar2(4000);
         l_file               varchar2(256);
         l_rep                    varchar2(256);
         l_ret                    number;
       begin
         l_error := 'OK';
         l_message:= null;
         loop
              begin
    p$msg_sendmail.lit_mess
    (2,
    5,
    l_error,
    l_message
    if l_erreur != 'OK' then
         rollback;
    end if;
    exit when l_erreur != 'OK';
    commit;
    exception
    when OTHERS then
    rollback;
    exit;
    end;
    end loop;
    end;
    procedure arret is
    begin
         p$msg_sendmail.arret;
       end;
    end;
    The code of the job that runs for each row inserted in the table x and calls the package is:SELECT JOB,LOG_USER,WHAT FROM USER_JOBS;
    prompt
    accept NUM_JOB prompt ' Number of the job: '
    var indice_job number;
    begin
    :indice_job := &NUM_JOB;
    if :indice_job != 0 then
    DBMS_JOB.ISUBMIT(:indice_job,'p$job_sendmail.lance;',SYSDATE);
    end if;
    COMMIT;
    end;
    The problem is that after inserting a row in the tabke x and running the job manually from pl/sql, the email is not sent
    can anyone help me please?

    http://forum.java.sun.com/thread.jsp?forum=43&thread=165268

  • Submit a transaction O4B1 via job and the result as an attachment Excel

    Hi, I'm executing a program in background via job to get back the result of a report as an attachment XLS on mail. the result of my program give me just title of Excel columns , but when i execute it manually , the result is perfect.
    my code is : ******************************FORM MAIL******************************* FORM mail. CONCATENATE 'Expédition' 'TExp' 'PtOT' 'Crée' 'Crée le' 'St.' 'Déb. chargt' 'Désignation' 'Div.' 'Doc. vente' 'Réceptionnaire' 'Nom1' 'Nom2' 'Volume' 'UQ' INTO it_mess_att SEPARATED BY con_tab. CONCATENATE con_cret it_mess_att INTO it_mess_att. APPEND it_mess_att. CONCATENATE SPACE SPACE INTO it_mess_att SEPARATED BY con_tab. CONCATENATE con_cret it_mess_att INTO it_mess_att. APPEND it_mess_att. *CLEAR it_mess_att. LOOP AT it_tab into wa_tab. *VAL = it_tab-ZQTEMAX. CONCATENATE wa_tab-SHNUMBER wa_tab-SHTYPE wa_tab-TPLST wa_tab-CRE_NAME wa_tab-CRE_DATE wa_tab-OIG_SSTSF wa_tab-LOAD_STDTA wa_tab-VMODE_TEXT wa_tab-WERKS wa_tab-VBELN wa_tab-KUNNR wa_tab-NAME1 wa_tab-CARRIER_DE wa_tab-WGT_UOM INTO it_mess_att SEPARATED BY con_tab. CONCATENATE con_cret it_mess_att INTO it_mess_att. APPEND it_mess_att. *CLEAR it_mess_att. ENDLOOP. ENDFORM. *************************FORM SEND_MAIL******************************* FORM send_mail . DATA: send_request TYPE REF TO cl_bcs, document TYPE REF TO cl_document_bcs, recipient TYPE REF TO cl_cam_address_bcs, bcs_exception TYPE REF TO cx_bcs, sent_to_all TYPE os_boolean, lt_fields TYPE TABLE OF w3fields, lt_html TYPE TABLE OF w3html. 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 sopcklsti1-obj_descr, 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. 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. *MOVE p_email TO mailid. ***************ADD ADRESS MAIL************** p_email1-RECEIVER = mail . append p_email1. ********************************************* ld_email = mail. ld_mtitle = gd_attachment_desc. ld_format = 'XLS'. * ld_attdescription = gd_attachment_desc. ld_attdescription = 'Liste expéditions PN'. CONCATENATE ld_attdescription '.XLS' INTO ld_attfilename. * ld_attfilename = p_filename. ld_sender_address = w_sender. ld_sender_address_type = 'INT'. * 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_mess_att INDEX 1. w_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ). w_doc_data-obj_langu = sy-langu. w_doc_data-obj_name = 'SAPRPT'. w_doc_data-obj_descr = gd_attachment_desc. w_doc_data-sensitivty = 'F'. CLEAR t_attachment. REFRESH t_attachment. * t_attachment[] = it_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_mess_bod 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 it_mess_att 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. loop at p_email1. t_receivers-receiver = p_email1-receiver. t_receivers-rec_type = 'U'. t_receivers-com_type = 'INT'. t_receivers-notif_del = 'X'. t_receivers-notif_ndel = 'X'. APPEND t_receivers. endloop. 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 = it_mess_att contents_txt = it_mess_bod 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. WAIT UP TO 5 SECONDS. SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN. ENDFORM. " send_mail

    good answer

Maybe you are looking for

  • Supplier Process chain issue

    Hello, We loaded supplier(LSUPPLIER) from ECC to SPM. The data got loaded to PSA and info objects. But when I release the supplier load, the process chain is running for last 7 hours. We had same issue in QA where it ran for almot 2 days and even aft

  • EXIT_SAPLMEREQ_010

    i have put certain check in the User Exit EXIT_SAPLMEREQ_010, it works finr and if any of my below condition fails it gives error, but when i want to rectify that error all my screen become un-editable and i am not able to edit any record instaed i h

  • What do ya do when the software your attempting to download is mis-configured?

    I have adobe photoshop elements 8 and tried to install Adobe Photoshop Inspiration Browser and I get an error message that the installer is mis-configured.  I'm referring to Adobe Photoshop Inspiration Browser.

  • Same id for two users

    Hi, Is it possible to have same ID for two different users?  ID http://forums.sdn.sap.com/profile.jspa?userID=3882846  is not me.  Thanks

  • Bluetooth Adapter can't be found

    I have a kensington BT adaptor which seems to be recognized just fine by WinXP, however I was looking at the Simple BT Server.vi and noticed that it wouldn't work. It gave me this error, "LabVIEW: The network function is not supported by the system."