Skip to Content
author's profile photo Former Member
Former Member

Regarding payroll reading code

Hi experts,

I m new to ABAP-Hr , i want some smaple code to read the payroll for some employees .

can some one share the code are documents with me. it will be really help to me.

my id is : kutam.abaphr@gmail.com

thanks,

Suresh.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 27, 2007 at 02:56 PM

    Hi Suresh,

    see the following code.

    REPORT Z_PROG_PAYROLL message-id 00.

    Tables: pernr, pcl1, pcl2, pc260.

    INfotypes: 0001.

    data: it_key type pc200 occurs 0 with header line,

    it_rgdir type pc261 occurs 0 with header line.

    data: l_seqno type PC261-SEQNR.

    data: results type PAY99_INTERNATIONAL occurs 0 with header line.

    data: calcmolga like t500l-molga value '10'.

    *ATA : CALC_CURRENCY LIKE T001-WAERS VALUE 'USD'. "XJIALRK046727 deco

    data : calc_currency like t500c-waers value 'USD'.

    *data: versc type pc202 occurs 0 with header line.

    include rpc2cd09. "Cluster CD Data-Definition

    include rpc2ca00. "Cluster CA Data-Definition "XUJP30K079863

    include rpc2ruu0. "Cluster RU Data-Definition

    include rpc2rx09. "Cluster RU Data-Definition internat. part

    *include rpppxd00. "Data befinition buffer PCL1/PCL2

    *include rpppxd10. "Common part buffer PCL1/PCL2

    *include rpppxm00. "Buffer handling routine

    *

    include rpc2rox3. "Data definition RPCLSTRs (only J,K,U)

    include rpc2rox0. "Main program

    **include rpc2r1x0. "International PRINT-FORMs

    *include rpc2r1x5. "International Print-FORMs CRT, VERSC "XUL

    *include rpc2r1u0. "USA PRINT-FORMs

    *include rpc2r1u1. "CLSTR functionality national

    start-of-selection.

    get pernr.

    CALL FUNCTION 'CU_READ_RGDIR'

    EXPORTING

    PERSNR = pernr-pernr

    • IMPORTING

    • MOLGA =

    TABLES

    IN_RGDIR = it_rgdir

    EXCEPTIONS

    NO_RECORD_FOUND = 1

    OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    ENDIF.

    CALL FUNCTION 'CD_READ_LAST'

    EXPORTING

    BEGIN_DATE = pn-begda

    END_DATE = pn-endda

    IMPORTING

    OUT_SEQNR = l_seqno

    TABLES

    RGDIR = it_rgdir

    EXCEPTIONS

    NO_RECORD_FOUND = 1

    OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    ENDIF.

    it_key-pernr = pernr-pernr.

    it_key-seqno = l_seqno.

    rp-imp-c2-Ru.

    **CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'

    • EXPORTING

    • CLUSTERID = 'RR'

    • EMPLOYEENUMBER = pernr-pernr

    • SEQUENCENUMBER = l_seqno

    • READ_ONLY_BUFFER = ' '

    • READ_ONLY_INTERNATIONAL = ' '

    • CHECK_READ_AUTHORITY = 'X'

    • IMPORTING

    • VERSION_NUMBER_PAYVN =

    • VERSION_NUMBER_PCL2 =

    • CHANGING

    • PAYROLL_RESULT = results

    • 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 SY-SUBRC <> 0.

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

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

    **ENDIF.

    Thanks

    Narasimha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 09:22 AM

    Look at this code with Function Modules. It would be simple as compared to using MACROS.Hope this would help you..

    report zdkpayroll .

    tables: pernr,

    t512t.

    infotypes: 0001. "Organizational Assignment

    *Table data containing directory to PCL2 payroll results file

    data: begin of rgdir occurs 0.

    include structure pc261.

    data: end of rgdir.

    data: result type pay99_result.

    *DATA: result TYPE payus_result.

    data: rt_header type line of hrpay99_rt.

    data: country like t001p-molga,

    number like pc261-seqnr. "Number of last payroll result

    get pernr.

    rp_provide_from_last p0001 space pn-begda pn-endda.

    call function 'CU_READ_RGDIR'

    exporting

    persnr = p0001-pernr

    importing

    molga = country

    tables

    in_rgdir = rgdir

    exceptions

    no_record_found = 1

    others = 2.

    if sy-subrc <> 0.

    • WRITE: / 'No Directory Record Found For', pernr-pernr.

    reject.

    endif.

    call function 'CD_READ_LAST'

    exporting

    begin_date = pn-begda

    end_date = pn-endda

    importing

    out_seqnr = number

    tables

    rgdir = rgdir

    exceptions

    no_record_found = 1

    others = 2.

    if sy-subrc = 1.

    • WRITE: / 'No Payroll Seq.No.', pn-paper.

    reject.

    else.

    call function 'PYXX_READ_PAYROLL_RESULT'

    exporting

    clusterid = 'RX'

    • clusterid = 'RU'

    employeenumber = p0001-pernr

    sequencenumber = number

    • READ_ONLY_BUFFER = ' '

    • READ_ONLY_INTERNATIONAL = ' '

    • CHECK_READ_AUTHORITY = 'X'

    • IMPORTING

    • VERSION_NUMBER_PAYVN =

    • VERSION_NUMBER_PCL2 =

    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.

    if sy-subrc = 0.

    loop at result-inter-rt into rt_header.

    select single * from t512t where sprsl = 'EN' and molga = '10'

    and lgart = rt_header-lgart.

    write: / p0001-pernr,

    rt_header-lgart,

    rt_header-betrg currency rt_header-amt_curr,

    t512t-lgtxt.

    endloop.

    endif.

    endif.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.