Application Development 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: 

Distribution list

Former Member
0 Kudos

Which field stores the value of distribution list ?

Actually i want to pass distribution list when i send an attachment from my custom program not a singlre recipient.

1 ACCEPTED SOLUTION

former_member187709
Active Participant
0 Kudos

The field which stores the distribution list is

receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE

In the FM : SO_NEW_DOCUMENT_ATT_SEND_API1, you can put Receivers-rec_type = 'C' and

Receivers-receiver = the distribution list.

The second way of doing it is long :

define dist_list type SOS14-S_DLINAM.

1. Use FM : SO_DLI_EXPAND to expand the list

2. Convert the list into an internal table of type SOOS1 , consisting of receivers id

3. Use Function Module SO_OBJECT_SEND.

Cheers!!

Disha

5 REPLIES 5

Former Member
0 Kudos

For sending the mails to the distribution list use the FM

<b>'SO_NEW_DOCUMENT_ATT_SEND_API1'</b> where give the REC_TYPE = 'C'.

Here SGD_BUS_ANLT, SGD_SAL_MNGR etc are the distribution list.

Check the sample code:

*Sending mails to distribution list*

PERFORM f1001_mail_distribution_list.

DATA: lws_docdata LIKE sodocchgi1,

li_objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,

li_objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,

li_objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,

li_objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,

li_objhex LIKE solix OCCURS 10 WITH HEADER LINE,

li_reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.

DATA: lws_tab_lines TYPE i,

lws_doc_size TYPE i,

lws_att_type LIKE soodk-objtp.

CLEAR: lws_docdata, li_objpack, li_objhead, li_objtxt, li_objbin,

li_objhex, li_reclist, lws_tab_lines, lws_doc_size, lws_att_type.

REFRESH: li_objpack, li_objhead, li_objtxt, li_objbin, li_objhex,

li_reclist.

lws_docdata-obj_name = text-019. "EUC

CONCATENATE co_01 text-018 co_10 text-018 ws_conf_year

INTO ws_conf_date.

CONCATENATE text-006 ws_conf_date INTO lws_docdata-obj_descr

SEPARATED BY space.

CONCATENATE text-007 ws_conf_date text-008 INTO li_objtxt

SEPARATED BY space.

APPEND li_objtxt.

CONCATENATE text-009 text-010 ws_conf_date INTO li_objtxt

SEPARATED BY space.

APPEND li_objtxt.

DESCRIBE TABLE li_objtxt LINES lws_tab_lines.

READ TABLE li_objtxt INDEX lws_tab_lines.

lws_docdata-doc_size = ( lws_tab_lines - 1 ) * 255 +

STRLEN( li_objtxt ).

CLEAR li_objpack-transf_bin.

li_objpack-head_start = 1.

li_objpack-head_num = 0.

li_objpack-body_start = 1.

li_objpack-body_num = lws_tab_lines.

li_objpack-doc_type = text-020. "RAW

APPEND li_objpack.

li_reclist-receiver = text-014. "SGD_BUS_ANLT

li_reclist-rec_type = text-021. "C

APPEND li_reclist.

li_reclist-receiver = text-013. "SGD_SAL_MNGR

li_reclist-rec_type = text-021. "C

APPEND li_reclist.

li_reclist-receiver = text-012. "SGD_SAL_SUPT

li_reclist-rec_type = text-021. "C

APPEND li_reclist.

  • li_reclist-receiver = sy-uname.

  • li_reclist-rec_type = text-022. "B

  • APPEND li_reclist.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = lws_docdata

put_in_outbox = c_x

commit_work = c_x

TABLES

packing_list = li_objpack

object_header = li_objhead

contents_bin = li_objbin

contents_txt = li_objtxt

receivers = li_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 <> 0.

wa_idoc_status-status = co_stat_appl_err.

wa_idoc_status-msgty = c_stat_err.

wa_idoc_status-msgid = c_msg_class_spa.

wa_idoc_status-msgno = co_001.

wa_idoc_status-msgv1 = text-023.

CASE sy-subrc.

WHEN 1.

wa_idoc_status-msgv2 = text-024.

WHEN 2.

wa_idoc_status-msgv2 = text-025.

WHEN 3.

wa_idoc_status-msgv2 = text-026.

WHEN 4.

wa_idoc_status-msgv2 = text-027.

WHEN 5.

wa_idoc_status-msgv2 = text-028.

WHEN 6.

wa_idoc_status-msgv2 = text-029.

WHEN 7.

wa_idoc_status-msgv2 = text-030.

ENDCASE.

wa_idoc_status-msgv3 = space.

wa_idoc_status-msgv4 = space.

ws_flag = c_x.

EXIT.

ENDIF.

Regards,

Prakash.

Former Member
0 Kudos

Check the table <b>SODM - SAPoffice: distribution list contents</b>.

Regards,

Prakash.

former_member187709
Active Participant
0 Kudos

The field which stores the distribution list is

receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE

In the FM : SO_NEW_DOCUMENT_ATT_SEND_API1, you can put Receivers-rec_type = 'C' and

Receivers-receiver = the distribution list.

The second way of doing it is long :

define dist_list type SOS14-S_DLINAM.

1. Use FM : SO_DLI_EXPAND to expand the list

2. Convert the list into an internal table of type SOOS1 , consisting of receivers id

3. Use Function Module SO_OBJECT_SEND.

Cheers!!

Disha

0 Kudos

Hi Disha,

In this FM SO_OBJECT_SEND which Parameters i have to pass ?

Thanks

Regards

Abhishek

0 Kudos

Hi Abhishek,

After you obtain the email table which would contain the list of email addresses from SO_DLI_EXPAND , where in you have declared "MEMBER" (import table parameter of SO_DLI_EXPAND )

DATA:MEMBER LIKE SODM1 OCCURS 0 WITH HEADER LINE.

Then the following code would go for SO_OBJECT_SEND

DATA :RECEIVERS LIKE SOOS1 OCCURS 1 WITH HEADER LINE.

DATA :OBJECT_HD_CHANGE LIKE SOOD1 OCCURS 1 WITH HEADER LINE.

DATA :OBJECT_TYPE LIKE SOOD-OBJTP VALUE 'RAW'.

DATA :OWNER LIKE SOUD-USRNAM.

-- You need to fill in the Receiver table with the values obtained from Member table

LOOP AT MEMBER.

CLEAR RECEIVERS.

MOVE-CORRESPONDING MEMBER TO RECEIVERS.

CLEAR RECEIVERS-SEL.

MOVE: MEMBER-MEMNAM TO RECEIVERS-RECNAM,

MEMBER-MEMADRNAM TO RECEIVERS-ADR_NAME,

MEMBER-SORTADRNAM TO RECEIVERS-SORTFIELD,

MEMBER-ADDRESS TO RECEIVERS-RECEXTNAM,

MEMBER-READ_NOTIF TO RECEIVERS-READ,

MEMBER-MEMESC TO RECEIVERS-RECESC.

IF MEMBER-MEMESC = ESCAPE_USR

OR MEMBER-MEMESC = ESCAPE_SAP

OR MEMBER-MEMESC = ESCAPE_ORG.

MOVE: MEMBER-MEMTP TO RECEIVERS-RECTP,

MEMBER-MEMYR TO RECEIVERS-RECYR,

MEMBER-MEMNO TO RECEIVERS-RECNO.

ENDIF.

APPEND RECEIVERS.

ENDLOOP.

OWNER = SY-UNAME.

  • Prepare the table OBJECT_HD_CHANGE

OBJECT_HD_CHANGE-OBJLA = SY-LANGU. "Language

OBJECT_HD_CHANGE-OBJCP = 'X'. " Object can be changed by user

OBJECT_HD_CHANGE-OBJSNS = 'F'. " Msg Sensitivity private or business

OBJECT_HD_CHANGE-OBJDES = 'Return to Vendor transaction mail'.

OBJECT_HD_CHANGE-OBJNAM = OBJECT_HD_CHANGE-OBJDES.

OBJECT_HD_CHANGE-OBJDES = TEXT-021.

APPEND OBJECT_HD_CHANGE.

    • In the below FM Email_Text would be declared as

DATA : EMAIL_TEXT LIKE SOLI OCCURS 1 WITH HEADER LINE.

        • You need to prepare the above table to be sent as ****the message in the below FM!!

CALL FUNCTION 'SO_OBJECT_SEND'

EXPORTING

OBJECT_HD_CHANGE = OBJECT_HD_CHANGE

OBJECT_TYPE = OBJECT_TYPE

OUTBOX_FLAG = 'X'

OWNER = OWNER

TABLES

OBJCONT = EMAIL_TEXT

RECEIVERS = RECEIVERS

EXCEPTIONS

OTHERS = 21.