Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9024

Re: Mail Functionality icon in report

$
0
0

Just move that row to the internal table that is passed to the mail Sending FM.

 

case ok_code. (In the user command for classic ALV, or in the PAI module for OOPs ALV)

 

Here I am illustrating as for classic ALV.

 

  DATA: lt_mailtxt         TYPESTANDARDTABLEOF soli      WITHHEADERLINE.

FORM user_command USING r_ucomm LIKE sy-ucomm

                  rs_selfield TYPE slis_selfield.

 

CASE r_ucomm.

    WHEN '&MAIL'.

* IF data was changed use this too.

DATA ref1 TYPEREFTO cl_gui_alv_grid.
     CALLFUNCTION'GET_GLOBALS_FROM_SLVC_FULLSCR'
       IMPORTING
         e_grid = ref1.
     CALLMETHOD ref1->check_changed_data.

 

* Read the selected row into work area.

    READ TABLE it_data INTO wa_data INDEX rs_selfield-tabindex.

 

* Fill the recipient details in lt_mailrecipients table

......

* Fill the subject details in lt_mailsubject table.

....

* Move only the details of selected row to the internal table for the contents of the mail.

          CLEAR lt_mailtxt.
*    move values in wa_data to lt_mailtxt
    APPEND lt_mailtxt.

 

  * Send Mail using the FM.
   CALLFUNCTION'SO_NEW_DOCUMENT_SEND_API1'
     EXPORTING
       document_data              = lt_mailsubject
     TABLES
       object_content             = lt_mailtxt
       receivers                  = lt_mailrecipients
     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 EQ0.
     commitworkandwait.
*   Push mail out from SAP outbox
     SUBMIT rsconn01 WITHmode = 'INT'ANDRETURN.
   ENDIF.


Viewing all articles
Browse latest Browse all 9024

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>