Skip to Content
0
Former Member
Feb 17, 2009 at 08:46 AM

File from application server-- Email ?

30 Views

Hi,

I need to pickup a file from application server and Email the same to the intended receipents through ABAP program

For that i had used the following code:

REPORT  ZEMAIL_APP_SER_FAIL.


DATA :is_doc_chng        TYPE sodocchgi1,
      it_objtxt          TYPE STANDARD TABLE OF solisti1,
      is_objtxt          TYPE solisti1,
      it_objpack         TYPE STANDARD TABLE OF sopcklsti1,
      is_objpack         TYPE sopcklsti1,
      it_objbin          TYPE STANDARD TABLE OF solisti1,
      is_objbin          TYPE solisti1,
      it_reclist         TYPE STANDARD TABLE OF somlreci1,
      is_reclist         TYPE somlreci1,
      w_lines_tx         TYPE i.

** Create Message Body
**   Title and Description
*is_doc_chng-obj_name  = 'MAIL'.

is_doc_chng-obj_descr = 'Auto genareted Mail from Application server'.

** main text
is_objtxt-line = 'This is an automatically generated mail. Please do not reply  to it.'(028).
APPEND is_objtxt TO it_objtxt.
is_objtxt-line = space.
APPEND is_objtxt TO it_objtxt.


*   write packing list (main)
DESCRIBE TABLE it_objtxt LINES w_lines_tx.
READ     TABLE it_objtxt INTO is_objtxt INDEX w_lines_tx.
is_doc_chng-doc_size = ( w_lines_tx - 1 ) * 255 + STRLEN( is_objtxt ).
CLEAR is_objpack-transf_bin.
is_objpack-head_start = 1.
is_objpack-head_num   = 0.
is_objpack-body_start = 1.
is_objpack-body_num   = w_lines_tx.
is_objpack-doc_type   = 'CVS'.
is_objpack-OBJ_NAME   = 'GIND_EXP'.
is_objpack-Obj_langu  = 'E'.
APPEND is_objpack TO it_objpack.

is_reclist-receiver = 'XXX'@'YYY'.COM'.
is_reclist-rec_type = 'A'.
Break-point.
*is_reclist-REC_ID   =  'XXX@YYY'.COM'.
APPEND is_reclist TO it_reclist.
CLEAR is_reclist.




CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
 EXPORTING
   document_data              = is_doc_chng
   put_in_outbox              = 'X'
   commit_work                = 'X'
 TABLES
   packing_list               = it_objpack
   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.
IF sy-subrc NE 0.
 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

-

when i execute this program:

I get the following error msg:

Activation setting not yet maintained

May i know what is the problem?