Using the FM SO_NEW_DOCUMENT_ATT_SEND_API1

Hi Gurus,
I am using the FM SO_NEW_DOCUMENT_ATT_SEND_API1.
My requirement needs me to email an attachment.
Why is it that when I input
A
B
C
in my table, the value I am getting is
A                         B                        C
wherein I should get an attachment that should look like this one
A
B
C
My output file is a TXT file. I understand that this is using the CONTENT_BIN that uses the binary format.
What I need is an attachment that is using the ASCII format. But when I use the ASCII format, I am getting an error: "error occurred during sending !".
Do I need to make enhacements on the FM?
Thanks in advance.
Benedict

Hi Benedict,
Please refer to the below code.
Program:  ZRAT                 Creation Date: 12.04.2007 *
Program Title :  Retirement Age Trigger                  *
Program Author:  Puneet Jhari                            *
Program Type  :   Executable                             *
Object ID     :                                          *
Technical Specification Version:                         *
Technical Specification Author:                          *
Code Quality Reviewer     :                              *
Transport No.          :  SRDK906499                     *
Program Description:                                     *
Inputs                                                   *
   Tables:                                               *
   Parameters                                            *
   External files:                                       *
Outputs                                                  *
   Reports:                                              *
   Tables:                                               *
   Databases:                                            *
   Screens:                                              *
   Parameters                                            *
   External files:                                       *
   Other objects:                                        *
Return codes set by ABAP:                                *
Modification Informaion                                  *
Program Version:                                         *
Date         : DD-MMM-YYYY                               *
Author       :                                           *
Description  :                                           *
Transport No.:                                           *
REPORT  zrat NO STANDARD PAGE HEADING.
*DATA DECLARATION
DATA : BEGIN OF wa_ccode,
        bukrs TYPE t001-bukrs,
       END OF wa_ccode.
DATA : itab_ccode LIKE TABLE OF wa_ccode.
DATA : BEGIN OF wa_emp,
        pernr TYPE pa0001-pernr,
        sachp TYPE pa0001-sachp,
        sname TYPE pa0001-sname,
       END OF wa_emp.
DATA : itab_emp LIKE TABLE OF wa_emp.
DATA : BEGIN OF wa_bdate,
        nachn LIKE pa0002-nachn,
        vorna LIKE pa0002-vorna,
        pernr TYPE pa0002-pernr,
        gbdat TYPE pa0002-gbdat,
       END OF wa_bdate.
DATA : itab_bdate LIKE TABLE OF wa_bdate.
DATA : new_date LIKE sy-datum.
DATA : diff TYPE i.
DATA : years LIKE p0347-scryy,
       months LIKE p0347-scrmm,
       days LIKE p0347-scrdd.
DATA : sup_code LIKE pa0001-sachp,
       itab_usrid LIKE t526-usrid,
       sup_pernr LIKE pa0105-pernr.
DATA : BEGIN OF wa_email,
       usrid_long LIKE pa0105-usrid_long,
       END OF wa_email.
DATA : sup_email LIKE TABLE OF wa_email.
DATA : gwa_document_data LIKE sodocchgi1,
       gc_name  TYPE so_obj_nam VALUE 'RETIREMENT',
       gc_senst TYPE so_obj_sns VALUE 'P',
       gc_size  TYPE so_doc_siz VALUE '510',
       gi_obj_cnt LIKE TABLE OF solisti1 WITH HEADER LINE,
       gi_recievers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
       gwa_obj_cnt LIKE LINE OF gi_obj_cnt.
DATA : smtp_addr LIKE adr6-smtp_addr.
DATA : wa_date LIKE sy-datum,
       entries LIKE sy-tabix,
       name(15),
       line1(18) TYPE c,
       line2(20) TYPE c,
       line3(20) TYPE c,
       line4(23) TYPE c,
       line5(10) TYPE c,
       line6(45) type c,
       date(2) TYPE c,
       month(2) TYPE c,
       year(4) TYPE c.
*START OF SELECTION
SELECT bukrs
FROM t001
INTO TABLE itab_ccode
WHERE land1 EQ 'GB'.
SORT itab_ccode.
DELETE ADJACENT DUPLICATES FROM itab_ccode.
SELECT pernr sachp sname
FROM pa0001
INTO TABLE itab_emp
FOR ALL ENTRIES IN itab_ccode
WHERE bukrs EQ itab_ccode-bukrs AND begda LE sy-datum AND
endda GE sy-datum and persg eq '1'.
SELECT nachn vorna pernr gbdat
FROM pa0002
INTO TABLE itab_bdate
FOR ALL ENTRIES IN itab_emp
WHERE pernr EQ itab_emp-pernr.
*TO CHECK EMPLOYEES WHOSE AGE IS NEAR 75 YEARS.
LOOP AT itab_bdate INTO wa_bdate.
  new_date = wa_bdate-gbdat.
*TO CALCULATE THE AGE TILL DATE
  CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
    EXPORTING
      date1                         = sy-datum
      date2                         = new_date
     output_format                 = '05'
   IMPORTING
     years                         = years
     months                        = months
     days                          = days
  IF sy-subrc <> 0.
  ENDIF.
  IF years EQ 64 AND months EQ 4.
    IF days GE 23 AND days LE 31.
*FETCH THE DATA IF THE AGE IS NEARING 75 YEARS
      SELECT SINGLE sachp FROM pa0001 INTO sup_code WHERE pernr EQ
      wa_bdate-pernr AND begda LE sy-datum AND endda GE sy-datum.
      SELECT SINGLE usrid FROM t526 INTO itab_usrid WHERE sachx EQ
      sup_code.
      SELECT SINGLE pernr FROM pa0105 INTO sup_pernr WHERE usrid EQ
      itab_usrid AND subty EQ '0001'.
      clear sup_email[].
      SELECT usrid_long FROM pa0105 INTO TABLE sup_email WHERE pernr EQ
      sup_pernr AND subty EQ '0010'.
*EMAIL ADDRESS OF THE SUPERVISOR TO BE NOTIFIED
      CLEAR gi_obj_cnt.
      CLEAR gi_recievers.
      CLEAR gwa_document_data.
      Loop at sup_email into wa_email.
      write sy-uline+0(5).
      write sy-uline+10(5).
      write sy-uline+20(5).
      write sy-uline+30(5).
      write sy-uline+40(5).
      write sy-uline+50(5).
      write sy-uline+60(5).
      write sy-uline+70(5).
      smtp_addr = wa_email-usrid_long.
      gi_recievers-receiver = smtp_addr.
      gi_recievers-rec_type = 'U'.
      gi_recievers-com_type = 'INT'.
      APPEND gi_recievers.
      Endloop.
      smtp_addr = '[email protected]'.
      gi_recievers-receiver = smtp_addr.
      gi_recievers-rec_type = 'U'.
      gi_recievers-com_type = 'INT'.
      APPEND gi_recievers.
      gwa_document_data-obj_name    = gc_name.
      gwa_document_data-obj_descr   = 'RETIRE'.
      gwa_document_data-sensitivty  = gc_senst.
      gwa_document_data-obj_langu = sy-langu.
*CONTENT OF THE EMAIL TO BE SENT
      line1 = 'Please note that  '.
      line2 = wa_bdate-vorna.
      line3 = wa_bdate-nachn.
      line4 = ' will be 65 years on  '.
      line50(4) = wa_bdate-gbdat4(4).
      date = line5+2(2).
      month = line5+0(2).
      year = wa_bdate-gbdat+0(4) + 65.
      CONCATENATE date month year INTO line5 SEPARATED BY '.'.
      line6 = '.Please complete the Retirement Procedure.'.
      CONCATENATE line1 line2 line3 line4 line5 line6 INTO gwa_obj_cnt
      SEPARATED BY space.
      APPEND gwa_obj_cnt TO gi_obj_cnt.
      CLEAR gwa_obj_cnt.
      DESCRIBE TABLE gi_obj_cnt LINES entries.
      READ TABLE gi_obj_cnt INDEX entries.
gwa_document_data-doc_size = ( entries - 1 ) * 255 + STRLEN( gi_obj_cnt
*FUNCTION MODULE TO SEND THE EMAIL TO THE CONCERNED PERSONS
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
  EXPORTING
    document_data                    = gwa_document_data
    document_type                    = 'RAW'
         commit_work                      = 'X'
        TABLES
         object_content                   = gi_obj_cnt
          receivers                        = gi_recievers
  EXCEPTIONS
         too_many_receivers               = 1
         document_not_sent                = 2
         document_type_not_exist          = 3
         operation_no_authorization       = 4
         parameter_error                  = 5
         x_error                          = 6
         enqueue_error                    = 7
         OTHERS                           = 8
*MESSAGE TO BE DISPLAYED AFTER THE EXECUTION
     endif.
      CASE sy-subrc.
        WHEN 0.
          LOOP AT gi_recievers.
            IF gi_recievers-receiver = space.
              name = gi_recievers-rec_id.
            ELSE.
              name = gi_recievers-receiver.
            ENDIF.
            IF gi_recievers-retrn_code = 0.
              WRITE: / name, ': succesfully sent'.
            ELSE.
              WRITE: / name, ': error occured'.
            ENDIF.
          ENDLOOP.
        WHEN 1.
          WRITE: / 'Too many receivers specified !'.
        WHEN 2.
          WRITE: / 'No receiver got the document !'.
        WHEN 4.
          WRITE: / 'Missing send authority !'.
        WHEN OTHERS.
          WRITE: / 'Unexpected error occurred !'.
      ENDCASE.
    ENDIF.
  ENDIF.
ENDLOOP.
In case you have any further clarifications,do let me know.
Regards,
Puneet Jhari.

Similar Messages

  • Problem using the FM SO_NEW_DOCUMENT_ATT_SEND_API1

    Hii All,
    In the function module SO_NEW_DOCUMENT_ATT_SEND_API1, in the Tables tab, the parameter CONTENTS_BIN like SOLISTI1 uses a field LINE of 255 characters length. The table-type parameter which is passed to CONTENTS_BIN in my program has the field LINE of length 125 characters only. But in the output, the attachment has rest of the characters (255-125=130) blank. I want my attachment to contain lines of width 125 characters only. How to go with it.Hope the problem is understood.
    Thanks in advance.
    Abdul.

    Hi,
    There is nothing much we can do for this.
    You will have to adjust the length of the LINE to wrap mor text into it.
    Hope it helps..
    Regards,
    Shashank

  • Giving name to the file SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi all,
    I am trying to use the FM - SO_NEW_DOCUMENT_ATT_SEND_API1 for creating the attachment.I am able send the attachment. 
    Problems -
    But along with the attachment the content is also going as mail content. I want to avoid it.
    I could not attach name to the file attachment.
    How can i over come these issues.
    Srikar

    Hi,
    Check this link.In this, for attaching smartform output,I am also using the function module.Have a look at this.
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/smartforms/smartform in abap.pdf

  • Having attachment instead of using the body (email)

    Hi Gurus,
    I am having a problem regarding the email. I am using the FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    Instead of putting the data to the body of the email, it is creating a file named MESSAGE1.PDF and putting the data inside the attached file.
    Anyone knows why this is happening?
    This is the sample code.
        wa_objpack-doc_type   = c_raw.
        APPEND wa_objpack TO it_objpack.
    Only the doc_type has value.
    Thanks in advance.
    Benedict

    Hi All,
    Thanks for the response.
    Actually, the requirement I should attach an attachment.
    The problem is, there is another attachement that is being sent. And the data is the same with the expected attachment file.
    Example.
    Message1.dat
    Filenam.dat
    Message1.dat has the same data compared with Filename.dat. But I am expecting only the Filename.dat to appear. So there is an extra Message1.dat file attached.
    I have checked the int table of pack. Only the doc_type has value = 'RAW'. Nothing else.
    Thanks in advance.
    Benedict.

  • How to include body of the mail along with attachment using the below FM

    Hi All,
    I am using the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to generate an e-mail with excel file as attachment. Can you please  let me know how to include body of the e-mail along with this attachment.
    Thanks & Regards
    Gowthami

    hi,
    see this code
    TABLES: apqi.                         "Queue info definition
    TYPES DECLARATION
    *& Global Types
    TYPE-POOLS: slis,                     "Type for alv list
                sx.                       "SAP connect
    TYPE-POOLS: list.
    *& Types
    TYPES: BEGIN OF s_itab_apqi.
            INCLUDE STRUCTURE apqi.
    TYPES: END OF s_itab_apqi.
               INTERNAL TABLE / WORK AREA DECLARATION             *
    *&  For email  attachment
    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:   it_packing_list  LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            it_contents      LIKE solisti1 OCCURS 0 WITH HEADER LINE  ,
            it_receivers     LIKE somlreci1 OCCURS 0 WITH HEADER LINE ,
            it_attachment    LIKE solisti1 OCCURS 0 WITH HEADER LINE  ,
            it_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE  .
    DATA:   v_cnt            TYPE i                                   ,
            v_sent_all(1)    TYPE c                                   ,
            v_doc_data       LIKE sodocchgi1                          ,
            gd_error         TYPE sy-subrc                            ,
            gd_reciever      TYPE sy-subrc                            .
    DATA: p_email   TYPE somlreci1-receiver
                                 VALUE 'mail id here of the reciever'.
    *&   Variable for attachment name
    DATA: v_attach(12).
    *&   Internal table to get data from apqi table
    table here
    DATA: ws_line TYPE slis_listheader.
    DATA: it_list_top_of_page TYPE slis_t_listheader.
    CONSTANTS : v_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    VARIABLE DECLARATION
    DATA: v_colpos        TYPE i.
    DATA: v_transcnt(10)  TYPE c,
          v_transcnte(10) TYPE c,
          v_transcntf(10) TYPE c,
          v_msgcnt(10)    TYPE c,
          v_qid(20)       TYPE c.
    DATA  v_tot_rec(3)    TYPE n.
    DATA :v_date(10) TYPE c,
          v_time(8) TYPE c .
    DATA: v_fromdate(10) .
    DATA: v_todate(10) .
    SELCTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-015.
    PARAMETERS:
    SELECTION-SCREEN END OF BLOCK blk1.
    AT SELCTION SCREEN
    AT SELECTION-SCREEN.
      IF p_dfrom IS INITIAL AND
         NOT p_dato IS INITIAL.
        MESSAGE e000(zp) WITH text-020.
      ENDIF.
    START OF SELECTION
    START-OF-SELECTION.
    *&  To get data from APQI table into internal table
      PERFORM populate_itab.
    **To Populate table with details to be entered into .xls file
      PERFORM build_xls_data_table.
    END OF SELECTION
    END-OF-SELECTION.
    *& To display ALV list when IT_APQI is not initial
      IF NOT it_apqi[] IS INITIAL.
    *&-- Send an Notification email
        PERFORM send_email .
    *&--To populate fields for ALV
        PERFORM build_fieldcat   .
        PERFORM build_eventcat   .
        PERFORM e04_comment_build  USING it_list_top_of_page[].
        PERFORM build_layout     .
        PERFORM build_sortcat    .
        PERFORM start_list_viewer.
      ELSE.
    *&-- If no record exists in IT_APQI internal table then message is displayed
        MESSAGE s000(zp) WITH text-021.
      ENDIF.
    FORMS **********************************
    populate itab here -
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  BUILD_EVENTCAT
    FORM build_eventcat .
      DATA: v_header(25) .
      CONCATENATE 'ZPIPY016' p_dfrom p_dato INTO v_header.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = it_eventcat[]
        EXCEPTIONS
          list_type_wrong = 1
          OTHERS          = 2.
      READ TABLE it_eventcat WITH KEY name = slis_ev_top_of_page
                                 INTO wa_eventcat.
      IF sy-subrc = 0.
        MOVE v_formname_top_of_page TO wa_eventcat-form.
        APPEND wa_eventcat TO it_eventcat.
      ENDIF.
    ENDFORM.                    " BUILD_EVENTCAT
    *&      Form  BUILD_LAYOUT
    FORM build_layout .
      ws_layout-no_keyfix           = 'X'.
      ws_layout-group_buttons       = 'X'.
      ws_layout-colwidth_optimize   = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  BUILD_SORTCAT
    FORM build_sortcat .
      CLEAR wa_sortcat.
      CLEAR v_colpos.
    ENDFORM.                    " BUILD_SORTCAT
    *&      Form  START_LIST_VIEWER
    FORM start_list_viewer .
      DATA: ws_pgm  LIKE sy-repid.
    *& To Display ALV list
      ws_pgm = sy-repid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = ws_pgm
          is_layout          = ws_layout
          it_fieldcat        = it_fieldcat
          it_sort            = it_sortcat
          i_save             = 'A'
          it_events          = it_eventcat
        TABLES
          t_outtab           = it_apqi
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    ENDFORM.                    " START_LIST_VIEWER
    *&      Form  BUILD_XLS_DATA_TABLE
    FORM build_xls_data_table .
      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.
    *& To populate it_attach table to be send as email.
      CONCATENATE 'Error of transaction SM35' ' '
         INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
    *& To gettotal number of error records
      DESCRIBE TABLE it_apqi LINES v_tot_rec .
      CONCATENATE  'Number of Errors  = '  v_tot_rec
                INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      CONCATENATE text-001
                  text-002
                  text-003
                  text-004
                  text-005
                  text-006
                  text-007
                  text-008
                  text-009
                  text-010
                  text-011
                  text-012
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
    *& To populate it_attach from it_apqi
      LOOP AT it_apqi INTO wa_apqi.
    *& To get the date format in DD/MM/YYYY
        WRITE wa_apqi-credate TO v_date  DD/MM/YYYY.
    *& To get time format in hh:mm:ss.
        v_time = wa_apqi-cretime.
        CONCATENATE  v_time(2) ':' v_time2(2) ':' v_time4(2) INTO v_time.
        v_transcnt  = wa_apqi-transcnt.
        v_transcnte = wa_apqi-transcnte.
        v_transcntf = wa_apqi-transcntf.
        v_msgcnt    = wa_apqi-msgcnt.
        v_qid       = wa_apqi-qid.
        CONCATENATE wa_apqi-groupid wa_apqi-creator
                         wa_apqi-qstate v_date
                         v_time wa_apqi-progid
                         wa_apqi-userid  v_transcnt
                         v_transcnte v_transcntf
                         v_msgcnt v_qid
                   INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach  .
        CLEAR   it_attach  .
        CLEAR:  v_transcnt ,
                v_transcnte,
                v_transcntf,
                v_msgcnt   ,
                v_qid      ,
                v_date     ,
                v_time     .
      ENDLOOP.
    ENDFORM  .                    " BUILD_XLS_DATA_TABLE
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
    FORM populate_email_message_body .
      REFRESH it_message.
      it_message = 'message here'.
      APPEND it_message.
      CLEAR it_message.
    ENDFORM.                    " POPULATE_EMAIL_MESSAGE_BODY
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    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.
      v_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      v_doc_data-obj_langu = sy-langu.
      v_doc_data-obj_name  = 'SAPRPT'.
      v_doc_data-obj_descr = ld_mtitle .
      v_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR v_doc_data.
      READ TABLE it_attach INDEX v_cnt.
      v_doc_data-doc_size =
         ( v_cnt - 1 ) * 255 + STRLEN( it_attach ).
      v_doc_data-obj_langu  = sy-langu.
      v_doc_data-obj_name   = 'SAPRPT'.
      v_doc_data-obj_descr  = ld_mtitle.
      v_doc_data-sensitivty = 'F'.
      CLEAR it_attachment.
      REFRESH it_attachment.
      it_attachment[] = pit_attach[].
    Describe the body of the message
      CLEAR it_packing_list.
      REFRESH it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      APPEND it_packing_list.
    Create attachment notification
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num   = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.
      it_packing_list-doc_type   =  ld_format.
      it_packing_list-obj_descr  =  ld_attdescription.
      it_packing_list-obj_name   =  ld_attfilename.
      it_packing_list-doc_size   =  it_packing_list-body_num * 255.
      APPEND it_packing_list.
    Add the recipients email address
      CLEAR it_receivers.
      REFRESH it_receivers.
      it_receivers-receiver = ld_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      APPEND it_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = v_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                = v_sent_all
        TABLES
          packing_list               = it_packing_list
          contents_bin               = it_attachment
          contents_txt               = it_message
          receivers                  = it_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 it_receivers.
        ld_receiver = it_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.                    " SEND_FILE_AS_EMAIL_ATTACHMENT
    *&      Form  SEND_EMAIL
    FORM send_email .
    Populate message body text
      PERFORM populate_email_message_body.
      PERFORM send_file_as_email_attachment
                                   TABLES it_message
                                          it_attach
                                    USING p_email
                                          'Error Sessions from SM35'
                                          'XLS'
                                          'filename'
                                          v_attach
                                 CHANGING gd_error
                                          gd_reciever.
    ENDFORM.                    " SEND_EMAIL
    *&      Form  E04_COMMENT_BUILD
          text
         -->E04_LT_TOP_OF_PAGE  text
    FORM e04_comment_build USING lt_top_of_page TYPE slis_t_listheader.
      CLEAR: v_fromdate,
             v_todate.
      WRITE p_dfrom TO v_fromdate  DD/MM/YYYY.
      WRITE p_dato TO  v_todate    DD/MM/YYYY.
    *& To write header in ALV list
    *& Program name
      CLEAR ws_line.
      ws_line-typ  = 'H'.
      ws_line-info = text-016.
      APPEND ws_line TO lt_top_of_page.
      CLEAR ws_line.
      ws_line-typ  = 'S'.
      ws_line-key = text-018.
      ws_line-info = v_tot_rec.
      APPEND ws_line TO lt_top_of_page.
    *& Date from
      CLEAR ws_line.
      ws_line-typ  = 'S'.
      ws_line-key  = text-050.
      ws_line-info = v_fromdate.
      APPEND ws_line TO lt_top_of_page.
    *& Date to
      CLEAR ws_line.
      ws_line-typ  = 'S'.
      ws_line-key  = text-051.
      ws_line-info = v_todate.
      APPEND ws_line TO lt_top_of_page.
    ENDFORM.                    "E04_COMMENT_BUILD
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
    *& To write Heading in Top of page
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_list_top_of_page.
    ENDFORM.                    "TOP_OF_PAGE
    thanks

  • How to use the output types e-mail in script?and other output types

    how to e -mail a script?and fax?

    hi,
    check the example
    Just try by using the below code may be it will helpful to you.
    REPORT Z_RMTIWARI_SEND_SPOOL_MAIL_ATT .
    PARAMETERS : P_SPOOL TYPE TSP01-RQIDENT OBLIGATORY .
    PARAMETERS : P_MAIL TYPE char100 OBLIGATORY .
    TYPES : TY_LINE type string.
    DATA: IT_ATTACHMENT TYPE soli OCCURS 0 WITH HEADER LINE.
    DATA: IT_ATTACHMENT_LONG TYPE TY_LINE OCCURS 0 WITH HEADER LINE.
    DATA: LV_PDF_SIZE type i.
    DATA: LT_PDF type standard table of tline with header line.
    PERFORM SEND_EMAIL USING P_SPOOL P_MAIL.
    FORM send_email
    --> X_SPOOL_ID
    --> X_EMAIL
    FORM send_email USING X_SPOOL_ID X_EMAIL.
    DATA: LT_OBJPACK LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,
    LT_OBJHEAD LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    LT_OBJBIN LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    LT_OBJTXT LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    LT_RECLIST LIKE somlreci1 OCCURS 5 WITH HEADER LINE,
    LV_DOCUMENT_DATA TYPE sodocchgi1.
    DATA: L_ATT_LINES TYPE i.
    DATA : LV_SPOOL_DESC(68) type c.
    CHECK NOT ( X_EMAIL IS INITIAL ).
    CLEAR: LT_RECLIST, LT_RECLIST[],
    LT_OBJHEAD, LT_OBJHEAD[],
    LT_OBJTXT, LT_OBJTXT[],
    LT_OBJBIN, LT_OBJBIN[],
    LT_OBJPACK, LT_OBJPACK[].
    CLEAR LV_DOCUMENT_DATA.
    Read spool and get the pdf internal table and name of spool
    PERFORM READ_SPOOL USING X_SPOOL_ID LV_SPOOL_DESC.
    CHECK NOT ( LT_PDF[] IS INITIAL ).
    Convert pdf itab to 255 line itab.
    data :LV_COUNTER type i.
    data :LV_FROM type i.
    loop at LT_PDF.
    translate LT_PDF using ' ~' .
    concatenate IT_ATTACHMENT_LONG LT_PDF into it_attachment_long.
    endloop.
    translate IT_ATTACHMENT_LONG using '~ ' .
    append IT_ATTACHMENT_LONG.
    clear : LV_COUNTER.
    DO.
    LV_COUNTER = strlen( IT_ATTACHMENT_LONG ).
    if LV_COUNTER ge 255.
    IT_ATTACHMENT = IT_ATTACHMENT_LONG(255).
    append IT_ATTACHMENT.
    SHIFT IT_ATTACHMENT_LONG by 255 places.
    else.
    IT_ATTACHMENT = IT_ATTACHMENT_LONG(lv_counter).
    append IT_ATTACHMENT.
    exit.
    endif.
    ENDDO.
    Body of email
    MOVE 'Email sent to you from SAP' TO LT_OBJTXT.
    APPEND LT_OBJTXT.
    LV_DOCUMENT_DATA-obj_name = 'SpoolMail'.
    Title of the email as spool name
    LV_DOCUMENT_DATA-obj_descr = LV_SPOOL_DESC.
    LV_DOCUMENT_DATA-sensitivty = 'O'.
    LV_DOCUMENT_DATA-expiry_dat = SY-datum + 15.
    LV_DOCUMENT_DATA-doc_size = STRLEN( LT_OBJTXT ).
    e-mail body
    CLEAR LT_OBJPACK.
    LT_OBJPACK-head_start = 1.
    LT_OBJPACK-head_num = 0.
    LT_OBJPACK-body_start = 1.
    LT_OBJPACK-body_num = 1.
    LT_OBJPACK-doc_type = 'RAW'.
    LT_OBJPACK-doc_size = STRLEN( LT_OBJTXT ).
    APPEND LT_OBJPACK.
    For e-mail attachment
    DESCRIBE TABLE IT_ATTACHMENT LINES L_ATT_LINES.
    READ TABLE IT_ATTACHMENT INDEX L_ATT_LINES.
    CLEAR LT_OBJPACK.
    LT_OBJPACK-transf_bin = 'X'.
    LT_OBJPACK-head_start = 1.
    LT_OBJPACK-head_num = 1.
    LT_OBJPACK-body_start = 1.
    LT_OBJPACK-body_num = L_ATT_LINES.
    LT_OBJPACK-doc_type = 'PDF'.
    LT_OBJPACK-obj_name = 'email'.
    LT_OBJPACK-obj_descr = LV_SPOOL_DESC.
    LT_OBJPACK-doc_size = ( 255 * ( L_ATT_LINES - 1 ) ) + STRLEN( IT_ATTACHMENT-line ).
    APPEND LT_OBJPACK.
    make recipient list
    LT_RECLIST-receiver = X_EMAIL.
    LT_RECLIST-rec_type = 'B'. "To external email id
    APPEND LT_RECLIST.
    send mail with attachment
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = LV_DOCUMENT_DATA
    put_in_outbox = 'X'
    TABLES
    packing_list = LT_OBJPACK
    object_header = LT_OBJHEAD
    contents_bin = IT_ATTACHMENT
    contents_txt = LT_OBJTXT
    receivers = LT_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.
    write:/ 'Message sent'.
    else.
    write:/ 'Error encountered'.
    endif.
    ENDFORM. " send_email
    *& Form read_spool
    FORM read_spool USING X_SPOOL_ID Y_SPOOL_DESC.
    DATA : LV_SPOOL_TYPE TYPE TSP01-RQDOCTYPE.
    SELECT SINGLE RQDOCTYPE RQTITLE
    INTO (lv_spool_type, y_spool_desc)
    FROM TSP01
    WHERE RQIDENT eq X_SPOOL_ID.
    IF Y_SPOOL_DESC IS INITIAL.
    concatenate 'Spool-' X_SPOOL_ID into Y_SPOOL_DESC.
    ENDIF.
    IF LV_SPOOL_TYPE eq 'LIST'. " If spool is a list
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
    SRC_SPOOLID = X_SPOOL_ID
    NO_DIALOG =
    DST_DEVICE =
    PDF_DESTINATION =
    IMPORTING
    PDF_BYTECOUNT = LV_PDF_SIZE
    PDF_SPOOLID =
    LIST_PAGECOUNT =
    BTC_JOBNAME =
    BTC_JOBCOUNT =
    TABLES
    PDF = LT_PDF
    EXCEPTIONS
    ERR_NO_ABAP_SPOOLJOB = 1
    ERR_NO_SPOOLJOB = 2
    ERR_NO_PERMISSION = 3
    ERR_CONV_NOT_POSSIBLE = 4
    ERR_BAD_DESTDEVICE = 5
    USER_CANCELLED = 6
    ERR_SPOOLERROR = 7
    ERR_TEMSEERROR = 8
    ERR_BTCJOB_OPEN_FAILED = 9
    ERR_BTCJOB_SUBMIT_FAILED = 10
    ERR_BTCJOB_CLOSE_FAILED = 11
    OTHERS = 12
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ELSE. " If spool is OTF
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    SRC_SPOOLID = X_SPOOL_ID
    NO_DIALOG =
    DST_DEVICE =
    PDF_DESTINATION =
    IMPORTING
    PDF_BYTECOUNT = LV_PDF_SIZE
    PDF_SPOOLID =
    OTF_PAGECOUNT =
    BTC_JOBNAME =
    BTC_JOBCOUNT =
    TABLES
    PDF = LT_PDF
    EXCEPTIONS
    ERR_NO_OTF_SPOOLJOB = 1
    ERR_NO_SPOOLJOB = 2
    ERR_NO_PERMISSION = 3
    ERR_CONV_NOT_POSSIBLE = 4
    ERR_BAD_DSTDEVICE = 5
    USER_CANCELLED = 6
    ERR_SPOOLERROR = 7
    ERR_TEMSEERROR = 8
    ERR_BTCJOB_OPEN_FAILED = 9
    ERR_BTCJOB_SUBMIT_FAILED = 10
    ERR_BTCJOB_CLOSE_FAILED = 11
    OTHERS = 12
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    ENDFORM. " read_spool
    http://www.sap-img.com/abap/sending-fax-from-abap.htm
    http://www.sap-img.com/abap/sending-email-with-attachment.htm

  • Changes done in the FM SO_NEW_DOCUMENT_ATT_SEND_API1

    *In 4.7 The FM SO_NEW_DOCUMENT_ATT_SEND_API1 works  in the manner with the pattern by sending the mail with the data and a link but after upgrade to ECC6.0 the  same FM is sending the mail and the data in the form of an attachment which could not be opened with the extension .RAW .So kindly suggest us how to get the functionality in the same paatern as it use to be happen in ECC4.7.*

    Hi,
    Please try this Function Module : QM06_FM_TASK_SEND_PAPER
    Some of Useful Links:
    Send email from activity step type
    Alternative Function Module to 'SO_NEW_DOCUMENT_ATT_SEND_API1' for mails
    SO_NEW_DOCUMENT_ATT_SEND_API1 Attachment Name length
    Thanks,
    AMS

  • How to delete the members in one dimension use the maxl script

    i have question that i want to delete the members in one dimension useing the maxl script, but i do not know how to do it. can the maxl delete the members in one dimension? if can, please provide an sample script, thank you so mcuh.

    MaxL does not have commands to alter an outline directly, except the reset command which can delete all dimensions but not members selectively. The best you could do would be to run a rules file (import dimensions) using a file that contains the members you want to keepload rule for the dimension. As typical the warning is to test this first before you do it on a production database

  • How can multiple users use the same Creative Cloud Individual on one single-machine?

    We have one shared graphics workstation, which is infrequently in use by different people - therefore we bought a single-workstation license (which we were referred to "Creative Cloud Individual"). In the FAQs it says it installs locally, but whenever a user different from the installing adminstrator logs in, he is forced to use the trial.
    Is there a way to make the local installation usable on that single machine for multiple users?
    Thanks in advance for your reply

    Serenatasystems do the other users not have administrator access?  What happens if they sign in using the Adobe ID tied to your Creative Cloud subscription?  Do your Adobe Creative applications then exit trial mode?

  • What happens on iCloud (ex. contacts) when multiple family members use the same Apple ID?

    What happens on iCloud when multiple family members use the same Apple ID?  For example if we all choose to use iCloud for contacts, are they all merged together?  We use the same Apple ID so we can use find my iPhone to keep track of the whole family.

    Of course if you are both connected to the same iCloud account you have the same contacts - what did you expect?. The contacts live on the server and are read from there by the devices; so as you've both managed to sync your contacts up to iCloud they are now inextricably mixed. You can only delete your contacts by deleting individual ones, and doing that will delete them from your phone as well.
    You can only unravel this by
    1. In the iCloud contacts page at http://icloud.com, select all the contacts, click on the cogwheel icon at bottom left and choose 'Export vCard'.
    2. Sign out of System Preferences>iCloud
    3. Create a new Apple ID and open a new iCloud account with it for your own use.
    4. Import the vCard back into the iCloud contacts page.
    5. Go to http://icloud.com and sign in with the original ID. This is now his ID. Work through the contacts individually deleting the ones you don't want him to have. When done sign out and advise him to change his password.
    6. Go to the new iCloud account and delete his contacts individually.
    Of course if you have also been syncing calendars and using the same email address there are problems with doing this.

  • Cannot send email from Verizon to a specific domain using the web UI

    I'm trying to send an email to a specific address on a domain I own from a Verizon account using the web UI. Whenever I click send, a popup appears saying "Your e-mail contains the following invalid e-mail addresses:" followed by the email address. I can send email to this address from a GMail account as well as my work email.
    In Chrome, I can see that a "code":1002 error is being produced.
    Does anyone know why this would happen? Does Verizon check destination domains for reputation? Is there any way to debug this further?

    rhodeislandred wrote:
    I'm trying to send an email to a specific address on a domain I own from a Verizon account using the web UI. Whenever I click send, a popup appears saying "Your e-mail contains the following invalid e-mail addresses:" followed by the email address. I can send email to this address from a GMail account as well as my work email.
    In Chrome, I can see that a "code":1002 error is being produced.
    Does anyone know why this would happen? Does Verizon check destination domains for reputation? Is there any way to debug this further?
    What is the domain that is giving you the error?

  • How do I use the Japanese fonts in Font Book in a Pages document?

    How does one use the Japanese fonts in Font Book in a Pages document. Pages has its own fonts but I cannot get the Japanese fonts into it.

    To type japanese on a computer you change the keyboard, not the font.  Go to system prefs/keyboard/input sources and add Japanese/Kotoeri to the list, then select Hiragana in the "flag" menu at the top right of the screen, then type.  The font will take care of itself.
    http://redcocoon.org/cab/mysoft.html
    If you have any further questions, just ask.

  • How do I use the Web module to upload video to my website?

    I'm using the Lightroom HTML gallery to upload my photos, fine and dandy, very happy with it. I also have some videos trimmed in Lightroom that I want incorporated into the gallery. This doesn't seem to be happening, instead I just get thumbnails. What/how do I incorporate my video clips into my web gallery? I moved over from jAlbum so I could have a simple one-tool workflow, so I'm really hoping that this is possible.

    You can combine stills and video for output to h.264 (mp4 file) for example to upload to Youtube or Vimeo.
    FTP upload will be subject to the limitations of your host. The web module within Lightroom creates all resources to link to the file index.html
    The forthcoming LR6 is anticipated to have HTML5 galleries.

  • How do I use the web cam on my pc? Hp w2007 I have windows vista

    How do I use the web cam on my pc?  Hp w2007 I have windows vista

    Hp w2007 is a HP monitor without webcam ...
    Where is the webcam?
    V.
    *** Say 'Thanks' with Kudos ***

  • Previewing an image before uploading it using the FileReference class

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

Maybe you are looking for

  • Old exchange server 2007 accounts conflicting with Office365 accounts after migration to the cloud

    Good day, We migrated over a month ago from Exchange 2007 to office 365 We have to offices in two different continents, under one single domain. Office in central America, has it's own IMAP web service hosted on 42inc (jondoe@ cenamer .com), Office i

  • ITunes greying out an album

    I purchased an album off my iPhone using iTunes last night and now I can't get it to open in iTunes on my computer.  It shows the album, but it's greyed out and I can't play any of the music.  I have my settings set to sync all of my music to my phon

  • A Question while Upgrading..

    i thought about upgrading database for 8.1.7.4 to 11.2.0.2 , the thing is if someone had very low system and OS requirements, what if they wanted to upgrade to some other version, other than the upgrade path that is mentioned in metalink, which can r

  • How to call webservices in as3 (flash) and get its response

    Hello     I need to know how to call webservices in flash cs5 as3 and how to track its response. any example ? Thanks Avneet

  • Bringing in after effects animation .mov file

    Hi... I am really confused about this one.. I rendered an After Effects file, set to using the animation compression settings, quicktime, 29.97 frame rate... I bring it into FCP, and it gives me a red needs render bar.. I have my sequence settings to