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: 

send table in mail

Former Member
0 Kudos

Hi,

there is a way to send internal table in mail ?

for sending mail i use class cl_bcs ,i need example.

Regards

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Ricardo,

Check the standard demo programs starting with BCS_

Cheers,

Jose.

7 REPLIES 7

Former Member
0 Kudos

how you want that? plain text or as attachment? did you look at Thomas Jung's blog

0 Kudos

Hi MxG ,

yea i follow his blog but he don't move internal table just text.

i wont move the table as plain text i.e. in the body of the mail.

how can i do that?

Regards

Former Member
0 Kudos

Hi Ricardo,

Check the standard demo programs starting with BCS_

Cheers,

Jose.

0 Kudos

Hi Jose ,

i take a look in the BCS programs but nothing there move internal table to mail body.

Regards

0 Kudos

Hi Ricardo,

Kindly check the below program.

Also check the documentation given for the Func module WWW_ITAB_TO_HTML.Seems we can add colors, headers etc.

DATA: send_request  TYPE REF TO cl_bcs,
      document      TYPE REF TO cl_document_bcs,
      recipient     TYPE REF TO cl_cam_address_bcs,
      bcs_exception TYPE REF TO cx_bcs,
      sent_to_all   TYPE os_boolean,
      lt_tab        TYPE TABLE OF makt,
      lt_fields     TYPE TABLE OF w3fields,
      lt_html       TYPE TABLE OF w3html.

PARAMETER mailid TYPE adr6-smtp_addr.

SELECT * FROM makt UP TO 10 ROWS INTO TABLE lt_tab WHERE spras = 'E'.

CALL FUNCTION 'WWW_ITAB_TO_HTML'
  TABLES
    html   = lt_html[]
    fields = lt_fields
    itable = lt_tab.

TRY.
    send_request = cl_bcs=>create_persistent( ).
    document = cl_document_bcs=>create_document(  i_type    = 'HTM'
                                                  i_text    = lt_html
                                                  i_subject = 'Table' ).
    send_request->set_document( document ).
    recipient = cl_cam_address_bcs=>create_internet_address( mailid ).
    send_request->add_recipient( EXPORTING i_recipient = recipient
                                           i_express   = 'X' ).
    send_request->set_send_immediately( 'X' ).
    send_request->send( EXPORTING i_with_error_screen = 'X'
                        RECEIVING result              = sent_to_all ).
    COMMIT WORK.

  CATCH cx_bcs INTO bcs_exception.
    EXIT.
ENDTRY.

Cheers,

Jose.

0 Kudos

Hi Josh,

thanks u are Great ,

its working except the header , i saw that in the fm i have option to use header but i don't now, there is a loot of parameters there how maybe u have idea?

Thanks and Regards

0 Kudos

Hi Ricardo,

Thanks for the compliment.

Check the documentation given for that FM in SE37. It has an

example with Header.

Cheers,

Jose.