FM SO_NEW_DOCUMENT_ATT_SEND_API1 problem

Hi experts,
        I am using SO_NEW_DOCUMENT_ATT_SEND_API1 FM to send a mail to vendors....this is the logic they have written..
LT_MAIL1[]  having 4 mails id's...but problem is mail is not going.... can any body plz help me...
DATA: LT_MAIL1 LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
IF LT_CONTENT[] IS NOT INITIAL AND LT_MAIL1[] IS NOT INITIAL.
       LOOP AT lt_mail1.
          CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
            EXPORTING
              DOCUMENT_DATA              = LV_DOC_HEADER       "subject of message
              PUT_IN_OUTBOX              = 'X'
              COMMIT_WORK                = 'X'
            TABLES
              PACKING_LIST               = OBJPACK
              OBJECT_HEADER              = OBJHEAD              "file name
              CONTENTS_BIN               = OBJBIN               "attachment content
              CONTENTS_TXT               = OBJTXT
              RECEIVERS                  = LT_MAIL1             "Mail id
            EXCEPTIONS
              TOO_MANY_RECEIVERS         = 1
              DOCUMENT_NOT_SENT          = 2
              OPERATION_NO_AUTHORIZATION = 4
              OTHERS                     = 99.
          IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ELSE.
            MESSAGE S000(MES).
          ENDIF.
       ENDLOOP.
        ENDIF.
      ENDIF.
Thanks & regards,
Praveena..

Hope you can try this way:
DATA l_sender TYPE soextreci1-receiver.
  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      document_data              = v_emailattr
      put_in_outbox              = 'X'
      sender_address             = l_sender
      sender_address_type        = 'INT'
      commit_work                = 'X'
    TABLES
      packing_list               = it_objpack
      object_header              = it_objhead
      contents_bin               = it_objbin
      contents_txt               = it_objtxt
      receivers                  = it_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
Edited by: K.Manas on Dec 15, 2010 10:56 AM

Similar Messages

  • SO_NEW_DOCUMENT_ATT_SEND_API1- problem in mail text

    Hi All,
    I am using FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send emails.
    I have taken the reference program from the documentation of this function module given by SAP.
    I want to send two attachments in text format using this FM and I am able to send the same.
    The problem I am facing is that every character of text is seprated by one space. i.e. between any two characters one space is inserted in the attachement.
    e.g. if I need to display :::
    "This is test mail" -->
    I am gettting the output as
    "T h i s  i s  t e s t  m a i l".
    Is there any parameter which I need to set to avoid this problem.
    Any input would be highly appreciated.
    regards,
    Lalit

    Hi,
    I tried the solutions given to me but I am sorry to say that still my problem persists.
    I am pasting my test code below. Request your help.
    Regards,
    Lalit
    REPORT  ZTEST_LALIT2.
    DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS  2 WITH HEADER LINE.
    DATA: OBJHEAD LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE.
    DATA: OBJBIN  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
    DATA: OBJBIN1  type soli_tab. "   OCCURS 10 WITH HEADER LINE.
    DATA: OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
    DATA: RECLIST LIKE SOMLRECI1  OCCURS  5 WITH HEADER LINE.
    DATA: DOC_CHNG LIKE SODOCCHGI1.
    DATA: TAB_LINES LIKE SY-TABIX.
    Creating the document to be sent
    DOC_CHNG-OBJ_NAME = 'OFFER'.
    DOC_CHNG-OBJ_DESCR = 'Auction of a Picasso jr'.
    OBJTXT = 'Reserve price : $250000'.
    APPEND OBJTXT.
    OBJTXT = 'A reproduction of the painting to be auctioned'.
    APPEND OBJTXT.
    OBJTXT = 'is enclosed as an attachment.'.
    APPEND OBJTXT.
    DESCRIBE TABLE OBJTXT LINES TAB_LINES.
    READ TABLE OBJTXT INDEX TAB_LINES.
    DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creating the entry for the compressed document
    CLEAR OBJPACK-TRANSF_BIN.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM   = 0.
    OBJPACK-BODY_START = 0.
    OBJPACK-BODY_NUM   = TAB_LINES.
    OBJPACK-DOC_TYPE   = 'RAW'.
    APPEND OBJPACK.
    Creating the document attachment
    (Assume the data in OBJBIN are given in BMP format)
    OBJBIN = 'This is a test mail'. condense objbin. APPEND OBJBIN.
    OBJBIN = '  |  '. APPEND OBJBIN.
    OBJBIN = 'test '. APPEND OBJBIN.
    DESCRIBE TABLE OBJBIN LINES TAB_LINES.
    OBJHEAD = 'picasso.txt'. APPEND OBJHEAD.
    Creating the entry for the compressed attachment
    OBJPACK-TRANSF_BIN = 'X'.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM   = 1.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM   = TAB_LINES.
    OBJPACK-DOC_TYPE   = 'TXT'.
    OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
    OBJPACK-OBJ_DESCR = 'Reproduction object 138'.
    OBJPACK-DOC_SIZE   = TAB_LINES * 132.
    APPEND OBJPACK..
    CALL FUNCTION 'QCE1_CONVERT'
            TABLES
              t_source_tab         = OBJBIN
              t_target_tab         = OBJBIN1[]
            EXCEPTIONS
              convert_not_possible = 1
              OTHERS               = 2.
    Entering names in the distribution list
    RECLIST-RECEIVER = 'LALITK'.
    RECLIST-REC_TYPE = 'B'.
    APPEND RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         EXPORTING
              DOCUMENT_DATA = DOC_CHNG
              PUT_IN_OUTBOX = 'X'
              COMMIT_WORK   = 'X'
         TABLES
              PACKING_LIST  = OBJPACK
              OBJECT_HEADER = OBJHEAD
              CONTENTS_BIN  = OBJBIN1[]
              CONTENTS_TXT  = OBJTXT
              RECEIVERS     = RECLIST
         EXCEPTIONS
              TOO_MANY_RECEIVERS = 1
              DOCUMENT_NOT_SENT  = 2
              OPERATION_NO_AUTHORIZATION = 4
              OTHERS = 99.

  • SO_NEW_DOCUMENT_ATT_SEND_API1 - problem after Unicode

    Hi experts, I'm using SO_NEW_DOCUMENT_ATT_SEND_API1 to create an email with an attached report.  Prior to Unicode upgrade, I had no problems with the attachment.  Now each line of the contents_bin atttachment wraps after 127 characters and the wrapped part is in Chinese!  Each line is 242 characters long so it shouldn't wrap.  Can somebody suggest what I can do to prevent both the wrapping and the change from English to Chinese from char 127 onwards.? Thanks.

    Hi Brigitte ,
    Please refer note : 190669.
    As I have faced the similar issue.
    The problem is with the upgradation.
    And due to upgradation, the internal logic of SO_NEW_DOCUMENT_ATT_SEND_API1 has been changed.
    So after referring the note : 190669.
    We have referred Program : BCS_EXAMPLE_# (# indicates 1-8) and updated my program with this example.
    I have referred BCS_EXAMPLE_5 to send the email notification with the attachment.
    Now sending email is easier comparing with the  SO_NEW_DOCUMENT_ATT_SEND_API1.
    As we DONT need to use PACKING LIST in this FM and
    its easy to use this example as we just need to pass required parameters like
    email body, subject line, receivers,attachment body,attachment name,etc., .
    Regards,
    Amit Linge.
    Edited by: Amit Ashok Linge on Jun 24, 2011 8:53 AM
    Edited by: Amit Ashok Linge on Jun 24, 2011 8:57 AM

  • SO_NEW_DOCUMENT_ATT_SEND_API1: problem with the attachment.

    Hi gurus!
    I have a problem when i send e-mail with the attachment with this function.
    I don't know why the object is blank.
    After execute the batch input I see the result in alv and i want to send this by e-mail, but...when I open the attachment there is nothing..
    Help me!
    Thanks!

    Hi,
    See this example and see if anything is missed in your code:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/mailsendthroughoutputcontrols
    Regards,
    Renjith Michael

  • Problem in sending the attachment using SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi,
    I have a requirement to send the details of an internal table to External mail as an attachment. I have used fn.module 'SO_NEW_DOCUMENT_ATT_SEND_API1' to do so. I am getting the attachment but the data is stored in only one row when we checked it in SAP outbox. This is irrespective of TXT, XLS etc. I can not check the exact file in my external mail inbox as the connection is not established in dev & Quality systems. This question was raised earlier by other guys and there was no correct answer provided. If any of you encountered this type of problem & got the solution please help.
    Thanks,
    Ashok

    Hi Buddy,
        Hope this piece of code will definately help you out, Its working at my end.
    Thanks,
    Krishna..
    FORM p_send_email .
      FIELD-SYMBOLS: <field> TYPE ANY.
      DATA : BEGIN OF i_dload OCCURS 0 ,
             dload(1000) ,
           END OF i_dload .
      DATA: it_receivers LIKE somlreci1 OCCURS 1 WITH HEADER LINE,
              w_object_content LIKE solisti1 OCCURS 1 WITH HEADER LINE.
      DATA: w_doc_data LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
      DATA :w_records TYPE zres_records.
      DATA: w_rsnum(10),
            w_bdmng(14),
            w_meins(4).
      DATA: ws_email LIKE adr6-smtp_addr.  "for internal e_mail address
      DATA: ws_email1 LIKE adr6-smtp_addr. "for external e_mail address
    *--Internal table declaration
      DATA: it_objpack   LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA: it_objhead   LIKE solisti1 OCCURS 1 WITH HEADER LINE.
      DATA: it_objbin    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
      DATA: it_objtxt    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
      DATA: it_reclist   LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
      DATA: doc_chng  LIKE sodocchgi1.
      DATA: tab_lines LIKE sy-tabix.
      DATA: w_longtext(500) TYPE c.
      DATA: v_date(10) TYPE c.
      DATA: text(200)  TYPE c.
      DATA: w_text(50) TYPE c.
    *--Get receipient address
      CLEAR it_reclist.
    *--To send error to internal mail
      ws_email = p_email.
    *--To send error to external mail
      ws_email1 = p_email1.
    *---setting name of file for csv
      CONCATENATE text-003 p_bdoc text-004 INTO w_filename.
      CONDENSE w_filename NO-GAPS.
      IF flag <> 1.
        IF p_email1 IS NOT INITIAL.
    build body of message
          CONCATENATE 'disply message ' ' ' INTO it_objtxt
           SEPARATED BY space.
          APPEND it_objtxt.
          CLEAR it_objtxt.
          it_reclist-receiver = ws_email1.
          it_reclist-rec_type = c_u.
          it_reclist-express  = ' '.
          it_reclist-com_type = 'INT'.
          APPEND it_reclist.
    Set title of object and email
          CLEAR: w_text.
         CONCATENATE 'Greenheck Packing List Data'
                            INTO w_text SEPARATED BY space.
          doc_chng-obj_descr = text-005. "w_text.
          doc_chng-obj_name  = 'Inbound EDI'.
          DESCRIBE TABLE it_objtxt LINES tab_lines.
          READ TABLE it_objtxt INDEX tab_lines.
          doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_objtxt ).
    *--Move the Report Name as the Heading line for email file
          CLEAR: w_longtext.
    MOVE: text-012 TO w_longtext.
          w_longtext = 'name of report for testing'.
          it_objbin = w_longtext.
          APPEND it_objbin. CLEAR it_objbin.
    *--Append Blank Lines
          APPEND it_objbin. CLEAR it_objbin.
          APPEND it_objbin. CLEAR it_objbin.
    *User name
          CLEAR text.
          MOVE: 'User:' TO text,
                 sy-uname TO text+6.
          it_objbin = text.
          APPEND it_objbin. CLEAR it_objbin.
    ---appending heading to Internal table of Email
          CLEAR: w_longtext, w_xblnr_1 , w_aubel_1,   w_vemng_1,
                 w_matnr_1,  w_harmdesc_1, w_hc_1, w_cooland1_1,
                 w_brgew_1,  w_tknum_1,   w_vbeln_1,  w_vbeln1_1,
                 w_exidv_1,  w_vhilm_1,   w_pack_no_1,
                 w_brgew1_1, w_laeng_1,   w_breit_1,
                 w_hoehe_1,   w_vol_1.
          w_xblnr_1 = 'Cust PO No.'.
          w_aubel_1 = 'Sal Order'.
          w_vemng_1 = 'Pack Qty'.
          w_matnr_1 = 'Model no.'.
          w_harmdesc_1 = 'Hrm Desc'.
          w_hc_1 = 'Hrm Code'.
          w_cooland1_1 = 'Country of Origin'.
          w_brgew_1 = 'Net Wt.'.
          w_tknum_1 = 'Shipment'.
          w_vbeln_1 = 'Billing Doc'.
          w_vbeln1_1 = 'Delivery'.
          w_exidv_1 = 'Pkg ID'.
          w_vhilm_1 = 'Pkg Desc'.
          w_pack_no_1 = 'Pkg No.'.
          w_brgew1_1 = 'Gross Wt'.
          w_laeng_1 = 'Length'.
          w_breit_1 = 'Width'.
          w_hoehe_1 = 'Height'.
          w_vol_1 = 'Cubic Mtr'.
          CONCATENATE w_xblnr_1  w_aubel_1   w_vemng_1
                      w_matnr_1  w_harmdesc_1 w_hc_1   w_cooland1_1
                      w_brgew_1  w_tknum_1   w_vbeln_1  w_vbeln1_1
                      w_exidv_1  w_vhilm_1   w_pack_no_1
                      w_brgew1_1 w_laeng_1   w_breit_1
                      w_hoehe_1   w_vol_1
          INTO w_longtext SEPARATED BY ','.
          it_objbin = w_longtext.
          APPEND it_objbin. CLEAR it_objbin.
          LOOP AT it_tab.
            DO.
              ASSIGN COMPONENT sy-index OF STRUCTURE it_tab TO <field>.
              IF sy-subrc <> 0.
                EXIT.
              ENDIF.
    Look for Commas in the field value.  If it exists, put quotes around
    value so that the file opens correctly with all the columns aligned
    in Excel.
              SEARCH <field> FOR ',' IN CHARACTER MODE.
    If search for commas was successful.
              IF sy-subrc = 0.
                CONCATENATE '"' <field> '"' INTO <field> IN CHARACTER MODE.
              ENDIF.
              IF sy-index = 1.
                i_dload-dload = <field>.
                SHIFT: i_dload-dload  LEFT DELETING LEADING space.
              ELSE.
    Put Comma as a separator for values in IT_DLOAD internal table
                SHIFT: i_dload-dload  LEFT DELETING LEADING space.
                CONCATENATE i_dload-dload <field> INTO i_dload-dload
                            SEPARATED BY ',' IN CHARACTER MODE.
              ENDIF.
            ENDDO.
            it_objbin = i_dload-dload.
            APPEND it_objbin. CLEAR it_objbin.
          ENDLOOP.
              flag = 1.
            endif.
        ENDIF.
    ---if to send error file.
        IF p_email IS NOT INITIAL.
    build body of message
          CONCATENATE 'Errors in file ' ' ' INTO it_objtxt
           SEPARATED BY space.
          APPEND it_objtxt.
          CLEAR it_objtxt.
          it_reclist-receiver = ws_email.
          it_reclist-rec_type = c_u.
          it_reclist-express  = ' '.
          it_reclist-com_type = 'INT'.
          APPEND it_reclist.
    Set title of object and email
          CLEAR: w_text.
       CONCATENATE 'Greenheck Packing List Data'
                          INTO w_text SEPARATED BY space.
          doc_chng-obj_descr = text-005.
          doc_chng-obj_name  = 'Inbound EDI'.
          DESCRIBE TABLE it_objtxt LINES tab_lines.
          READ TABLE it_objtxt INDEX tab_lines.
          doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_objtxt ).
    *--Move the Report Name as the Heading line for email file
          CLEAR: w_longtext.
    MOVE: text-012 TO w_longtext.
          w_longtext = 'name of report for testing'.
          it_objbin = w_longtext.
          APPEND it_objbin. CLEAR it_objbin.
    *--Append Blank Lines
          APPEND it_objbin. CLEAR it_objbin.
          APPEND it_objbin. CLEAR it_objbin.
    *User name
          CLEAR text.
          MOVE: 'User:' TO text,
                 sy-uname TO text+6.
          it_objbin = text.
          APPEND it_objbin. CLEAR it_objbin.
    ---appending heading to Internal table of Email
          CLEAR: w_longtext, w_xblnr_1 , w_aubel_1,   w_vemng_1,
                 w_matnr_1,  w_harmdesc_1, w_hc_1,  w_cooland1_1,
                 w_brgew_1,  w_tknum_1,   w_vbeln_1,  w_vbeln1_1,
                 w_exidv_1,  w_vhilm_1,   w_pack_no_1,
                 w_brgew1_1, w_laeng_1,   w_breit_1,
                 w_hoehe_1,   w_vol_1, w_error.
          w_xblnr_1 = 'Cust PO No.'.
          w_aubel_1 = 'Sal Order'.
          w_vemng_1 = 'Pack Qty'.
          w_matnr_1 = 'Model no.'.
          w_harmdesc_1 = 'Hrm Desc'.
          w_hc_1 = 'Hrm Code'.
          w_cooland1_1 = 'Counrty of Origin'.
          w_brgew_1 = 'Net Wt.'.
          w_tknum_1 = 'Shipment'.
          w_vbeln_1 = 'Billing doc'.
          w_vbeln1_1 = 'Delivery'.
          w_exidv_1 = 'Pkg ID'.
          w_vhilm_1 = 'Pkg Desc'.
          w_pack_no_1 = 'Pkg No.'.
          w_brgew1_1 = 'Gross Wt'.
          w_laeng_1 = 'Length'.
          w_breit_1 = 'Width'.
          w_hoehe_1 = 'Height'.
          w_vol_1 = 'Cubic Mtr'.
          w_error = 'Error'.
          CONCATENATE w_xblnr_1  w_aubel_1   w_vemng_1
                      w_matnr_1  w_harmdesc_1 w_hc_1  w_cooland1_1
                      w_brgew_1  w_tknum_1   w_vbeln_1  w_vbeln1_1
                      w_exidv_1  w_vhilm_1   w_pack_no_1
                      w_brgew1_1 w_laeng_1   w_breit_1
                      w_hoehe_1   w_vol_1 w_error
          INTO w_longtext SEPARATED BY ','.
          it_objbin = w_longtext.
          APPEND it_objbin. CLEAR it_objbin.
    *--Append the details to Internal table of Email
          LOOP AT it_tab.
            DO.
              ASSIGN COMPONENT sy-index OF STRUCTURE it_tab TO <field>.
              IF sy-subrc <> 0.
                EXIT.
              ENDIF.
    Look for Commas in the field value.  If it exists, put quotes around
    value so that the file opens correctly with all the columns aligned
    in Excel.
              SEARCH <field> FOR ',' IN CHARACTER MODE.
    If search for commas was successful.
              IF sy-subrc = 0.
                CONCATENATE '"' <field> '"' INTO <field> IN CHARACTER MODE.
              ENDIF.
              IF sy-index = 1.
                i_dload-dload = <field>.
                SHIFT: i_dload-dload  LEFT DELETING LEADING space.
              ELSE.
    Put Comma as a separator for values in IT_DLOAD internal table
                SHIFT: i_dload-dload  LEFT DELETING LEADING space.
                CONCATENATE i_dload-dload <field> INTO i_dload-dload
                            SEPARATED BY ',' IN CHARACTER MODE.
              ENDIF.
            ENDDO.
            it_objbin = i_dload-dload.
            APPEND it_objbin. CLEAR it_objbin.
          ENDLOOP.
           flag = 0.
          endif.
    -Convert to correct format----
      CALL FUNCTION 'SO_RAW_TO_RTF'
        TABLES
          objcont_old = it_objbin
          objcont_new = it_objbin.
    create the control table entry for the main email
      DESCRIBE TABLE it_objtxt LINES tab_lines.
      CLEAR it_objpack-transf_bin.
      it_objpack-head_start = 1.
      it_objpack-head_num   = 0.
      it_objpack-body_start = 1.
      it_objpack-body_num   = tab_lines.
      it_objpack-doc_type   = 'RAW'.
      APPEND it_objpack.
      DESCRIBE TABLE it_objbin LINES tab_lines.
      it_objpack-head_start = 1.
      it_objpack-head_num   = 0.
      it_objpack-body_start = 1.
      it_objpack-body_num   = tab_lines.
      it_objpack-transf_bin = c_x.
      it_objpack-doc_type   = 'CSV'.
      it_objpack-obj_descr  = w_filename. "'billing doc no.csv'.
      it_objpack-obj_name   = 'Billing Doc'.
      it_objpack-doc_size   = tab_lines * 255.
      APPEND it_objpack.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = doc_chng
         PUT_IN_OUTBOX              = c_x
          commit_work                = c_x
        TABLES
          packing_list               = it_objpack
         object_header              = it_objhead
          contents_bin               = it_objbin
          contents_txt               = it_objtxt
          receivers                  = it_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc <> 0.
        WRITE: / 'failure in sending mail'.
      ELSE.
         if flag = 0.
           MESSAGE s999(pp) WITH text-007.
         endif.
         if flag = 1.
           MESSAGE s999(pp) WITH text-006.
         endif.
       WRITE: / 'success in sending mail'.
      ENDIF.
        ENDFORM.                    " p_send_email

  • Problem with attachment using SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi,
    I'm using function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send emails from SAP (to Outlook - but the problem can already be observed when checking the email attachment in transaction SOST) with attachments.
    My attachment is a tab delimited file (so that I can open with MS Excel) with a line size of approx. 1600 characters. I mean, concatenating all fields of the output table into a 1600 character field, separated by tabstops (cl_abap_char_utilities=>horizontal_tab)
    I am using function module SCMS_STRING_TO_FTEXT to convert the internal table that I want to send to the line size as accepted by function module SO_NEW_DOCUMENT_ATT_SEND_API1, tables parameter contents_bin. Due to function module SCMS_STRING_TO_FTEXT this happens line by line, using a string variable. I make sure to remove any exess blanks that appear in the process due to not completey filled character fields. And for all rows bar the first the string is prefixed with (cl_abap_char_utilities=>cr_lf). I believe that's required so that SAP knows to put the lines back together. So far so good.
    When checking the email's attachment via SOST (and the same happens in Outlook) there are extra blanks in certain fields. Like:
    Annual Base
    92,928.         00
    or
    Email
    First L ast
    In debugging it appears that these excess spaces (sometimes 1, sometimes several) appear where the 1600 character data line is split into the 255 character pieces in 'contents_bin'. But then it happens quite randomly and cannot be observed in all data rows.
    Is there a better way of splitting my internal table into 255 character chunks so that what is one field will never get split up into two rows. For the above example, the two fields would show like this in contents_bin
    ....  92,928.        
    00
    and
    First_L
    ast
    Or where else lies the problem?
    Thanks in advance!
    Philipp

    Ron,
    Thank you for the suggestion. Just tried but issue remains exactly the same. The function module you have suggested builds the table in the same way.
    But, after a few more rounds of debugging and scratching my head it occured to me that my problem is self inflicted. I was using the condense statement in an attempt to get rid of the trailing blanks at the end of a row causing the last column to be filled with lots of spaces at the end. But it wasn't working anyway and I have since inserted a dummy column at the end to take all those trailing blanks. What this condense statement did though was creating trailing blanks in some of those rows with 255 characters fixed length and those trailing blanks then showed up as additional blanks in some columns in the attachment that the emailing function module created by putting those lines back to it's original length of close to 1600 characters.
    Problem solved!
    Regards,
    Philipp

  • 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

  • SO_NEW_DOCUMENT_ATT_SEND_API1 and txt file problem

    Hi
    I'm using FM SO_NEW_DOCUMENT_ATT_SEND_API1 for sending a txt file attachment, but the format of data is wrong.
    U s e r   :   T F R A N C O 
    D a t e   :   1 8 / 0 5 / 2 0 1 0
    clear objpack-transf_bin.
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = 1.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'TXT'.
      objpack-obj_descr = 'Document'.
      objpack-doc_size = tab_lines * 255.
    call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          Document_data              = doc_chng
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          Packing_list               = objpack
          object_header              = objhead
          contents_bin               = objbin
          contents_txt               = objtxt
          Receivers                  = reclist
        EXCEPTIONS
          too_many_receivers         = 1
          Document_not_sent          = 2
          Document_type_not_exist    = 3
          Operation_no_authorization = 4
          others                     = 99.
    Thanks in advance.

    Hi Carlos
    I've could delete space between letters but I need how to make for put new line in text format
    USER:TFRANCO   FECHA:25/05/2010.
    Format must be:
    USER:TFRANCO 
    FECHA:25/05/2010.
    code:
    DATA: hexa(1) TYPE c VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
      CONCATENATE hexa text-H02 SY-UNAME INTO objbin-line . APPEND objbin.
      CONCATENATE hexa text-H03 SY-DATUM INTO objbin-line . APPEND objbin.
    Thanks in advance.

  • Problem in sending attachment using "SO_NEW_DOCUMENT_ATT_SEND_API1"

    Hi All,
    I have a requirement of sending the data available in an internal table via email. I need to populate this content into excel sheet and send it as an attachment to recipients. I am using the following code for that.
    REPORT  z51515t_doc_att.
    DATA: objpack   LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: objhead   LIKE solisti1 OCCURS 1 WITH HEADER LINE.
    DATA: objbin    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: objtxt    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: reclist   LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
    DATA: doc_chng  LIKE sodocchgi1.
    DATA: tab_lines LIKE sy-tabix.
    DATA : BEGIN OF itab OCCURS 0,
              pernr LIKE p0001-pernr,
              name LIKE p0002-vorna,
           END OF itab.
    Creation of the document to be sent
    File Name
    doc_chng-obj_name = 'SENDFILE'.
    Mail Subject
    doc_chng-obj_descr = 'Delivered Mail'.
    Mail Contents
    objtxt = 'My Content 1 '.
    APPEND objtxt.
    objtxt = 'My Content2'.
    APPEND objtxt.
    DESCRIBE TABLE objtxt LINES tab_lines.
    Creation of the entry for the document
    CLEAR objpack-transf_bin. "Will get content from content_text
    objpack-head_start = 1. "Reads given row number in object header
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'RAW'.
    APPEND objpack.
    Prepare content for attachment
    DO 3 TIMES.
      itab-pernr = 182.
      itab-name = 'Prasath'.
      APPEND itab.
      itab-pernr = 1000.
      itab-name = 'Praveen'.
      APPEND itab.
    ENDDO.
    Populate attachment content
    LOOP AT itab.
      CONCATENATE itab-pernr itab-name INTO objbin-line.
      APPEND objbin.
    ENDLOOP.
    DESCRIBE TABLE objbin LINES tab_lines.
    Creation of the entry for the compressed attachment
    objpack-transf_bin = 'X'. "Will get content from content_bin
    objpack-head_start = 1.
    objpack-head_num   = 1.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'EXT'.
    objpack-obj_name   = 'WEBSITE'.
    objpack-obj_descr  = 'MyFile.XLS'.
    objpack-doc_size   = tab_lines * 255.
    APPEND objpack.
    target recipent
    CLEAR reclist.
    reclist-receiver = '[email protected]'.
    reclist-express  = 'X'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    copy recipents
    CLEAR reclist.
    reclist-receiver = '[email protected]'.
    reclist-express  = 'X'.
    reclist-rec_type = 'U'.
    reclist-copy     = 'X'.
    APPEND reclist.
    Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = objbin
        contents_txt               = objtxt
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        operation_no_authorization = 4
        OTHERS                     = 99.
    Now using this code i am able to send out the file but the data in the XL file is not aligned properly. When i open the attachment that i receive the contents of itab appear inside the same cell - A1 of the XL sheet. I want the data to be available in different rows and columns. How do i achieve this?
    Thanks,
    Prasath N

    See the below program it was sending the file   as  attach in XLS  format   by  column and rows  are  properly placed ...  see the
    <b>Code  in my program  :
    CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode</b>
    REPORT  ZEMAIL_ATTACH                   .
    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
    reward  points  if it is usefull ....
    Girish

  • Problem of sending email with attachment by SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi experts,
    When I sent email with FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' with TXT attachment, I found the there were no new line after each row of the content of TXT file attachment . All the rows in the internal table are concatenated into a string without any new line mark. It damaged the format of my attachment.

    You need to concatenate your text with  l_c_cr_lf  (For enter button or new line) after every 255 char to get new line. Below is the code.  Let me know in case of ny clarifications.
    CONSTANTS:  l_c_cr_lf    TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf,
                  l_c_255 TYPE char3 VALUE '255'.
    DATA: l_v_cr_lf TYPE abap_cr_lf,
            l_v_n TYPE i,
            l_v_dif TYPE i,
            l_v_strlen TYPE i.
    l_v_cr_lf = l_c_cr_lf.
      l_v_n = 0.
      LOOP AT fp_i_mail_out INTO wa_mail_out.
        l_v_strlen = STRLEN( wa_mail_out ).
        CLEAR l_v_n.
        DO.
          l_v_dif = l_v_strlen - l_v_n.
          IF l_v_dif < l_c_255.
            EXIT.
          ELSE.
            l_wa_attachment =  wa_mail_out+l_v_n(255).
            APPEND l_wa_attachment TO l_i_attachment.
            CLEAR l_wa_attachment.
            l_v_n = l_v_n + 255.
          ENDIF.
        ENDDO.
        IF l_v_strlen > l_v_n.
          l_v_dif = l_v_strlen - l_v_n.
          l_wa_attachment =  wa_mail_out+l_v_n(l_v_dif).
          APPEND l_wa_attachment TO l_i_attachment.
          CLEAR l_wa_attachment.
        ENDIF.
        DESCRIBE TABLE l_i_attachment LINES l_v_lines.
        LOOP AT l_i_attachment ASSIGNING <l_fs_attach>.
          IF sy-tabix = l_v_lines.
            CONCATENATE <l_fs_attach>-line l_v_cr_lf  INTO <l_fs_attach>-line.
          ENDIF.
        ENDLOOP.
      ENDLOOP.

  • Problem in this FM :SO_NEW_DOCUMENT_ATT_SEND_API1

    HI.
    I am doing a code for mail sending from ABAP to SOST and SBWP(SAP Inbox).Using the function module is SO_NEW_DOCUMENT_ATT_SEND_API1.mail is sending only for SBWP but it is not received in SOST,could you tell me how to find solution for this.
    Thanks.
    Regards.
    JAY

    While building the receivers table did you pass the correct letter for external emails?
    FOr Type of RECEIVER entry,the following values are permitted:
    'B' : SAP user name
    ' ' : SAP office name
    'C' : Shared distribution list
    'F' : Fax number
    'U' : Internet address
    'R ' : Remote SAP name
    'X' : X.400 address
    Also check in SCOT - settings - send jobs ( provided external emails is configured in the system )
    Mathews

  • Problem with FM  "SO_NEW_DOCUMENT_ATT_SEND_API1"

    Hi we using the FM    "SO_NEW_DOCUMENT_ATT_SEND_API1" to send a email with attachment ,
    we have 8 columns  to display in the excel sheet,the output is coming fine , but the spaces which are left out of 255 , they are appending to next line, so in the next line first column it is attaching the all the spaces from the above row.
      so we are not able to see the column content directly , we need to double click on the column line to get the content ,
    is there any solution for this. I already used the condense for this but no use.
    please help us. .

    Hi we using the FM    "SO_NEW_DOCUMENT_ATT_SEND_API1" to send a email with attachment ,
    we have 8 columns  to display in the excel sheet,the output is coming fine , but the spaces which are left out of 255 , they are appending to next line, so in the next line first column it is attaching the all the spaces from the above row.
      so we are not able to see the column content directly , we need to double click on the column line to get the content ,
    is there any solution for this. I already used the condense for this but no use.
    please help us. .

  • FM SO_NEW_DOCUMENT_ATT_SEND_API1 mail problem

    Hi All,
    In one of a workflow for PPM , I am using this Function module to send email. But this FM is getting dumped and no information received by the WF and hence it remains in process.
    The dump details are as follows:
    Short text of error message:
    COMMIT WORK during ON COMMIT or ON ROLLBACK
    Calls trace
      33 METHOD       CL_DPR_TRANSACTION_MANAGER====CP    CL_DPR_TRANSACTION_MANAGER====CM009    18
         CL_DPR_TRANSACTION_MANAGER=>ON_TRANSACTION_FINISHED
      32 METHOD       CL_SYSTEM_TRANSACTION_STATE===CP    CL_SYSTEM_TRANSACTION_STATE===CM001     2
         CL_SYSTEM_TRANSACTION_STATE=>RAISE_TRANSACTION_FINISHED
      31 FORM         SAPMSSY0                            SAPMSSY0                              464
         %_AFTER_COMMIT
      30 FUNCTION     SAPLSOI1                            LSOI1U32                              172
         SO_DOCUMENT_SEND_API1
    29 FUNCTION     SAPLSOI1                            LSOI1U25                               30
         SO_NEW_DOCUMENT_ATT_SEND_API1
    Any Helps !
    Thanks

    Hi Smith,
    Try to give the following submit after the commit work,
            COMMIT WORK.
            SUBMIT RSCONN01 WITH MODE = 'INT' AND RETURN.
    Regards,
    John K.

  • Text File in SO_NEW_DOCUMENT_ATT_SEND_API1

    Hello!
    We're using SO_NEW_DOCUMENT_ATT_SEND_API1 to send txt files attached to an e-mail.
    My problem is that whenever a text file with less than 500 characters is attached to e-mail, the last line of this text file is filled with many blank characters (spaces)
    I can only see this if I open the file by the e-mail, and I'm not able to see this blank line in debug.
    I think this is related to table CONTENTS_BIN, due to it's line size of char255, but i'm not 100% sure.
    Does any one knows how to solve this? We don't want that blank line at the end of the file.
    Mauricio

    Hi Mauricio,
    Did you pass xs_gd_doc_data and xt_packing_list in your FM
    Constant : lc_name    TYPE string VALUE 'Test Mail',
                 lc_descr   TYPE string VALUE 'Test Mail',
                 lc_f       TYPE c      VALUE 'F',
                 lc_zero    TYPE c      VALUE '0',
                 lc_one     TYPE c      VALUE '1',
                 lc_doctype TYPE string VALUE 'RAW'.
      CLEAR: lv_cnt.
    xy_message-line = lc_string.
      APPEND xyt_message.
      CONCATENATE lc_text_01 xv_premise INTO lv_message_premise SEPARATED BY space.
      xt_message-line = lv_message_premise.
      APPEND xt_message.
      CONCATENATE lc_text_02 xv_address INTO lv_message_address SEPARATED BY space.
      xt_message-line = lv_message_address.
      APPEND xt_message.
      CONCATENATE lc_text_03 xv_auszdat INTO lv_message_auszdat SEPARATED BY space.
      xt_message-line = lv_message_auszdat.
      APPEND xt_message.
      DESCRIBE TABLE xt_message LINES lv_cnt.
      xys_gd_doc_data-doc_size =
         ( lv_cnt - 1 ) * 255 + STRLEN( xt_message ).
      xys_gd_doc_data-obj_langu = sy-langu.
      xys_gd_doc_data-obj_name  = lc_name.
      xys_gd_doc_data-obj_descr = lc_descr.
      xys_gd_doc_data-sensitivty = lc_f.
      CLEAR xyt_packing_list.
      REFRESH xyt_packing_list.
      xyt_packing_list-transf_bin = space.
      xyt_packing_list-head_start = lc_one.
      xyt_packing_list-head_num = lc_zero.
      xyt_packing_list-body_start = lc_one.
      DESCRIBE TABLE xt_message LINES xyt_packing_list-body_num.
      xyt_packing_list-doc_type = lc_doctype.
      APPEND xyt_packing_list.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = xs_gd_doc_data
          put_in_outbox              = lc_true
          commit_work                = lc_true
        IMPORTING
          sent_to_all                = lv_sent_all
        TABLES
          packing_list               = xt_packing_list
          contents_txt               = xt_message
          receivers                  = xt_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.
      IF sy-subrc <> 0.
    *Do Nothing
      ENDIF.
    Hope this resolve your query.
    Regards,
    Manish

  • Facing problem with logo in the PDF attachment when sending mail...

    hi friends,
    i'm facing problem with logo in the PDF attachment to the mail.
    my requirement:
    1. enter spool number and mail id in the selection screen.
    process:
    1. now the program will fetch the spool data and converts it to PDF.
    2. but when i'm trying to send mail with this PDF as attachment.
    when i open the PDF file from the mail, logo is not coming properly (looks disturbed).
    can anyone help me how to resolve this issue...
    thanks in advance, murashali.

    hi dinakar, thanks for your mail...
    logo looks good in spool/script/smartform.
    even it look good when i download this spool to pdf and to the presentation server as pdf file.
    i'm using CONVERT_OTFSPOOLJOB_2_PDF.
    when i used CONVERT_ABAPSPOOLJOB_2_PDF, is gives a msg - 'spool number not found'.
    here i'm using folloing code to pass pdf to the function module: SO_NEW_DOCUMENT_ATT_SEND_API1.
    code:
    Transfer the 132-long strings to 255-long strings
      lt_mtab_pdf[] = pdf[].
      LOOP AT lt_mtab_pdf INTO lwa_mtab_pdf.
        TRANSLATE lwa_mtab_pdf USING ' ~'.
        CONCATENATE lv_gd_buffer lwa_mtab_pdf INTO lv_gd_buffer.
        CLEAR lwa_mtab_pdf.
      ENDLOOP.
      TRANSLATE lv_gd_buffer USING '~ '.
      DO.
        lwa_mess_att = lv_gd_buffer.
        APPEND lwa_mess_att TO lt_mess_att.
        CLEAR lwa_mess_att.
        SHIFT lv_gd_buffer LEFT BY 255 PLACES.
        IF lv_gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    NOTE: problem i believe is with ''.  i'm getting this tilt symbol () in my pdf internal table.  here in the above code the line   TRANSLATE lv_gd_buffer USING '~ ' is changing the existing tilt to space.  so my logo is getting disturbed.
    even i tried with REPLACE this tilt with other char, but it doent work.
    can you give any idea...

Maybe you are looking for

  • Extract 100 registres from table in Infopackage

    hi experts, I want to extract always 100 registres with full from and infopackage. (0HC_PATCASE). To do this, I have to put in the infopackage the 100 registers ( one by one). Is there another option? Can I put manually 100 registers in infopackage?

  • Multipoint Sever 2011 - default language settings?

    I inherited a gifted Multipoint 2011 server with six direct connect stations. It appears the default language from install is French (we are a bi-lingual school) however we want it to default to US English for ease of use due to keyboard issues.  I c

  • Enabling/Hiding Services in ESS

    Hi All, My requirement is to enable/ hide some services based on company code in ESS. I want to know is it possible in portal. If yes, request you to let me know how can i achieve this. Thanks, Santosh

  • Issue with dot1dTpDiscards (1.3.6.1.2.1.17.4.1.0)

    I'm trying to get dot1dTpDiscards via oid 1.3.6.1.2.1.17.4.1.0 With a lot of small switches, no problem (2960, 3560, etc) but with my 6500 I'm getting increasingly values (while via cli I see no problems): # snmpget -c public@10 172.20.255.249 1.3.6.

  • RE:SAVE_TEXT AND COMMIT_TEXT

    HAI ALL, I UPLOADED DATA FROM FLAT FILE TO INTERNAL TABLE FOR MM01 AND THEN USING SAVE_TEXT AND COMMIT_TEXT I AM TRYING TO SAVE THE DATA BUT IT IS NOT GETTING SAVED. I AM SENDING MY CODE PLEASE TRY TO GIVE SOME SUGGESTIONS DATA:BEGIN OF TB_ITAB OCCUR