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: 

ABAP HR - How to insert payroll results using fm PYXX_WRITE_PAYROLL_RESULT

Former Member
0 Kudos

Hi,

I have a scenario where I want to read cluster information (PCL2 RX) from system A and insert it into system B. Both systems are SAP ECC 6.0. Employee master data already exists on target system, but no payroll results yet, so this is an insert and not an update.

I am using fm PYXX_READ_PAYROLL_RESULT (I also tried with HRCM_PAYROLL_RESULTS_GET) to read the data and then calling a RFC on system B where I use fm PYXX_WRITE_PAYROLL_RESULT to write the payroll results into database. Is this fm only to use in case of update, or it should also work when inserting new lines on the cluster? Because I always get a sy-subrc=0 but nothing is created on the db. Is there any other way to this? Do you have any code samples?

Many thanks,

Miguel

9 REPLIES 9

Former Member
0 Kudos

Hi,

Use macro rp-exp-c2-ru and export results.

Regards,

Srini.

0 Kudos

Hi Srini,

Thanks for the response. I am using macro rp-exp-c2-rx. What happens now is that an entry is created on PCL2 table, but no entries are created on other tables of the cluster, like HRPY_WPBP for example. When I go to transaction PC_PAYRESULT no payroll entries exist, so this is creating the header for the cluster (PCL2) but somehow nothing under it. Any hints?

Thanks,

Miguel

0 Kudos

Hi Miguel,

You need to populate all the structures while calling this macro. like RT , CRT , BT , WPBP etc ...

Regards,

Srini.

0 Kudos

Hi again,

Yes, all those structures are filled. I am doing it like:

[...]
    rx-key-pernr = employeenumber.
    rx-key-seqno = sequencenumber.
[...]
   wpbp[] = pay_result-inter-wpbp[].
    abc[] = pay_result-inter-abc[].
    rt[] = pay_result-inter-rt[].
    crt[] = pay_result-inter-crt[].
    bt[] = pay_result-inter-bt[].
    c0[] = pay_result-inter-c0[].
    c1[] = pay_result-inter-c1[].
[...]
    rp-exp-c2-rx.
[...]
    commit work.
[...]

(pay_result is the result of fm 'PYXX_READ_PAYROLL_RESULT'. - and data is in, I checked in debug mode)

Is there something else missing? Have you ever done it for creating new payroll entries from scratch? Or just to update existing entries on the cluster?

Many thanks,

M

Edited by: Miguel Chaves on Mar 12, 2010 5:19 PM

Former Member
0 Kudos

HI Miguel :

I have the same request,By now you have no good solution. Thank you

Bjarne chen.

Former Member
0 Kudos

HI Miguel:

I have succe add of new payroll records, the following reference code:

&----


*& Report ZTEST_BJARNE8

*&

&----


*&

*&

&----


REPORT ztest_bjarne8.

TABLES:pcl1,pcl2.

**********************************************************************

INCLUDE rpc2cd00. "Cluster CD data definition

INCLUDE rpc2ca00. "Cluster CA Data-Definition

INCLUDE pc2rxcn0. "Cluster CN data definition

INCLUDE rpc2rx00. "Cluster RX data definition internat. part

**********************************************************************

DATA: refvar_curr TYPE REF TO data.

DATA: refvar_prev TYPE REF TO data.

DATA: refvar_cumul TYPE REF TO data.

DATA: t52relid_header TYPE t52relid.

FIELD-SYMBOLS: <payresult_current>.

DATA: employee_number LIKE pc200-pernr,

client LIKE sy-mandt,

globalmolga TYPE T500L-MOLGA,

cluster_id LIKE t500l-relid,

isocode LIKE t500l-intca.

DATA: rgdir_entry LIKE pc261.

CALL FUNCTION 'HR_PCLX_INIT_BUFFER'.

employee_number = '81000463'.

CLEAR:rgdir.REFRESH rgdir[].

CALL FUNCTION 'CU_READ_RGDIR_NEW'

EXPORTING

persnr = employee_number

check_read_authority = space

imp_client = client

TABLES

in_rgdir = rgdir

EXCEPTIONS

no_record_found = 1

import_mismatch_error = 2

no_read_authority = 3

OTHERS = 4.

LOOP AT rgdir.

ENDLOOP.

cluster_id = 'CN'.

SELECT SINGLE * FROM t52relid INTO t52relid_header

WHERE relid = cluster_id.

CREATE DATA refvar_curr TYPE (t52relid_header-typename).

ASSIGN refvar_curr->* TO <payresult_current>.

CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'

EXPORTING

clusterid = cluster_id

employeenumber = employee_number

sequencenumber = rgdir-seqnr

check_read_authority = space"false "already done

filter_cumulations = space

CHANGING

payroll_result = <payresult_current>

EXCEPTIONS

illegal_isocode_or_clusterid = 1

error_generating_import = 2

import_mismatch_error = 3

subpool_dir_full = 4

no_read_authority = 5

no_record_found = 6

versions_do_not_match = 7

OTHERS = 8.

IF NOT <payresult_current> IS INITIAL.

"TODO changed RT data......

"Add new month payresult

rgdir-seqnr = rgdir-seqnr + 1.

CALL FUNCTION 'PYXX_WRITE_PAYROLL_RESULT'

EXPORTING

clusterid = cluster_id

employeenumber = employee_number

sequencenumber = rgdir-seqnr

payroll_result = <payresult_current>

  • CLIENT =

EXCEPTIONS

illegal_isocode_or_clusterid = 1

error_generating_export = 2

export_error = 3

subpool_dir_full = 4

no_update_authority = 5

incomplete_result_imported = 6

OTHERS = 7

.

IF sy-subrc <> 0.

ENDIF.

".......

APPEND rgdir.

globalmolga = '28'.

client = '200'.

CALL FUNCTION 'CU_WRITE_RGDIR_NEW'

EXPORTING

persnr = employee_number

molga = globalmolga

imp_client = client

TABLES

rgdir = rgdir

EXCEPTIONS

no_update_authority = 1

OTHERS = 2.

CALL FUNCTION 'HR_FLUSH_BUFFER_UPDATE_PCLX'

EXPORTING

test = space

EXCEPTIONS

insert_error = 1

no_update_authority = 2

OTHERS = 3.

IF sy-subrc <> 0.

"MESSAGE e062.

ENDIF.

ENDIF.

"INCLUDE rpc2cd09.

&----


*& INCLUDE

&----


INCLUDE rpppxd00. "Data definition buffer PCL1/PCL2

INCLUDE rpppxd10. "Common part buffer PCL1/PCL2

INCLUDE rpppxm00. "Buffer handling routine

0 Kudos

This worked Chen... Tq...

0 Kudos

HI

I am trying to do similar things but stil i am not able to copy the results.

I could see now that there are entries in the table PCL2 when i try to see the results using PC_Payresult i don't see the results there.

Any further pointers?

Regards,

umesh

0 Kudos

Hi Umesh,

Can you relate the entries in PCL2 and you selection criteria in PC_PAYRESULT ?

I'd say if you see the entries in PCL2 and not in PC_PAYRESULT take help of your functional consultant to analyze/understand this from data perspective and understand this for your future reference.