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: 

check the code pls. getting attachment but some data missing

Former Member
0 Kudos

HI all,

PLs check the code. I am getting mail in the attachment is having only " 12". i am not getting 13 and 14.

where i am doing wrong. ?

TABLES:adr6.

TYPES: BEGIN OF t_test,

x(3),

y(3),

z(3),

END OF t_test.

DATA: itab TYPE STANDARD TABLE OF t_test,

wa TYPE t_test.

SELECT-OPTIONS : s_rcvr FOR adr6-smtp_addr LOWER CASE VISIBLE LENGTH 30

NO INTERVALS OBLIGATORY.

wa-x = 12.

wa-y = 13.

wa-z = 14.

APPEND wa TO itab.

*LOOP at itab INTO wa.

  • WRITE:/ wa-x, wa-y, wa-z.

*ENDLOOP.

PERFORM send_email.

*&----


**& Form send_email

**&----


*

*

*text

*----


*

*--> p1 text

*<-- p2 text

*----


FORM send_email .

DATA : lo_mail_docu TYPE REF TO cl_document_bcs,

lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,

lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL ,

lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL ,

l_oref TYPE REF TO cx_root,

l_message_body TYPE bcsy_text VALUE IS INITIAL,

l_message_line LIKE LINE OF l_message_body,

l_doc_subject TYPE so_obj_des,

l_file_subject TYPE so_obj_des,

l_mail_subject TYPE string,

l_text TYPE string.

DATA itab_bin TYPE TABLE OF solix.

CONCATENATE 'Error' ' Log ' INTO l_doc_subject SEPARATED BY space.

l_mail_subject = l_doc_subject.

CALL FUNCTION 'SCMS_TEXT_TO_BINARY'

TABLES

text_tab = itab

binary_tab = itab_bin.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CONCATENATE 'Attached is the' 'log file generated '

INTO l_message_line-line SEPARATED BY space.

APPEND l_message_line TO l_message_body.

APPEND '' TO l_message_body. APPEND '' TO l_message_body.

TRY.

lo_mail_docu = cl_document_bcs=>create_document(

i_type = 'RAW'

i_text = l_message_body

i_subject = l_doc_subject ).

lo_mail_docu->add_attachment(

EXPORTING

i_attachment_type = 'TXT'

i_attachment_subject = l_file_subject

i_att_content_hex = itab_bin ).

lo_send_request = cl_bcs=>create_persistent( ).

CALL METHOD lo_send_request->set_message_subject

EXPORTING

ip_subject = l_mail_subject.

LOOP AT s_rcvr .

lo_recipient = cl_cam_address_bcs=>create_internet_address( s_rcvr-low ).

lo_send_request->add_recipient(

EXPORTING

i_recipient = lo_recipient

i_express = '' ).

ENDLOOP.

lo_send_request->set_document( lo_mail_docu ).

lo_send_request->set_send_immediately( 'X' ).

lo_send_request->send( ).

CATCH : cx_send_req_bcs INTO l_oref,

cx_document_bcs INTO l_oref,

cx_address_bcs INTO l_oref.

ENDTRY.

COMMIT WORK.

FREE : lo_mail_docu, lo_send_request, lo_sender, lo_recipient, l_oref.

REFRESH : l_message_body, itab_bin.

CLEAR : l_message_line, l_doc_subject, l_mail_subject, l_file_subject,

l_text.

ENDFORM. "send_email

Thanks

krupali

2 REPLIES 2

Jelena
Active Contributor
0 Kudos

Try commenting out CALL FUNCTION 'SCMS_TEXT_TO_BINARY'.

Former Member
0 Kudos

HI Jelena,

I think we cannot commenting the

CALL FUNCTION 'SCMS_TEXT_TO_BINARY' because we are transfering the data in binary format.

Have you got the mail with full ITAb data ?

have you tried it ?

I have tried by commenting the

CALL FUNCTION 'SCMS_TEXT_TO_BINARY' but getting syntax error.

Any other idea please ?

Thanks in advance

krupali.