Hi All,
I have developed a program to send internal table as excel attachment in email via background mode.
I am calling function module RSPO_RETURN_ABAP_SPOOLJOB to get spool data in internal table.
Once i got data in internal table ITAB,using below code , I am aligning data into proper format.
******Add horizontal tab # for excel formatting****
LOOP AT ITAB INTO ls_data.
REPLACE ALL OCCURRENCES OF '|' IN ls_data-line WITH cl_abap_char_utilities=>horizontal_tab.
MODIFY t_get_spooldata FROM ls_data.
CLEAR:ls_data.
ENDLOOP.
LOOP AT t_get_spooldata INTO ls_data..
CONCATENATE cl_abap_char_utilities=>cr_lf ls_data INTO iattach.
APPEND iattach.
ENDLOOP
and then sending excel attachment using below FM:
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = xdocdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = ipacking_list
contents_bin = iattachment
contents_txt = imessage
receivers = ireceivers
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.
Now the issue is , It is not sending email in background mode.But, if i debug finished background job of the program , It is sending email with excel sheet.
Please help if anybody work on similar requirement.
Thanks,
Arpita