Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

mail sending--error

pradeep_nellore
Participant
0 Likes
632

Hi,

I am sending mail thru FM SO_DOCUMENT_SEND_API1 and the FM returns an error message COTENT REPOSITORY DOES NOT EXIST and sy-subrc is 6.Where could have been the error in the program.

Thanks

--Pradeep

4 REPLIES 4
Read only

Former Member
0 Likes
595

Hi,

May be there is some problem with the basis setting or data declaration. Without code snippet is difficult to locate the error:

Check with this piece of code and comapre what declarations are incorrect:



"Objects to send mail.
  DATA: L_T_OBJPACK   LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE,        " SAPoffice: Description of Imported Object Components
        L_T_OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE,
        L_T_OBJTXT    LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
        L_T_OBJBIN    LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
        L_T_RECLIST   LIKE SOMLRECI1  OCCURS 5 WITH HEADER LINE,        " SAPoffice: Structure of the API Recipient List
        L_DATE LIKE SY-DATUM,
        V_DOCUMENT_DATA TYPE SODOCCHGI1.


  DATA:
*     Work Area declarations
        L_WA_OBJHEAD   TYPE SOLI_TAB,                                    " Work Area for Objcont and Objhead as Table Type
        L_WA_DOC_CHNG  TYPE SODOCCHGI1,                                  " Work Area - Data of an object which can be changed

*     Variables declarations
        L_LINES_TXT    TYPE I,
        L_LINES_BIN    TYPE I,
        L_OBJ_DESC(100),
        L_NAME(100).

  DATA : BEGIN OF L_T_EMAIL OCCURS 0,
  EMAIL_ID(100),
  END OF L_T_EMAIL.

* email -id
  SELECT LOW INTO TABLE L_T_EMAIL
  FROM TVARVC
  WHERE NAME EQ 'ZREUTERS_MAIL'.

  IF SY-SUBRC <> 0.
    L_T_EMAIL-EMAIL_ID = SY-UNAME.
    APPEND L_T_EMAIL.
    MESSAGE I999 WITH 'Email IDs not maintained in TVARVC'.
  ENDIF.

  
*Fill in the contents of the mail body
L_T_OBJBIN = ' Reuters File format'.
APPEND L_T_OBJBIN.


* Attachment
  REFRESH: L_T_RECLIST,
           L_T_OBJTXT,
           L_T_OBJPACK.

  CLEAR L_WA_OBJHEAD.

  
* Create Message Body Title and Description
  CONCATENATE 'Reuters File' Sy-datum INTO L_NAME SEPARATED BY SPACE.
  L_T_OBJTXT = L_NAME.
  APPEND L_T_OBJTXT.

  CONCATENATE 'Reuters File' Sy-datum INTO L_OBJ_DESC SEPARATED BY SPACE.

  DESCRIBE TABLE L_T_OBJTXT LINES L_LINES_TXT.
  READ TABLE L_T_OBJTXT INDEX L_LINES_TXT.
  L_WA_DOC_CHNG-OBJ_NAME = L_NAME.
  L_WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
  L_WA_DOC_CHNG-OBJ_DESCR = L_OBJ_DESC.
  L_WA_DOC_CHNG-SENSITIVTY = 'O'.
  L_WA_DOC_CHNG-DOC_SIZE = STRLEN( L_T_OBJTXT ).

* Main Text
  CLEAR L_T_OBJPACK-TRANSF_BIN.
  L_T_OBJPACK-HEAD_START = 1.
  L_T_OBJPACK-HEAD_NUM = 0.
  L_T_OBJPACK-BODY_START = 1.
  L_T_OBJPACK-BODY_NUM = 1.
  L_T_OBJPACK-DOC_TYPE = 'RAW'.
  L_T_OBJPACK-DOC_SIZE = STRLEN( L_T_OBJTXT ).
  APPEND L_T_OBJPACK.

* Attachment
  DESCRIBE TABLE L_T_OBJBIN LINES L_LINES_BIN.
  READ TABLE L_T_OBJBIN INDEX L_LINES_BIN.

  CLEAR L_T_OBJPACK.
  L_T_OBJPACK-TRANSF_BIN = 'X'.
  L_T_OBJPACK-HEAD_START = 1.
  L_T_OBJPACK-HEAD_NUM = 1.
  L_T_OBJPACK-BODY_START = 1.
  L_T_OBJPACK-BODY_NUM = L_LINES_BIN.
  L_T_OBJPACK-DOC_TYPE = 'RAW'.
  L_T_OBJPACK-OBJ_NAME = 'EMAIL'.
  L_T_OBJPACK-OBJ_DESCR = ' Exchange rate File'.
  L_T_OBJPACK-DOC_SIZE = ( 255 * ( L_LINES_BIN - 1 ) ) + STRLEN( L_T_OBJBIN-LINE ).
  APPEND L_T_OBJPACK.

  LOOP AT L_T_EMAIL.
* Maintain Recievers
    CLEAR L_T_RECLIST.
    L_T_RECLIST-RECEIVER = L_T_EMAIL-EMAIL_ID.
    L_T_RECLIST-REC_TYPE = 'U'.
    L_T_RECLIST-EXPRESS = 'X'.
    APPEND L_T_RECLIST.
  ENDLOOP.

  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      DOCUMENT_DATA              = L_WA_DOC_CHNG
      PUT_IN_OUTBOX              = 'X'
      COMMIT_WORK                = 'X'
    TABLES
      PACKING_LIST               = L_T_OBJPACK
      OBJECT_HEADER              = L_WA_OBJHEAD
      CONTENTS_BIN               = L_T_OBJBIN
      CONTENTS_TXT               = L_T_OBJTXT
      RECEIVERS                  = L_T_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 NE 0.
    MESSAGE S999(ZZ) WITH 'Mail Could not be sent'.
  ELSE.
    MESSAGE S999(ZZ) WITH 'Mail sent to group'.
  ENDIF.
ENDFORM.                    "F0005_ATTACH_AND_MAIL

I think this would solve your problem. Also check whether the email -id is maintained in transaction SCOT.

Regards,

Mansi.

Read only

bi7kiran
Active Participant
0 Likes
595

Hi

Please see the below code this might help your problem. &********************&

 DATA: ld_mtitle LIKE sodocchgi1-obj_descr, ld_format TYPE so_obj_tp , ld_attdescription TYPE so_obj_nam , ld_attfilename TYPE so_obj_des . * ld_receiver LIKE sy-subrc. DATA: it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE, it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE, it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE, w_cnt TYPE i, w_sent_all(1) TYPE c, "#EC NEEDED w_doc_data LIKE sodocchgi1. REFRESH it_receivers . CLEAR it_receivers . IF v_trip_send = 'X'. it_receivers-receiver = it_trip_dload-approver_email . ELSE . it_receivers-receiver = it_adv_dload-approver_email . ENDIF. it_receivers-rec_type = c_u . APPEND it_receivers. CLEAR it_receivers. * it_receivers-receiver = " ---------------> put your reciever email id. IF v_trip_send = 'X' . it_receivers-receiver = it_trip_dload-requester_email . ELSE . it_receivers-receiver = it_adv_dload-requester_email . ENDIF . it_receivers-rec_type = c_u . it_receivers-copy = 'X' . APPEND it_receivers. CLEAR it_receivers. ld_mtitle = p_mtitle. ld_format = p_format. ld_attdescription = p_attdescription. ld_attfilename = p_filename. * 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 = c_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 = c_saprpt. w_doc_data-obj_descr = ld_mtitle. w_doc_data-sensitivty = c_f. CLEAR it_attachment. REFRESH it_attachment. it_attachment[] = it_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 = c_raw. APPEND it_packing_list. * Create attachment notification it_packing_list-transf_bin = c_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. CALL FUNCTION 'SO_DOCUMENT_SEND_API1' EXPORTING document_data = w_doc_data put_in_outbox = c_x commit_work = c_x IMPORTING sent_to_all = w_sent_all TABLES packing_list = it_packing_list contents_bin = it_attachment contents_txt = it_message receivers = it_receivers. 

Many thanks

kiran

Read only

Former Member
0 Likes
595

Hi,

Refer this link for example ..http://docs.google.com/Doc?id=dfv2hmgs_0fm22tggx&hl=en

Read only

pradeep_nellore
Participant
0 Likes
595

solved problem by commenting sender mail id.