Application Development and Automation 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: 
Read only

mail_body

Former Member
0 Likes
481

Hallo

I am using method create_from_text. I want that the mailbody filled with the text in table i_tab.

But it creates txt file in attachtement. In this file appears my mailbody text.

can some body tell me my mistake. what should I do that i_tab text in mail body appears.

here is my code

TRY.

CALL METHOD cl_document_bcs=>create_from_text

EXPORTING

i_text = i_tab

i_documenttype = 'RAW'

i_subject = l_btr

i_importance = '0'

i_sensitivity = 'P'

RECEIVING

result = l_result.

CATCH cx_document_bcs .

ENDTRY.

regards

rana

Hallo

I am using method create_from_text. I want that the mailbody filled with the text in table i_tab.

But it creates txt file in attachtement. In this file appears my mailbody text.

can some body tell me my mistake. what should I do that i_tab text in mail body appears.

here is my code

TRY.

CALL METHOD cl_document_bcs=>create_from_text

EXPORTING

i_text = i_tab

i_documenttype = 'RAW'

i_subject = l_btr

i_importance = '0'

i_sensitivity = 'P'

RECEIVING

result = l_result.

CATCH cx_document_bcs .

ENDTRY.

regards

rana

2 REPLIES 2
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
445


"This might help you 

DATA:list_object TYPE TABLE OF abaplist.
DATA:listasci(128) TYPE c OCCURS 0.
DATA:   BEGIN OF int_tline1 OCCURS 100.
        INCLUDE STRUCTURE tline.
DATA:   END OF int_tline1.
DATA:it_text TYPE soli_tab.
DATA: wa_text LIKE LINE OF it_text.
DATA:wa_ascii LIKE LINE OF listasci.
DATA: send_request       TYPE REF TO cl_bcs.
DATA: recipient          TYPE REF TO if_recipient_bcs.
DATA: document           TYPE REF TO cl_document_bcs.
DATA: sent_to_all        TYPE os_boolean.

SUBMIT yprogram2 EXPORTING LIST TO MEMORY AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject = list_object.

CALL FUNCTION 'LIST_TO_ASCI'
  TABLES
    listasci           = listasci
    listobject         = list_object
  EXCEPTIONS
    empty_list         = 1
    list_index_invalid = 2
    OTHERS             = 3.

LOOP AT listasci INTO wa_ascii.
  wa_text-line = wa_ascii.
  APPEND  wa_text-line TO it_text.
ENDLOOP.

TRY.
  send_request = cl_bcs=>create_persistent( ).
  document = cl_document_bcs=>create_document(
                            i_type = 'RAW'
                            i_text = it_text        "<-----mail content
                            i_subject = 'Test mail' ).
  send_request->set_document( document ).
  recipient  = cl_cam_address_bcs=>create_internet_address( )."Include email inside the brackets
  send_request->add_recipient( i_recipient = recipient ).
  send_request->set_send_immediately( 'X' ).
  send_request->send( EXPORTING i_with_error_screen = 'X' ).
  COMMIT WORK.
ENDTRY.
Read only

Former Member
0 Likes
445

Thanks for your reply I have called the method correct. But it was a problem of patch level. In Ta sodis I changed user specification