cancel
Showing results for 
Search instead for 
Did you mean: 

Salary slip delivery through email

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

former_member188685
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

former_member66888
Participant
0 Kudos

Hi,

I am getting the mail attachment in my inbox but the file contains garbled data. It is in .ALI format. Do i need to add some code to convert it into html or something?

Thanks

former_member188685
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.