Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

CL_SALV Custom Button With Mail Sending Option

$
0
0

Hi Experts,

 

 

I am developing a report with class CL_SALV. I have to add a custom button and while clicking it has to send mail with excel attachment.

The issue is I am getting the following dump. I already referred the SALV sample programs.

 

SENDMAIL.PNG

 

This is my code in a nutshell.

 

Class lcl declaration.

Methods: Retrieve_Data,

              display_alv

              on_user_command for event added_function of cl_salv_events

              importing e_salv_function.


endcalss.


class lcl implemtation.


methods: retrieve_data.

               *....CODE....*

                 

methods: display_alv.

                *.....code....*


LR_FUNCTIONS = LR_ALV->GET_FUNCTIONS( ).

LR_FUNCTIONS->SET_ALL( ABAP_TRUE ).

 

TRY.

       L_TEXT = TEXT-B01.

       L_ICON = ICON_COMPLETE.

       LR_FUNCTIONS->ADD_FUNCTION(

         NAME     = 'SEND_MAIL'

         ICON     = SPACE

         TEXT     = L_TEXT

         TOOLTIP  = L_TEXT

         POSITION = IF_SALV_C_FUNCTION_POSITION=>RIGHT_OF_SALV_FUNCTIONS ).

 

CATCH CX_SALV_WRONG_CALL CX_SALV_EXISTING.

 

ENDTRY.


   LR_ALV->DISPLAY( ).

endclass.


METHOD ON_USER_COMMAND.

     PERFORM HANDLE_USER_COMMAND USING E_SALV_FUNCTION.

   ENDMETHOD.

 

 

 

ENDCLASS.

 

 

FORM HANDLE_USER_COMMAND USING I_UCOMM TYPE SALV_DE_FUNCTION.

 

   CASE I_UCOMM.

     WHEN 'SEND_MAIL'.

       PERFORM SEND_MAIL.

ENDCASE.

 

ENDFORM.

*

FORM SEND_MAIL.

 

 

ENDFORM.





Viewing all articles
Browse latest Browse all 8332

Trending Articles



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