Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Don't sort cc alphabetically while sending mail

Hi,

I'm trying to send a mail. But recepients in cc should be in an exact order I want. I'm filling the recepients in that order. But when function executes it sorts cc recipients in alphabetical order. Here is the code I use to add recepients.

SORT lt_email ASCENDING BY rapor alici_tipi sira. " I'm sorting the internal table like I want.

       LOOP AT lt_email INTO ls_email WHERE rapor = radio.

         IF ls_email-alici_tipi = 'TO' AND ls_email-sira = 1.

           CONTINUE.

         ENDIF.

         mailto ls_email-email.

         recipient = cl_cam_address_bcs=>create_internet_address( mailto

         ).

         DATA : cc TYPE char1,

                bcc TYPE char1.

         CLEAR : cc, bcc.

         CASE ls_email-alici_tipi.

           WHEN 'CC'.

             cc = 'X'.

           WHEN 'BCC'.

             bcc = 'X'.

         ENDCASE.

         CALL METHOD send_request->add_recipient

           EXPORTING

             i_recipient  = recipient

             i_copy       = cc

             i_blind_copy = bcc.

       ENDLOOP.



sent_to_all = send_request->send( i_with_error_screen = 'X' ).

       COMMIT WORK.

       IF sent_to_all IS INITIAL.

         MESSAGE i500(sbcoms) WITH mailto.

       ELSE.

         MESSAGE s022(so).

       ENDIF.

Tags:
Not what you were looking for? View more on this topic or Ask a question