Skip to Content
avatar image
Former Member

Unable to send Subject Line while sending the email

Hi All,

I am using the FM SO_NEW_DOCUMENT_SEND_API1 to send email. This email does not have any attachments but only some body text. Everything is fine, but only the subject line is missing in the email. The code is attached for reference. Can you please help me out?

CLEAR WA_MAILATTR.



  WA_MAILATTR-OBJ_LANGU = SY-LANGU.
  WA_MAILATTR-OBJ_NAME = 'PO'.
  WA_MAILATTR-OBJ_DESCR   = 'Walmart PO Details'.
  WA_MAILATTR-SENSITIVTY = '0'.
  WA_MAILATTR-NO_CHANGE = 'X'.


 IF IT_MAILTXT[] IS INITIAL.
    WA_MAILTXT-LINE = 'The following are the details of the Purchase Orders :'.
    APPEND WA_MAILTXT TO IT_MAILTXT.
    CLEAR WA_MAILTXT.


    WA_MAILTXT-LINE =  'PO Number  PO Date    NoOfPO    Time Stamp'.
    APPEND WA_MAILTXT TO IT_MAILTXT.
    CLEAR WA_MAILTXT.

    WA_MAILTXT-LINE =  '                      Lines               '.
    APPEND WA_MAILTXT TO IT_MAILTXT.
    CLEAR WA_MAILTXT.

    LOOP AT IT_PODETAILS.
      WA_MAILTXT-LINE = IT_PODETAILS-VALUE.
      APPEND WA_MAILTXT TO IT_MAILTXT.
      CLEAR WA_MAILTXT.
    ENDLOOP.

  ENDIF.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
     EXPORTING
          DOCUMENT_DATA              = WA_MAILATTR
          commit_work                = 'X'
*     IMPORTING
*          SENT_TO_ALL                = SENT_TO_ALL
*          NEW_OBJECT_ID              = NEW_OBJECT_ID
     TABLES
          OBJECT_HEADER              = it_OBJECT_HEADER
          OBJECT_CONTENT             = IT_MAILTXT
*          object_para                =
*          object_parb                =
          RECEIVERS                  = IT_MAILREC
     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.


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 24, 2008 at 10:45 AM

    HAI,

    document size should be specified properly,

    have a look at following example

    objtxt = i_adr6-smtp_addr.

    APPEND objtxt.

    clear i_adr6.

    endloop.

    clear objtxt.

    append objtxt.

    clear vprsnr.

    read table i_knvk with key KUNNR = it_vbeln-kunag

    namev = it_vbeln-kunag

    name1 = 'ccm'.

    objtxt = 'Sender : CCM'.

    append objtxt.

    clear objtxt.

    append objtxt.

    vPRSNR = i_knvk-PRSNR.

    read table i_adr6 with key PERSNUMBER = vPRSNR.

    objtxt = i_adr6-smtp_addr.

    append objtxt.

    endif.

    *************************************************

    here read the internal table objtxt[]

    and multiply by 255

    ************************************************

    DESCRIBE TABLE objtxt[] LINES V_LINES_TXT.

    doc_chng-obj_name = 'INVOICE'.

    doc_chng-expiry_dat = sy-datum + 10.

    doc_chng-obj_descr = 'INVOICE'.

    doc_chng-sensitivty = 'F'.

    doc_chng-doc_size = V_LINES_TXT * 255.

    objpack-transf_bin = ' '.

    objpack-head_start = 1.

    objpack-head_num = 0.

    objpack-body_start = 1.

    objpack-BODY_NUM = V_LINES_TXT.

    objpack-doc_type = 'RAW'.

    APPEND objpack.

    *PDF Attachment

    *************************************************

    here read the internal table so_ali[]

    and multiply by 255

    DESCRIBE TABLE so_ali[] LINES lineno.

    objpack-transf_bin = 'X'.

    objpack-head_start = 1.

    objpack-head_num = 1.

    objpack-body_start = 1.

    objpack-doc_size = lineno * 255 .

    objpack-body_num = lineno.

    objpack-doc_type = 'PDF'.

    objpack-obj_name = 'INVOICE'.

    objpack-obj_descr = 'INVOICE'.

    objpack-obj_langu = 'E'.

    APPEND objpack.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 24, 2008 at 10:51 AM

    hai,

    u got it r not

    shan.

    Edited by: shan palani on Sep 24, 2008 4:21 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 24, 2008 at 03:19 PM

    I dont have a document attached. I just have the message body. So there is no document size. My only problem is the subject line.

    Regards,

    Geetha

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Geetha,

      I tried the same code and its working. It has subject on that mail.

      DATA : wa_mailattr LIKE sodocchgi1,

      it_mailtxt TYPE STANDARD TABLE OF solisti1 ,

      wa_mailtxt TYPE solisti1,

      it_object_header LIKE TABLE OF SOLISTI1,

      it_mailrec TYPE TABLE OF somlreci1 with header line.

      wa_mailattr-obj_langu = sy-langu.

      wa_mailattr-obj_name = 'PO'.

      wa_mailattr-obj_descr = 'Walmart PO Details'.

      wa_mailattr-sensitivty = '0'.

      wa_mailattr-no_change = 'X'.

      CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

      EXPORTING

      document_data = wa_mailattr

      commit_work = 'X'

      put_in_outbox = 'X'

      • IMPORTING

      • SENT_TO_ALL = SENT_TO_ALL

      • NEW_OBJECT_ID = NEW_OBJECT_ID

      TABLES

      object_header = it_object_header

      object_content = it_mailtxt

      • object_para =

      • object_parb =

      receivers = it_mailrec

      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.

      Pranav

  • avatar image
    Former Member
    Sep 24, 2008 at 04:41 PM

    Thank you all. Its working now.

    Geetha

    Add comment
    10|10000 characters needed characters exceeded