‎2006 Sep 12 2:48 PM
is there any function module to send report output to an email , this is alv report.
when i am ru in batch mode then this should happen
pls send me the parameters to pass for that function module.
its urgent.
‎2006 Sep 12 2:50 PM
hi,
pls use the FM - >'SO_NEW_DOCUMENT_ATT_SEND_API1'
rgds
anver
‎2006 Sep 12 2:50 PM
hi,
pls use the FM - >'SO_NEW_DOCUMENT_ATT_SEND_API1'
rgds
anver
‎2006 Sep 12 2:54 PM
hey venu,
check the below code may be helpful for u
Finding the user-exits of a SAP transaction code
*
Finding the user-exits of a SAP transaction code
*
Enter the transaction code in which you are looking for the user-exit
and it will list you the list of user-exits in the transaction code.
Also a drill down is possible which will help you to branch to SMOD.
*
Written by : SAP Basis, ABAP Programming and Other IMG Stuff
report zuserexit no standard page heading.
tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
tables : tstct.
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
parameters : p_tcode like tstc-tcode obligatory.
select single * from tstc where tcode eq p_tcode.
if sy-subrc eq 0.
select single * from tadir where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = tstc-pgmna.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
select single * from trdir where name = tstc-pgmna.
if trdir-subc eq 'F'.
select single * from tfdir where pname = tstc-pgmna.
select single * from enlfdir where funcname =
tfdir-funcname.
select single * from tadir where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
endif.
endif.
select * from tadir into table jtab
where pgmid = 'R3TR'
and object = 'SMOD'
and devclass = v_devclass.
select single * from tstct where sprsl eq sy-langu and
tcode eq p_tcode.
format color col_positive intensified off.
write:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
skip.
if not jtab[] is initial.
write:/(95) sy-uline.
format color col_heading intensified on.
write:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
write:/(95) sy-uline.
loop at jtab.
select single * from modsapt
where sprsl = sy-langu and
name = jtab-obj_name.
format color col_normal intensified off.
write:/1 sy-vline,
2 jtab-obj_name hotspot on,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
endloop.
write:/(95) sy-uline.
describe table jtab.
skip.
format color col_total intensified on.
write:/ 'No of Exits:' , sy-tfill.
else.
format color col_negative intensified on.
write:/(95) 'No User Exit exists'.
endif.
else.
format color col_negative intensified on.
write:/(95) 'Transaction Code Does Not Exist'.
endif.
at line-selection.
get cursor field field1.
check field1(4) eq 'JTAB'.
set parameter id 'MON' field sy-lisel+1(10).
call transaction 'SMOD' and skip first screen.
*---End of Program
Regards,
Naveen
‎2006 Sep 12 3:02 PM
The FM in comments is to just send it as email while the one is use is to send it as attachement.
form SEND_EMAIL tables IT_MESSAGE type T_MESSAGE.
data: IS_DOCDATA type SODOCCHGI1,
IS_RECEIVERS type SOMLRECI1,
IS_RECEIVERS_COPY type SOMLRECI1,
IT_RECEIVERS type table of SOMLRECI1,
IS_CONTENT type SOLISTI1,
IT_CONTENT type table of SOLISTI1,
*500369789+
l_txt(255) type c,
lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,
l_tab_lines TYPE i,
l_att_type LIKE soodk-objtp.
*500369789+
IS_DOCDATA-OBJ_NAME = 'MAIL'.
IS_DOCDATA-PRIORITY = 5.
IS_DOCDATA-OBJ_LANGU = SY-LANGU.
IS_DOCDATA-NO_CHANGE = 'X'.
IS_DOCDATA-OBJ_DESCR = SY-CPROG.
loop at IT_MESSAGE into IS_MESSAGE.
clear : IS_CONTENT, l_txt. "500369789+
move is_message-line to l_txt. "500369789+
move IS_MESSAGE-LINE to IS_CONTENT-LINE. "500369789-
move l_txt to IS_CONTENT-LINE. "500369789+
append IS_CONTENT to IT_CONTENT.
endloop.
*---select_email_address
select single
EMAILADDR
CCEMAILADDR
into (IS_RECEIVERS-RECEIVER, IS_RECEIVERS_COPY-RECEIVER)
from ZGL_EMAILCTRL
where IDENT = ''
and ZPROGRAM = 'Z_L_SO_CREA'
and ACTIVE = 'X'.
if IS_RECEIVERS-RECEIVER is not initial.
IS_RECEIVERS-REC_TYPE = 'U'.
IS_RECEIVERS_COPY-REC_TYPE = 'U'.
IS_RECEIVERS_COPY-COPY = 'X'.
append IS_RECEIVERS to IT_RECEIVERS.
append IS_RECEIVERS_COPY to IT_RECEIVERS.
*500369789+
lt_objhead-line = 'USA Order Report'.
append lt_objhead.
DESCRIBE TABLE lt_objhead LINES l_tab_lines.
CLEAR lt_objpack-transf_bin.
lt_objpack-doc_size = STRLEN( lt_objhead ).
lt_objpack-head_start = 1.
lt_objpack-head_num = 1.
lt_objpack-body_start = 1.
lt_objpack-body_num = 1.
lt_objpack-doc_type = 'RAW'.
APPEND lt_objpack.
l_att_type = 'RAW'.
DESCRIBE TABLE it_content LINES l_tab_lines.
READ TABLE it_content into is_content INDEX l_tab_lines.
lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255.
lt_objpack-doc_size = lt_objpack-doc_size + STRLEN( is_content ).
lt_objpack-transf_bin = 'X'.
lt_objpack-head_start = 1.
lt_objpack-head_num = 2.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = l_att_type.
lt_objpack-obj_name = 'ATTACHMENT'.
concatenate 'Usa' SY-DATUM+6(2) SY-DATUM+4(2) into
lt_objpack-obj_descr. "#EC *
APPEND lt_objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = IS_DOCDATA
commit_work = 'X'
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_txt = lt_objhead
contents_bin = it_content
receivers = it_receivers
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.
*500369789+
*500369789-
SEND EMAIL FOR PLANTS
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
DOCUMENT_TYPE = 'RAW'
DOCUMENT_DATA = IS_DOCDATA
COMMIT_WORK = 'X'
tables
OBJECT_CONTENT = IT_CONTENT
RECEIVERS = IT_RECEIVERS
exceptions
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
others = 99.
*500369789-
if SY-SUBRC <> 0.
endif.
endif.
endform. "send_email
‎2006 Sep 12 3:03 PM
‎2006 Sep 12 3:17 PM
‎2006 Sep 12 3:24 PM
as you asked to send mail only in BACKGROUND MODE,so you have to use system variable BATCH.
IF SY-BATCH = 'X'.
*--Program is running in background mode.
PERFORM F_SEND_MAIL.
ENDIF.
FORM F_SEND_MAIL.
*-Check this link,to know how to send mail.
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
ENDFORM.