on 02-07-2006 4:39 AM
I want to send the monthly salary slip to the employees email id. i would like your suggestions on how to go ahead with this.
Hi Sanchit,
1. Use GET_PAYSLIP FM to get Employee Payslip Data.
2. Use SO_NEW_DOCUMENT_ATT_SEND_API1 FM to send mail to respective employee.
Regards,
Digesh Panchal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am unable to send the email out using the Function Module: SO_NEW_DOCUMENT_ATT_SEND_API1
If any of you could help me out with the source code it would be of great help.
Settings are fine coz the emails can be sent thru T-CODE : SBWP
This is my code. After sy-subrc i get the message Mail sent to but it does not actually go out.
DATA: objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
doc_chng LIKE sodocchgi1,
tab_lines LIKE sy-tabix.
PARAMETER p_eaddr LIKE reclist-receiver. "EXTERNAL E-MAIL ADDRESS
doc_chng-obj_name = 'SENDFILE'.
doc_chng-obj_descr = 'SEND EXTERNAL MAIL'.
objtxt = 'LINE 1 OF MESSAGE'.
APPEND objtxt.
objtxt = 'LINE 2 OF MESSAGE'.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
reclist-receiver = p_eaddr.
reclist-rec_type = 'U'.
APPEND reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 3
OTHERS = 4.
IF sy-subrc EQ 0.
WRITE:/ 'E-MAIL MESSAGE SENT TO', p_eaddr.
ELSE.
WRITE:/ 'COULD NOT SEND E-MAIL TO', p_eaddr.
ENDIF.
hi,
you need to check the configuration setting also..
contact your basis team.,
check the sample code in the below link..
http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
regards
vijay
Hi again,
1. This is my code. After sy-subrc i get the message Mail sent to but it does not actually go out
Thats because
on the application server,
the SCOT program (program for sending mails)
runs at pre-defined INTERVAL.
2. This interval is set by basis team.
3. Using SCOT tcode,
we can manuually press some button
to send the mails immediately.
regards,
amit m.
Hi,
If you are using scripts/smartforms you need to convert otf data to pdf and send the pdf salary slip as attachment via email.
regards
vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sanchit,
1. below is the snapshot code
2. The main points are :
a)using hrpy_rgdir and field seqnr,
b) use FM GET_PAYSLIP
c) then using submit RPCEDT_LIST_TO_MEMORY
(this will print the payslip in MEMORY)
d) then using LIST_FROM_MEMORY
capture the list in variable
e) compress this data using TABLE_COMPRESS
f) then pass this data to objbin to email FM.
3.
select single * from HRPY_RGDIR
where PERNR eq ITAB-PERNR
and FPPER = FOR_PERIOD
and INPER = IN_PERIOD.
if SY-SUBRC = 0.
call function 'GET_PAYSLIP'
exporting
EMPLOYEE_NUMBER = ITAB-PERNR
SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
PAYSLIP_VARIANT = PAY_VAR
importing
RETURN = RETURN
P_INFO = P_INFO
tables
P_FORM = P_FORM.
check RETURN is initial.
loop at P_FORM where LINDA eq F__CMD-NEWPAGE
and LTYPE eq F__LTYPE-CMD.
P_INDEX-INDEX = SY-TABIX.
append P_INDEX.
endloop.
P_IDX = 1.
refresh P_P_FORM.
append lines of P_FORM from P_IDX to P_INDEX-INDEX to P_P_FORM.
P_IDX = P_INDEX-INDEX.
export P_P_FORM to memory id '%%_P_FORM_%%'.
export P_INFO to memory id '%%_P_INFO_%%'.
submit RPCEDT_LIST_TO_MEMORY exporting list to memory and return.
call function 'LIST_FROM_MEMORY'
tables
LISTOBJECT = P_LIST.
call function 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
tables
IN = P_LIST
OUT = OBJBIN
exceptions
others = 1.
OBJHEAD = 'Objhead'.
append OBJHEAD.
regards,
amit m.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.