2. dengan macro
3. dengan Function
ketiga caranya dapat dilihat di program contoh di bawah ini.
Code:
**************************************************************
* Report Desc : Read Payroll Result *
* Abaper : Dicky.z *
**************************************************************
REPORT zcoba1.
TABLES: pernr, pcl1, pcl2, pc260.
INCLUDE: pc2rxid0,
rpc2rx02,
rpc2rx39,
rpc2rx29,
rpc2cd09,
RPPPXD00,
RPPPXD10,
RPPPXM00.
.
DATA: result TYPE payid_result.
DATA: country TYPE t001p-molga.
PARAMETER: cara(1).
START-OF-SELECTION.
GET pernr.
*-- Import CU (Cluster Directory) Cluster
* CU Cluster have Table RGDIR which contains the directory of all of an
* Employee's Payroll results
CLEAR rp-imp-is-subrc.
cd-key-pernr = pernr-pernr. "Fill the Key for reading CU cluster
***************************************************************
IF cara EQ '1'.
* cara 1
IMPORT rgdir FROM DATABASE pcl2(cu) ID cd-key-pernr.
ELSEIF cara EQ '2'.
* cara 2
rp-imp-c2-cu. "MACRO to Import CU Cluste
ELSE.
* cara 3
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = cd-key-pernr
IMPORTING
molga = country
TABLES
in_rgdir = rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
ENDIF.
***************************************************************
SORT rgdir BY fpper DESCENDING.
* So we have Table RGDIR, now what is left is opening cluster PCL2 with
* the rgdir key, so you can access RT, CRT, etc, etc.
LOOP AT rgdir.
CLEAR rx-key-pernr.
CLEAR rx-key-seqno.
*-- Import RQ (Payroll Results Australia) Cluster
rx-key-pernr = pernr-pernr. "Fill the Key for reading RQ cluster
rx-key-seqno = rgdir-seqnr. "Fill the Key for reading RQ cluster
***************************************************************
IF cara EQ '1'.
* cara 1
IMPORT rt FROM DATABASE pcl2(is) ID rx-key.
ELSEIF cara EQ '2'.
* cara 2
rp-imp-c2-is. "MACRO to Import RX Cluster
ELSE.
* cara 3
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
clusterid = 'IS'
employeenumber = rx-key-pernr
sequencenumber = rgdir-seqnr
CHANGING
payroll_result = result
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.
rt[] = result-inter-rt[].
ENDIF.
***************************************************************
LOOP AT rt.
WRITE: / rt-lgart, rt-betrg.
ENDLOOP.
EXIT.
ENDLOOP.
No comments:
Post a Comment