Application Development and Automation 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: 
Read only

converting sapscript to pdf

Former Member
0 Likes
1,097

Hi All,

I want to create a remote enable function module which converts the employee's paylip to pdf file and store this file in a folder on the application server.

How can i do this please guide.

Rewards will be given for suitable answer.

Regards,

Bharat Mistry.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,014
* get raw version of payslip
      call function 'GET_PAYSLIP_SUBMODULE'
           exporting
                employee_number = i_tab-pernr
                sequence_number = hrpy_rgdir-seqnr
                payslip_variant = 'PAYSLIP'  "PC00_M40_CEDT
           importing
                return          = return
                p_info          = p_info
           tables
                p_form          = p_form.


* any errors occured
      check return is initial.

* get list of indices
      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.

<b>* create list
      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.

</b>

based on the Ur requirement ? check this code which gives the payslip Script format i.e nothing but output of the payslip.

here u can do two things

1.Convert this raw data into PDF as ravi said , by using Fms

2.or what u can do is ,Write these data into Application server.Whenever u want the data ? just read this data and convert into PDF.

Regards

Prabhu

9 REPLIES 9
Read only

Former Member
0 Likes
1,015
* get raw version of payslip
      call function 'GET_PAYSLIP_SUBMODULE'
           exporting
                employee_number = i_tab-pernr
                sequence_number = hrpy_rgdir-seqnr
                payslip_variant = 'PAYSLIP'  "PC00_M40_CEDT
           importing
                return          = return
                p_info          = p_info
           tables
                p_form          = p_form.


* any errors occured
      check return is initial.

* get list of indices
      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.

<b>* create list
      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.

</b>

based on the Ur requirement ? check this code which gives the payslip Script format i.e nothing but output of the payslip.

here u can do two things

1.Convert this raw data into PDF as ravi said , by using Fms

2.or what u can do is ,Write these data into Application server.Whenever u want the data ? just read this data and convert into PDF.

Regards

Prabhu

Read only

0 Likes
1,014

Hi Prabhu,

I seems that your code will help me. Can you just tell me the type of f__cmd-newpage, f__ltype-cmd and p_index?

Regards,

Bharat Mistry

Read only

Former Member
0 Likes
1,014

check this program it converts and download the sapscript into PDF.

<b>RSTXPDFT4.</b>

and transaction <b>CG3Z</b> upload it into application server.

Read only

anversha_s
Active Contributor
0 Likes
1,014

hi,

CONVERT_OTFSPOOLJOB_2_PDF

converts a OTF spool to PDF (i.e. Sapscript document)

regrds

anver

Read only

Former Member
0 Likes
1,014

I think you can use the bapi BAPI_GET_PAYSLIP which Generates Remuneration Statement for Employee in SAPscript Format.

Then you can pass the form name to HRFORMS_CALL_PDF to get the pdf form for the script.

Regards,

Ravi

Read only

0 Likes
1,014

Hi Ravi,

The fm BAPI_GET_PAYSLIP returns the payslip in sapscript fomrat but how can i store it as sapscript and pass its name to the fm HRFORMS_CALL_PDF?

Regards

Bharat Mistry

Read only

0 Likes
1,014

the bapi BAPI_GET_PAYSLIP will return a tables parameter: PAYSLIP.

This will be in otf format.

then you can convert otf data into pdf using the fm:

CONVERT_OTF_2_PDF

then you can store it in the application server using

open dataset/transfer /close dataset statements.

regards,

ravi

Read only

Former Member
0 Likes
1,014

Hi Bharath,

Check out the programs in package STXD, hope you get a program that suits your requirement there.

Cheers..

Santosh.

Read only

Former Member
0 Likes
1,014

hi use this fm CONVERT_ABAPSPOOLJOB_2_PDF.

U can also use the fm CONVERT_OTFSPOOLJOB_2_PDF to convert otf to pdf.

Regards,

Ram