Skip to Content
0
Former Member
Mar 23, 2011 at 07:19 AM

Reg: HRforms converted to PDF and send email to individual employee

559 Views

Hi Experts,

The requirement is convert the HR form output to pdf and send email to respective employee in standard transaction. I copied RPCEDTX0 to ZRPCEDTX0 and include RPCEDS09 to ZRPCEDS09, the changes need to be done for individual PERNR, I have modified the include as shown below.

   CALL FUNCTION 'HRPY_PROCESS_SET_PERNR_STATUS' after this, i have written my code
* start of changes ARAFIQUE
  DATA: formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
        fm_name TYPE rs38l_fnam,
        pinfo LIKE pc407 OCCURS 0 WITH HEADER LINE,
        pform type tt_pc408,
        pform_l like pc408 OCCURS 0 WITH HEADER LINE.
  IF xform[] IS NOT INITIAL.
    pform_l = xform.
    APPEND pform_1 TO pform.
    pinfo-molga = '99'.
    pinfo-forml = 'ZACC'.
    APPEND pinfo.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname                 = formname
*       VARIANT                  = ' '
*       DIRECT_CALL              = ' '
     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 fm_name
      EXPORTING
        pinfo                      =
        pform                      = xform[]
 EXCEPTIONS
   FORMATTING_ERROR           = 1
   INTERNAL_ERROR             = 2
   SEND_ERROR                 = 3
   USER_CANCELED              = 4
   OTHERS                     = 5
              .
    IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
  ENDIF.
* end of changes ARAFIQUE

I found out in internet that the smartform 'HR_ESS_PAYSLIP_TO_PDF' will convert to PDF and then i can send email to PERNRS.