Getting Last Payroll Record

Hi all,
I need to fetch last payroll record of a pernr,from transaction pc_payresult.
I am using the LDB PNP.
After calling GET PERNR, I am using functions CU_READ_RGDIR and then PYXX_READ_PAYROLL_RESULT to fetch the last active payroll record.
But is there any way to <b>directly</b> fetch the last active payroll record,based on the pernr? Please suggest a way.
Thanks&Regards
Ananya

Hi
To get the payroll results, you need to read the cluster CU to get RGDIR. For this CU_READ_RGDIR is used and almost all standard programs also use this FM.
Simple Report using LDBs to get latest payroll result.
report ythr_read_payroll .
data: t_rgdir type pc261 occurs 0,
      t_result type payus_result,
      w_bt type line of hrpay99_bt,
      out_seqnr like pc261-seqnr.
tables: pernr.
get pernr.
  call function 'CU_READ_RGDIR_NEW'
       exporting
            persnr                = pernr-pernr
       tables
            in_rgdir              = t_rgdir
       exceptions
            no_record_found       = 1
            import_mismatch_error = 2
            no_read_authority     = 3
            others                = 4.
  if sy-subrc <> 0.
    write:/1 'No payroll results for ', pernr-pernr.
  endif.
call function 'CD_READ_LAST'
       exporting
            begin_date      = pn-begda
            end_date        = pn-endda
       importing
            out_seqnr       = out_seqnr
       tables
            rgdir           = t_rgdir
       exceptions
            no_record_found = 1
            others          = 2.
  if sy-subrc <> 0.
    write:/1 'Error for ', pernr-pernr.
  endif.
  call function 'PYXX_READ_PAYROLL_RESULT'
       exporting
            clusterid                    = 'RU'
            employeenumber               = pernr-pernr
            sequencenumber               = out_seqnr
       changing
            payroll_result               = t_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
            error_reading_archive        = 8
            error_reading_relid          = 9
            others                       = 10.
  if sy-subrc <> 0.
    write:/1 'Error for ', pernr-pernr.
  endif.
  loop at t_result-inter-bt into w_bt.
    write:/1 pernr-pernr, out_seqnr, w_bt-bankl, w_bt-bankn.
  endloop.
Regards
Navneet

Similar Messages

  • SQL query to get last 10 records in the table?

    Hi,
    Can anyone tell me the SQL query to get last 10 records in the table?
    Thanks!!
    MCP

    Please, define what "last" means. Sets are unordered by definition, so if you want to retrieve rows from a table in a specific order you need to specify what that order is - e.g. by maintaining a value in a column (or a combination of columns) that you can use in the ORDER BY clause of the SELECT statement.
    If, for instance, you kept the time when the row was inserted in a special column (InsertedTime), you could use this in your query like this:
    select top (10)
      <column list>
      from <table or view>
      where <restriction(s)>
      order by InsertedTime desc;
    ML
    Matija Lah, SQL Server MVP
    http://milambda.blogspot.com

  • Get last add record using UI

    Hi is there anyway to get the last added record from UI-API?
    I want to return the last added doc num from the delivery screen after the user press the add button.
    The method i am using now to get the doc num is to return the docnum after the itempressed event = true. After that i will minus 1 to that result. Is this the only way to get the last added number or is there another method to use?
    Thanks

    Thanks Ibai
    I tried making an UDF in the Document/Title part, and created a new field called GUID. When i tried entering the GUID into that field using UI-API, it does not enters. My code are something like this
    sGuid = guid.newguid.tostring
    oitem = odevnote.items.item("U_GUID")
    oedittext = oitem.specific
    oedittext.value = sguid
    pls help
    ps. one more thing, if the UDF screen is not opened, the GUID value would not be entered right? is there a way to force the user to open the UDF screen? or is there any other solution for this?
    Message was edited by: Melvin Teng

  • GET LAST INSERTED RECORD

    I am fairly new to flex. So please bear with me no this
    question.
    I would like to get MYSQL ID of the last record I inserted.
    MSQL has as function LAST_INSERT_ID() that is connection based and
    will return the last id of the last inserted record. My thought was
    in the function contained within the cfc to do 2 queries insert the
    record and return the last id directly after (see below). However,
    I don't know how I would read the results back into flex. I am
    unsure how to write the event handler. Thanks
    <cffunction name="insertUser" access="remote"
    returntype="query" >
    <cfargument name="SSN" required="false" type="string"
    hint="SSN"/>
    <cfargument name="FNAME" required="false" type="string"
    hint="FNAME"/>
    <cfargument name="LNAME" required="false" type="string"
    hint="LNAME"/>
    <cfargument name="CLIENTID" required="false"
    type="string" hint="NEW CLIENTID"/>
    <cfquery name="insUser" datasource="DBT">
    INSERT INTO CLIENT (SSN, FNAME, LNAME) VALUES (
    <cfqueryparam value="#ARGUMENTS.SSN#"
    cfsqltype="CF_SQL_VARCHAR" maxlength="12"/>,
    <cfqueryparam value="#ARGUMENTS.FNAME#"
    cfsqltype="CF_SQL_VARCHAR" maxlength="20"/>,
    <cfqueryparam value="#ARGUMENTS.LNAME#"
    cfsqltype="CF_SQL_VARCHAR" maxlength="30"/>)
    </cfquery>
    <cfquery name="qRead" datasource="DBT">
    SELECT last_insert_id() AS CLIENTID
    </cfquery>
    <cfreturn qRead >
    </cffunction>

    I assume you have LCDS installed with CF and you are using
    the remote object service,
    <mx:RemoteObject
    id="myService"
    destination="ColdFusion"
    source="full.path.to.cfc"
    showBusyCursor="true">
    <mx:method name="insertUser"
    result="insertUser_result(event)" />
    </mx:RemoteObject>
    <mx:Scrpit>
    private function insertUser_result(event:ResultEvent) {
    trace(event.result);
    event.result will be the id of the newly inserted record.
    BTW, I would highly recommend you looking into the data
    management servcie. the SQLAssembler can spare you of the CF code
    for simple CRUDs like this.

  • How to get last year records in P&L

    Hii gurus,
    I am creating Profit & Loss report.
    I need to show last year records.
    Please explain.....
    Thanks in advance......
    Moderator message: please do more research before asking, show what you have done yourself when asking.
    Edited by: Thomas Zloch on Sep 27, 2011 2:11 PM

    Hi,
    Better still if you want this to be easily changeable, i.e. not without a repository migration, put the search spec on the Applet in the Application - Personalization screen. In this way you can change the Search Spec in case of Business Requirement change without needing to go through a development cycle. Do not forget to do a Reload Personalization Rules after changing Search Spec to bring this in effect.
    If you have a standard requirement then do it preferably on the Applet so that you can use the BusComp at other locations also without having to deal with the search spec coming in uninvited.
    Thanks and Regards,
    Tanmay Jain.

  • To get last 10 records

    hi
    suppose there are 50 records in a table
    but i want last 10 records .how can we retrive them?
    thanks in advance.......

    It works fine. The only odd thing is the timestamp appears later and the message (alert) appears first. But this is much better.
    Like this -
    Current log# 2 seq# 7479 mem# 0: D:\TESTDB\ORADATA\DATAFILES\TESTDB\REDO02.LOG
    Thread 1 advanced to log sequence 7479
    Thu May 01 12:30:40 2008
    ORA-00600: internal error code, arguments: [qkatab_10], [16], [79557], [], [], [], [], []
    Errors in file d:\admin\testdb\udump\testdb_ora_2092.trc:
    Thu May 01 11:35:21 2008
    ORA-00600: internal error code, arguments: [qknltAllocate_10], [79557], [], [], [], [], [], []
    Errors in file d:\admin\testdb\udump\testdb_ora_2092.trc:
    Thu May 01 11:34:45 2008
    WARNING: inbound connection timed out (ORA-3136)
    Thu May 01 11:26:38 2008
    Thank you all,
    Sanju.

  • Get last 5 records.

    I want to retrieve last 5 records in my emp table. This table contains 1000 rows. i should give "order by sal desc."

    http://www.oracle.com/technology/oramag/oracle/07-jan/o17asktom.html

  • How to populate last 10 records from data base table

    Hi,
    My requirement is to populate last 10 transfer order items confirmed from LTAP. as the table is too large there is no point to fetch all the records and filter them...
    Please let me know better way (in terms of performace) to get last 10 records from LTAP.
    Thanks in advance.
    Nag

    Hi brother,
    the following code is working......(sample code)
    data itmara type mara occurs 0 with header line.
    select matnr from mara into corresponding fields of table itmara up to 20 rows.
    sort itmara descending by matnr.
    loop at itmara .
    write:/ itmara-matnr.
    if sy-tabix = 10.
    exit.
    endif.
    endloop.
    plz reward with maximum points
    Edited by: sreejith gn on May 13, 2008 12:52 PM

  • Last 10 records of a table with out using count

    How can i get last 10 records of a table with out using count() method? if there is some page size(eg 10) , and if we want last page. is it posible without ount()? if posible how?
    Message was edited by:
    user480375

    "is there any other way without nesting?"
    Not correctly, no. What is your problem with nesting? Nested queries are not inherently slower than unnested queries. In some cases, such as this, they are the only correct way to do the query. Even an analytic version of the Top N needs to be nested because:
    SQL> SELECT object_name
      2  FROM t
      3  WHERE ROW_NUMBER() OVER (ORDER BY object_name DESC) < 11
      4  /
    WHERE ROW_NUMBER() OVER (ORDER BY object_name DESC) < 11
    ERROR at line 3:
    ORA-30483: window  functions are not allowed hereTTFN
    John

  • Fatch last inserted record in ztable

    hi all,
    any buddy can tell me how can i get last inserted record from my ztable.

    Hi,
    I think this wont work .....
    Ex: table has   (considering first two cols as PK's)
    000123   AA   124
    000123   AB   124
    000123   AC   124
    000123   BA   124
    000123   BB   124
    000123   BC   124
    000123   LH   124
    Now i am inserting         000123   BD   124
    => Records will be arranged as
    000123   AA   124
    000123   AB   124
    000123   AC   124
    000123   BA   124
    000123   BB   124
    000123   BC   124
    000123   BD   124
    000123   LH   124
    How will yur query works ? Please clarify ....

  • Select last ten records

    How can I retrieve the last 10 records in a table

    to get last 10 records
    Sim
    Message was edited by:
    sgalaxy

  • How can I get the last / newest record of a table?

    Hi,
    I am developing an ecard app that has a create greeting page, a preview page with edit and send buttons and an edit page.
    I got he insert working, and on the preview page I created a master record page (displays all records), and delete all unecessary designs. Doing it this way also gives me the 'edit' button, so people are able to edit their page.
    How do I get only the last record displayed though? At the moment it loops through all records and displays them in sets of 10. I found the variable that holds the totla count of records ('$totalRows_rs7417_content1'), but how do I (re-)write the script so it ONLY diplays the last record?
    I need to get the ID of this record as I am writing this into the PARAMs of the object and embed tags of my message .swf (this picks up the ID and based on that sucks the greetings text out of the database via another php script.
    Also, from this page, how can I send an email to the sender (ie creator of the message) as well as the recipient? Both email addresses are in the databse so should be part of the erecord returned.
    Thanks,
    Nik

    -----
    OK, So how do I recreate what I got in a non-ADDT list?
    well, when you´re just about to display one certain record, the term "list" is somewhat inappropriate anyway.
    What you´d simply need to do IMHO, is using DW´s native functions to create the basic "SELECT * FROM table_name ORDEr BY ID DESC" query, add "LIMIT 1" manually, and display the desired "dynamic text" placeholders in 1 table cell -- don´t think there were any need for all the fancy stuff
    (sorting, filtering etc) provided by ADDT´s list, as it´s just 1 record.
    It also occurred to me just now that finding the last record that has been added *may-* notbe enough if the site gets used a lot by our executives (I am thinking of a situation where 2 or three peolpe create greetings at the same time and press submit and then getting each others messges rather than their own).
    in this case you might want to additionally store the respective executive´s "kt_login_id" session variable -- because it´s this unique "identifier" which should be used to show the last inserted record of the person who actually inserted it, means adding a "WHERE submitter_id" equals the session variable kt_login_id - clause to the query.
    When creating a non-ADDT list that´s at some point based on detecting a user session, you´ll BTW need to insert at line 1
    I can't seemt o insert it on the page as it is looking for a insert, update or delete bahaviour on the page which of course I don't have
    please search these forums for several posts I made which explain my "use dummy table" approach that´s made for cases when you actually don´t have anything to insert/update/delete, but need "something" for ADDT´s send email behaviours.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Different ways to get the last 5 records ordered by date

    I have a query no that returns the tickets ordered by moddt, modification date,
    I was thinking of adding a select on top, to get the last 5 records of that list the select already generates. An other way was to use that select to create a view,
    and get the 5 last records that way. I also though of a possibly impossible cursor with a sequence, but hmm well I consider that not a good solution.
    So I'm trying to find a way, using a select, the topmost select which is not completed yet, to get the last 5 records. Maybe I should just try the rownumber thing again or something likewise.
    Select * from(
    select * from(
    Select ticketid, appliecatiecd, categorieid, substr(titel,&,200)||' ...' "titel", klantproriteitid, interneprioriteitid,
    (select g.voornaam||' '||g.naam
    from gebruiker g
    Where g.gebruikerid = t.gebruikerid
    And t.applicatiecd = NVL(:P0_applicatiecd, :F101_applicatiecd))"aangemaakt door",
    (select s.statusdefoms "status"
    From status s
    Where s.statusid = t.statusid
    And t.applicatiecd = NVL(:P0_applicatiecd, :F101_applicatiecd)) "status",
    Versieid,
    Moddt,
    Row_number() over (order by ticketid desc) rn
    From ticket t
    Where applicatiecd = NVL(:P0_applicatiecd, :F101_applicatiecd) )
    Order by moddt)
    Where --

    Hi Floris,
    You can also use RANK: http://www.dba-oracle.com/oracle_news/oracle_faq/faq_beg_sql_top_n_rows.htm
    Regards Pete

  • SQL query to get last 6 months records neglect the current month

    Hi All;
    I need help with 
    sql query to get last 6 months records neglect the current month
    Any help much appreciated
    Thanks
    Pradnya07

    SELECT <> FROM tbl WHERE dt >=dateadd(month,-6,GETDATE())
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Getting last record from mseg

    Hi,
    Can any one tell me how to get last record from any db(MSEG) table?
    reward guaranteed
    kaki

    Hello,
    Entries have no "natural order" within a database, apart from the primary key. If you need the "last entry" then you need to know what defines the last entry. If the last entry is the one with the highest year (MJAHR) the you could select it like this:
    data: ls_mseg type mseg.
    select * from mseg into ls_mseg.
        where bwart = 321
          and ebeln = 400000005
          and mjahr = ( select max( mjahr ) from mseg
                          where bwart = 321
                            and ebeln = 400000005 ).
    "process result in ls_mseg
    endselect.
    Note: This is a loop because there might be more than one matching entry.
    best regards
    Roland

Maybe you are looking for

  • Purchase Order and Fixed Asset Module.

    Hi all, I want to print my purchase order of fixed asset for record purposes.  But the thing, I can't link purchase order or any of A/P documents to my fixed asset. Meaning, if A/P invoice has been added into the system, it will not update my fixed a

  • BSOD on boot due to Lenovo Power Manager

    I was uninstalling this Power Manager last time on computer. I do not remember what version it was. It was stuck at 94% for long time (half hour), so I shutdown my computer instead of waiting for it. Now my windows 7 cannot boot at all. Not even safe

  • I would like more than 10 recent items.

    File > Open Recent Files> has 10 items in it, max. I would like to make this perhaps 20. Can't find a dialog in prefs. Illustrator CS 4 Mac, OS 10.5. Is there any way to do this? (Can't upgrade this PPC machine to CS5.)

  • Screen flickering and camera hangs

    I bought xperia Z1 a month ago. Since then i have this issue of screen flickering. i ordered for replacement and the phone i got after replacement has same issues as well as the camera hangs.   Any suggestions why this happens ?!!!!!!!

  • Random iPhoto 11 images missing

    Hi there - I'm new to the community and had a couple of questions regarding iPhoto '11 (which continues to frustrate the heck out of me!). 1. Some of my images that were in my iPhoto library are now showing only the cached thumbnails.  When I click o