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

PUT A TABLE IN THE RECIPIENT OBJECT

Former Member
0 Likes
3,052

I have no knowledge of ABAP Objects.

I have to put the table tab_destmail_f of a single field

(Mail address) in the recipient object

for processing the program and send all the mails.



DATA: BEGIN OF wa_destmail_f,
smtp_addr LIKE adr6-smtp_addr,
END OF wa_destmail_f.

DATA: tab_destmail_f LIKE TABLE OF wa_destmail_f.



* --------- añade dirección de mail -----------------------
* crea el receptor o destinatari (objecte recipient)
recipient = cl_cam_address_bcs=>create_internet_address( mailto ).


* añade objeto recipient a la petición de envío
send_request->add_recipient( recipient ).

THANKS A LOT !!!

I have no knowledge of ABAP Objects.

I have to put the table tab_destmail_f of a single field

(Mail address) in the recipient object

for processing the program and send all the mails.



DATA: BEGIN OF wa_destmail_f,
smtp_addr LIKE adr6-smtp_addr,
END OF wa_destmail_f.

DATA: tab_destmail_f LIKE TABLE OF wa_destmail_f.



* --------- añade dirección de mail -----------------------
* crea el receptor o destinatari (objecte recipient)
recipient = cl_cam_address_bcs=>create_internet_address( mailto ).


* añade objeto recipient a la petición de envío
send_request->add_recipient( recipient ).

THANKS A LOT !!!

11 REPLIES 11
Read only

karsten_korte
Participant
0 Likes
1,995

Hi ivo agusti,

from the docu: ADD_RECIPIENT - You use this method to pass a recipient to the send request. You have to call this method for every recipient.


* ...
loop at tab_destmail_f into wa_destmail_f.   "or assigning fs
  recipient = cl_cam_address_bcs=>create_internet_address( wa_destmail_f-smtp_addr ).
  send_request->add_recipient( recipient ).
endloop.
* ...

regards, Karsten

Read only

Former Member
0 Likes
1,995

Karsten Korte thanks a lot for your response.


 DATA: BEGIN OF  wa_destmail_f,
         smtp_addr LIKE adr6-smtp_addr,
        END OF wa_destmail_f.

  DATA: tab_destmail_f  LIKE TABLE OF wa_destmail_f.

I writed your code and I had dump,


Err.tmpo.ejec.         UNCAUGHT_EXCEPTION\par
Excep.                 CX_ADDRESS_BCS\par
Fecha y hora           21.01.2010 16:56:39\par

Where I must to put this code?

Must I to modify anything?

Read only

0 Likes
1,995

Where exactly in your code does this dump occur?

In order to find out what the (exact) problem is, you will have to 'catch' this exception using the CATCH statement within a TRY ENDTRY .

For example.


DATA: lr_error TYPE REF TO cx_address_bcs.
DATA: lv_message TYPE string.
TRY.

CATCH cx_address_bcs INTO lr_error.
lv_message = lr_error->get_text( ).
ENDTRY.

Evaluate the message in lv_message, and you should have a better understanding of the error.

Read only

0 Likes
1,995

CX_ADDRESS_BCS is thrown by CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS

recipient = cl_cam_address_bcs=>create_internet_address( wa_destmail_f-smtp_addr ) would be a candidate

so try what Micky suggested here:


DATA: lr_error TYPE REF TO cx_address_bcs.
DATA: lv_message TYPE string.
loop at tab_destmail_f into wa_destmail_f.   "or assigning fs
TRY.
    recipient = cl_cam_address_bcs=>create_internet_address( wa_destmail_f-smtp_addr ).
    send_request->add_recipient( recipient ).
  CATCH cx_address_bcs INTO lr_error.
    lv_message = lr_error->get_text( ).
ENDTRY.
endloop.

Read only

Former Member
0 Likes
1,995

Hi abapers,

the error is here:


DATA: lr_error TYPE REF TO cx_address_bcs.
DATA: lv_message TYPE string.
loop at tab_destmail_f into wa_destmail_f.   "or assigning fs
TRY.
    recipient = cl_cam_address_bcs=>create_internet_address( wa_destmail_f-smtp_addr ).
>>>>>>>>    send_request->add_recipient( recipient ).
  CATCH cx_address_bcs INTO lr_error.
    lv_message = lr_error->get_text( ).
ENDTRY.
endloop.

The messages are:


Zugriff über 'NULL' Objektreferenz nicht möglich.

Access via 'NULL' object reference not possible.



Err.tmpo.ejec.         OBJECTS_OBJREF_NOT_ASSIGNED
Excep.                 CX_SY_REF_IS_INITIAL
Fecha y hora           21.01.2010 19:00:55

The information of lv_message is:


{O:322*CLASS=CX_ADDRESS_BCS}

Excepción CX_ADDRESS_BCS ocurrida (programa: CL_CAM_ADDRESS_BCS============CP, include CL_CAM_ADDRESS_BCS============CM01W, línea: 45)

I don't find the solution, any saving code?

This is very important to me. Thanks a lot for your help!

Read only

0 Likes
1,995

can you show us more coding? e.g. where does send_request come from?

and does it look like bcs_example_1 (see Uwe's posting)?

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,995

Hello Ivo

In the package containing class CL_BCS you will find a couple of very useful sample reports (something like BCS_EXAMPLE_1 etc.).

Regards

Uwe

Read only

Former Member
0 Likes
1,995

Hi all,

Uwe, Karsten & Micky thanks for your help.

I 'll see the examples.

Here are more code about my substitution-user exit:



      send_request->set_document( document ).


      recipient = cl_cam_address_bcs=>create_internet_address( mailto ).


      send_request->add_recipient( recipient ).
******************


METHOD add_recipient.

  CALL METHOD send_request->add_recipient
    EXPORTING
      i_recipient      = i_recipient
      i_express        = i_express
      i_copy           = i_copy
      i_blind_copy     = i_blind_copy
      i_no_forward     = i_no_forward.
*    EXCEPTIONS
*      recipient_exists = 1
*      released         = 2
*      os_exception     = 3
*      invalid_value    = 4
*      OTHERS           = 5.
*
*  CASE sy-subrc.
*    WHEN 0.
*      "Fine
*    WHEN 1.
*      RAISE recipient_exists.
*    WHEN 2.
*      RAISE released.
*    WHEN OTHERS.
*      RAISE invalid_value.
*  ENDCASE.

ENDMETHOD.


METHOD add_recipient.

  DATA: re    TYPE recip_bcs.

* read notification
  state_read_access.
  IF ( sr_state <> ' ' ).
    RAISE exception type cx_send_req_bcs
    exporting error_type = cx_send_req_bcs=>allready_released.
  ENDIF.

* write notification
  state_write_access.

  re-recipient = i_recipient.
  re-sndex     = i_express.
  re-sndcp     = i_copy.
  re-sndbc     = i_blind_copy.
  re-forfb     = i_no_forward.
  re-prifb     = i_no_print.
  re-resend    = i_resend.


  INSERT re INTO TABLE recipients.
  recipients_changed = 'X'.

* changed notification
  state_changed.

ENDMETHOD.

Read only

0 Likes
1,995

Hi ivo,

what do you see in debugger in field wa_destmail_f-smtp_addr? Possibly the method can't handle the address. When dump occurs, you can click debugger button and see where you are and where you come from.

Regards,

Clemens

Read only

Former Member
0 Likes
1,995

Hi all,

I finded the solution!!

is very simple:

.
DATA: mymail TYPE ad_smtpadr.

LOOP AT mitabla INTO w_mitabla.
  mymail = w_mitabla-micampo.
  recipient = cl_cam_address_bcs=>create_internet_address( mymail ).
  send_request->add_recipient( recipient ).
ENDLOOP.

See you next time

Read only

Former Member
0 Likes
1,995

Karten Korte you were vere close!!

Thanks