Skip to Content
0
Nov 21, 2012 at 08:17 PM

SO_NEW_DOCUMENT_ATT_SEND_API1 - Email Text Problem in APD

50 Views


Hi Experts,


I have used the FM "SO_NEW_DOCUMENT_ATT_SEND_API1" to trigger auto email from APD after executing the query.


I am facing problem in the Email Body Text. I have concatenated 3 different lines in the 3 different string variables and appended the same in to the LT_MAILTEXT , which was fed to the function module.


But , am getting only the first line in my email body text. Below is the source code extract


CONCATENATE '<body>' '<p align="justify"> The Scenario id '

<fs_error>-/bic/gwscn_id

'and profit center ' <fs_error>-/bic/gfiproctr

' between summary cube and staging cube has'

'been validated,'

INTO w_c1 SEPARATED BY space.


CONCATENATE ' but the difference crossed the error'

'threshold limit.' "' The Scenario id '

<fs_error>-/bic/gwscn_id 'and profit center '

<fs_error>-/bic/gfiproctr 'has been deleted and'

'will not be available for reporting.'

INTO w_c2

SEPARATED BY space.



CONCATENATE 'The attachment contains the data received by'

'FMR which failed validation and was deleted'

'from FMR.' 'Please initiate investigation and'

'troubleshooting.' '</P> <br>Regards<br>'

'FMR-Operations Team </body>'

INTO w_c3 SEPARATED BY space .


lt_mailtxt = w_c1. APPEND lt_mailtxt. CLEAR lt_mailtxt.

lt_mailtxt = w_c2. APPEND lt_mailtxt. CLEAR lt_mailtxt.

lt_mailtxt = w_c3. APPEND lt_mailtxt. CLEAR lt_mailtxt.


When i debug , here im getting the Appended 3 lines in lt_mailtxt , but when sending an email, getting only the value in the first line.


CLASS cl_abap_char_utilities DEFINITION LOAD.

CONCATENATE 'PROFIT CENT' 'SCN.ID' 'DIFFERENCE' 'AMOUNT'

INTO lt_attachment SEPARATED BY

cl_abap_char_utilities=>horizontal_tab.

APPEND lt_attachment. CLEAR lt_attachment.



CONCATENATE <fs_error>-/bic/gfiproctr <fs_error>-/bic/gwscn_id

<fs_error>-difference <fs_error>-gfikfain

INTO lt_attachment SEPARATED BY

cl_abap_char_utilities=>horizontal_tab.


CONCATENATE cl_abap_char_utilities=>newline lt_attachment

INTO lt_attachment.


APPEND lt_attachment. CLEAR lt_attachment.


lt_packing_list-transf_bin = space.

lt_packing_list-head_start = 1.

lt_packing_list-head_num = 0.

lt_packing_list-body_start = 1.

lt_packing_list-body_num = LINES( lt_mailtxt ).

lt_packing_list-doc_type = 'HTM'.

APPEND lt_packing_list. CLEAR lt_packing_list.


lt_packing_list-transf_bin = 'X'.

lt_packing_list-head_start = 1.

lt_packing_list-head_num = 1.

lt_packing_list-body_start = 1.

lt_packing_list-body_num = LINES( lt_attachment ).

lt_packing_list-doc_type = 'XLS'.

lt_packing_list-obj_name = 'ERROR.xls'.

lt_packing_list-obj_descr = 'ERROR.xls'.

lt_packing_list-doc_size = lt_packing_list-body_num * 255.

APPEND lt_packing_list. CLEAR lt_packing_list.


lt_mailsubject-obj_name = 'MAILATTCH'.

lt_mailsubject-obj_langu = sy-langu.

lt_mailsubject-obj_descr = w_sub.

lt_mailsubject-sensitivty = 'F'.

gv_cnt = LINES( lt_attachment ).

lt_mailsubject-doc_size = ( gv_cnt - 1 ) * 255 + STRLEN(

lt_attachment ).


CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = lt_mailsubject

TABLES

packing_list = lt_packing_list

contents_bin = lt_attachment

contents_txt = 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 EQ 0.

COMMIT WORK.

SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.

ENDIF.


Regards


Sriram