Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

HR: Need to Send the Paysilp as a PDF file through Mail to Employees

Former Member
0 Kudos

Dear All ,

Need to Send the Paysilp as a PDF file through Mail to Employees.

can anyone please suggest any Standard Function Modules which takes the Payslip Form as input and convert it into PDF and can send it through mail to the concern employees.

Can anyone please explain the procedure in detail.

Thanks in Advance,

Regards.

5 REPLIES 5

Former Member
0 Kudos

HI ,

Try FMs:

<b>HRHAP_DOC_CONVERT_SMF_TO_PDF</b> - converts smartforms to PDF

then use

<b>FM SO_DOCUMENT_SEND_API1</b> - to send mail along with pdf attachment

*Reward with points for helpful answers

Regards,

Amit

0 Kudos

The requirement is

when the payslip is generated then I have to run a program. so that the Payslip shoul be converted into PDF format and that PDF should be posted to all the corresponding Employees.

For this I need help.

0 Kudos

venu,

below is code which helps to generate pdf ,,,,hope u know how to use the mail sending function

data:

fm_name TYPE RS38L_FNAM, "Smart Forms: FM Name

sf_name TYPE TDSFNAME

value 'YOUR_FORM_NAME', "Smart Forms: Form Name

P_OUTPUT_OPTIONS TYPE SSFCOMPOP,

P_JOB_OUTPUT_INFO TYPE SSFCRESCL,

P_CONTROL_PARAMETERS TYPE SSFCTRLOP,

P_LANGUAGE TYPE SFLANGU value 'E',

P_E_DEVTYPE TYPE RSPOPTYPE.

data:

P_BIN_FILESIZE TYPE I,

P_BIN_FILE TYPE XSTRING,

P_OTF type table of ITCOO,

P_DOCS type table of DOCS,

P_LINES type table of TLINE,

name type string,

path type string,

fullpath type string,

filter type string,

guiobj type ref to cl_gui_frontend_services,

uact type i,

filename(128).

*"----


GET SMARTFORM FUNCTION MODULE NAME ---

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = sf_name

IMPORTING

FM_NAME = fm_name

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

EXPORTING

I_LANGUAGE = P_LANGUAGE

I_APPLICATION = 'SAPDEFAULT'

IMPORTING

E_DEVTYPE = P_E_DEVTYPE.

P_OUTPUT_OPTIONS-XSFCMODE = 'X'.

P_OUTPUT_OPTIONS-XSF = SPACE.

P_OUTPUT_OPTIONS-XDFCMODE = 'X'.

P_OUTPUT_OPTIONS-XDF = SPACE.

P_OUTPUT_OPTIONS-TDPRINTER = P_E_DEVTYPE.

P_CONTROL_PARAMETERS-NO_DIALOG = 'X'.

P_CONTROL_PARAMETERS-GETOTF = 'X'.

****...................................PRINTING.........................

CALL FUNCTION fm_name

EXPORTING

CONTROL_PARAMETERS = P_CONTROL_PARAMETERS

OUTPUT_OPTIONS = P_OUTPUT_OPTIONS

  • (....) <--- your form import parameters

IMPORTING

JOB_OUTPUT_INFO = P_JOB_OUTPUT_INFO.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

P_OTF[] = P_JOB_OUTPUT_INFO-OTFDATA.

****...................................CONVERT TO PDF...............

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

BIN_FILESIZE = P_BIN_FILESIZE

TABLES

OTF = P_OTF

DOCTAB_ARCHIVE = P_DOCS

LINES = P_LINES

EXCEPTIONS

ERR_CONV_NOT_POSSIBLE = 1

ERR_OTF_MC_NOENDMARKER = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

now you can mail the pdf.

Reward points if helpful

Regards,

jinesh

0 Kudos

Yeah Thank you

C the requirement is .

You generate the Payslip then it has to be converted to SAP Script or Smart form then the procedure will be OK

As we are supporting a client here whose version is 4.7., so many FM are not available in that version.

I am able to Convert Payslip to Script format then how to proceed and what should be passed in the parameter list of FM .

I ma really getting confuesd.

former_member223537
Active Contributor
0 Kudos

Refer the following link for sample program:

http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm