Get pernr statement

Hi,
I just want to know how to debug the get pernr statement or to know what is happening by this statement in the program.
Thing is that, I have a scenario where, for a particular employee ID the get pernr statement gets executed with sy-subrc value 0 which idealy should not be. And except this ID rest all IDs have sy-subrc as 4 after the get pernr statement execution.
Please reply.
Regards,
Binay.

Hi,
First of all thanx for your reply.
The variant used in the program execution should consider all the company codes except 0121. But its strange that this company code is too chosen and that too for only one employee. I tried to test with other employees belonging to this company code but they are not chosen.
Actually this program is meant for the job to run Payroll for Semimonthly employees and this employee should not be chosen as the variant is only meant for company codes other than 0121 and this employee belongs to 0121.
Just before the Get pernr statement, in the code while debugging, there are some Badis being called. I did not find anything by checking them too.
Please suggest.
Regards,
Binay.

Similar Messages

  • GET pernr statement help

    Hi,
    I am a very much a beginner to ABAP.
    Can anyone explain me the logic with which pernr statement works?
    This is my understanding so far.
    i think it is working as a loop.
    At first loop it gets the record of first pernr number into an internal table. If muliple records exists they are added into the internal table.
    This goes on for all pernrs.
    Is this correct?
    Also i think there is a table where pernr number is stored globally. This is because i get a pernr number while using get pernr but that number is nowhere in any table.
    Can any1 tell me that table name.
    Thanks in advance,
    Bala

    Hi,
    Check
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/content.htm
    GET PERNR:used in logical database PNP
    If you are using LDB PNP, try the below code
    tables : pernr.
    infotypes : 0001.
    start-of-selection.
    get PERNR.
    end-of-selection
    Edited by: Neenu Jose on Oct 24, 2008 8:38 AM
    Edited by: Neenu Jose on Oct 24, 2008 8:39 AM
    Edited by: Neenu Jose on Oct 24, 2008 8:42 AM

  • Don't use GET PERNR error

    Hello Experts,
    I'm trying to write a code using GET PERNR statement for every first time but keeps getting the error when try to execute my code. Here is the error (Do not use the GET PERNR event).
    Can somebody please help me rectify this error. For reference here is my code.
    report  zad_hr_test line-size 200.
    *Database Table
    tables: pernr,           " Pernr structure for Logical database
            pa0001,           " Actions
            pa0002.           " Personnel Info
    *Infotypes
    infotypes: 0001,         " Actions
                0002.         " personnel info
    *Variable Declaration
    data: form_nam like p0001-ename,
           v_age(5) type c,       "variable for calculating age in days
           v_ctr1 type i value 0, "counter
           v_ctr2 type i value 0, "counter
           var(5) type c ,        " variable to store btrtl
           var1(5) type c  .      " variable to store werks
    *Internal Table Decalartion
    data: begin of i_tab1 occurs 0,
            werks like pa0001-werks,  "personnel area
            btrtl like pa0001-btrtl,  "personnel sub area
            pernr like pa0001-pernr,  "employee number
            ename like pa0001-ename,  "employee name
            begda like pa0002-begda,  "employee join date
            persg like pa0001-persg,  "employee group
            persk like pa0001-persk,  "employee sub-group
            plans like pa0001-plans,  "position
            gbdat like p0002-gbdat,   "date of birth
          end of i_tab1.
    *START-OF-SELECTION
    start-of-selection .
    get pernr .
    i_tab1-pernr = pernr-pernr.
       rp_provide_from_last p0001 space pn-begda pn-endda .   " Macro for IFT-0001
       rp_provide_from_last p0002 space pn-begda pn-endda .   " Macro for IFT-0002
    **--> Populate internal table
       move p0001-werks to i_tab1-werks .
       move p0001-btrtl to i_tab1-btrtl .
       move p0001-pernr to i_tab1-pernr .
       move p0001-ename to i_tab1-ename .
       move p0002-begda to i_tab1-begda .
       move p0001-persg to i_tab1-persg .
       move p0001-persk to i_tab1-persk .
       move p0001-plans to i_tab1-plans .
       move p0002-gbdat to i_tab1-gbdat .
    **--> Append data to internal table
       append i_tab1 .
       clear i_tab1 .
       loop at i_tab1.
         write:/ i_tab1-werks,
                 i_tab1-btrtl,
                 i_tab1-pernr,
                 i_tab1-ename,
                 i_tab1-begda,
                 i_tab1-persg,
                 i_tab1-persk,
                 i_tab1-plans,
                 i_tab1-gbdat.
       endloop.
    Many thanks in advance.

    Hi,
    You're asking a different question now, so you should start a new thread...
    Anyway, in the 'Attributes' screen of your program you can specify which selection screens you want to display for a logical database.
    Alternatively you can hide all (or part) of a selection screen at the 'selection-screen output' event.
    For example:
    at selection-screen output.
      loop at screen.
       check screen-name = 'PNPABKRS-HIGH'
          or screen-name = 'PNPABKRS-LOW'.
       screen-input = '0'.
       screen-output = '0'.
       screen-invisible = '1'.
       screen-active = '0'.
       modify screen.
      endloop.
    cheers
    Paul

  • HR-stopping Get Pernr from triggering

    hi,
    My selection-screen is combination of PNP + other Fields
    i am using GET PERNR to retrive values..
    my Problem is that When no values is given in PNP fields , i want to Skip
    GET PERNR statement.but i am unable to do it..
    Kindly give some solution.

    hi,
    check the fields whether they are initial or not.
    if the PNP fields are initial then dont process the GET PERNR.
    Dummy code.
    If not PNP-fields initial.
    GET PERNR.
    Endif.
    <b>Reward points if useful</b>
    chandra

  • Regading GET Pernr

    Hi All,
    I have a requriement to fetch last pernr.Once after using GET PERNR statement in my program i will get all the pernrs available.So after this i want to fetch only the last pernr exists.For example if i have 1000 pernrs after my get pernr statment i want to fetch only the 1000 pernr .so please suggest me on this.

    HI..
    this one is simple to try..
    REPORT  YH642_HR_TEST.
    TABLES: PERNR.
    INFOTYPES: 0001.
    <b>start-of-selection.</b>
      GET PERNR.
    <b>end-of-selection.</b>
    read table p0001 index 1.
    WRITE:  / P0001-PERNR,
                  P0001-plans,
                  P0001-BEGDA,
                  P0001-ENDDA.
    it always stores the last pernr details in the last loop. So go to end-of-selection and print the details.

  • GET PERNR usage

    hello Abap Gurus:
    Can any one please clarify me a question on GET PERNR Key word.
    I know that get pernr statement gets all the infotype records for selected pernrs on the selection screen.
    But my questiosn is whether get pernr access the database for each pernr selected on selection screen and process them or it gets all the infotypes data for selected pernrs in one shot.
    if not then whether this is not a performance issue.
    Please clarify me as i am a newbie in hr programming.
    Thanks,
    Sravanthi.

    Hi Sravanthi,
    It reads all employee numbers and related infotypes at one shot.
    During debugging of the GET PERNR operation please check that SY-DBCNT value is always constant.
    "The logical database reads all columns from all nodes that are not designated for field selection in the logical database and are superior to node on the access path of the logical database. "
    Please check the link below:
    http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9aa335c111d1829f0000e829fbfe/content.htm
    Regards,
    Dilek
    Edited by: Dilek Ersoz Adak on Jan 28, 2010 4:23 PM

  • How to extract current record using get pernr (logical database)

    Hi all,
    I am using logical database in the program and using <b>get pernr</b> method. But there are multiple entries in the infotype for a perticular employee. i want to extract employees current record whose end date is greater than sy-datum.
    how to do this using <b>get pernr</b>?
    Thanks in advance.

    Hi Priti,
    Get Pernr statement will get all the records for each employee spcicified for the Begin and End dates on the selection screen and store in an internal table for the infotypes declared in the infotypes statement.
    You need to read this table and copy only the records that meet the date criteria in an internal table for further use.
    For Ex:
    infotypes : 0001.
    tables : pernr.
    TYPES : BEGIN OF ty_kostl,
             pernr TYPE pernr-pernr,
             kostl TYPE p0001-kostl,
             ename TYPE p0001-ename,
            END   OF ty_kostl.
    Work Areas
    DATA : g_kostl_wa  TYPE ty_kostl.
    Internal Tables
    DATA : i_kostl  TYPE TABLE OF ty_kostl.
    start-of-selection.
       get pernr.
       PROVIDE * FROM p0001 BETWEEN pn-begda AND pn-endda.
        if p0001-endda GT sy-datum.
           g_kostl_wa-pernr = p0001-pernr.
           g_kostl_wa-kostl = p0001-kostl.
           g_kostl_wa-ename = p0001-ename.
           APPEND g_kostl_wa TO i_kostl.
           CLEAR  g_kostl_wa.
        endif.
      ENDPROVIDE.

  • Question on GET PERNR.

    Hi all,
    when I using GET PERNR, this is a loop , right ?
    currently, I have no idea about where the value comes from to get into this 'PERNR' structure, pa0000 or pa0001 or any other place?
    Thanks!

    Hi,
    GET PERNR event fills the data structures of declared infotypes with all records that exists for a personnel number.
    Data selection does not delimit the records that retrieved from the database.
    Whenever GET PERNR statement is included in your program check the following two .
    1.Have you included PNP for the logical database screen field in the program attributes.
    2.Have you included PERNR structure in the tables declaration.
    Below is a sample code, may help you understand the logic behing GET PERNR
    tables: pernr.
    infotypes: 0000,
                0001,
                0002,
                0019,
                0041,
                0396,
                9009.
    start-of-selection.
    get pernr.
       provide * from p0396 between pn-begda and pn-endda.
         perform refresh_tables.
         call function 'HR_READ_INFOTYPE'
           exporting
             pernr     = p0396-pernr
             infty     = '0396'
             begda     = pn-begda
             endda     = pn-endda
           tables
             infty_tab = i_p0396.
         sort i_p0396 by begda descending.
         read table i_p0396 index 1.
    endprovide.
    end-of-selection.
    Check this as well:
    [http://sapabap.iespana.es/sap/info/hr_overview.htm|http://sapabap.iespana.es/sap/info/hr_overview.htm]
    Hope this help you.
    Edited by: Lokesh Tarey on Jul 15, 2010 6:06 AM

  • Get Pernr

    Hi,
    I've written an abap program using the logical database PNP to select the employees record using the statement 'Get pernr'. I would like to know if there are ways to get the total number of records that can be selected.
    Thanks,
    Francis

    Thats not passible. Imagine having a select statement, there is no way of getting the number of resulting rows ahead the statement. you have tp process the select statement twice, first to get the amount, and then to ge tthe rows. in the first step you can optimize the select with count(*), but nevertheless, it is executed twice. So you have to execute the logical database in advance, there are funcion modules to do that. For performance reasons, thats not a good choice.
    On the other hand, when the get event is triggered and your program is getting the first rowm most work by the database is done and you're only fetching row by row.

  • Regarding the get pernr function

    Hi guys,
              Got to know that when we use get pernr it automatically checks for the autherization on pernrs to view data.
        Would like to know who all have access to see which pernrs? Can i get any ideas on this....
    Thanks in advance
    Abhi

    Triggers the associated events when data is read in an executable (type 1) program using a logical database.
    node is a node in the logical database that is assigned to the report (type 1 program) in the program attributes. You must declare the node in the report using the NODES statement (or the TABLES statement, if the node is of the type "table").
    The node node corresponds to a data object of the same name.
    node is available for processing during the flow of the logical database. Moreover, you can also make reference to the fields from the node that lie on the access path for node in the logical database associated with the report - unless the node is of the dynamic dictionary type.
    Notes
    You can use the event "GET dbtab." only once in the report.
    The GET events are implemented internally as FORM routines. This makes all data objects declared with DATA local, that is, they are only recognized and addressable within the event. This also applies to AT SELECTION-SCREEN ....
    The logic is somewhat different for nodes of the dynamic dictionary type. You must declare these nodes in the report using the NODES node TYPE type statement. In this case, type a dictionary type from the logical database for the node node - that is, the type of the data object node assigned to the node node can differ in different reports. In this case, the data object node is local to the -GET event and has the structure type. Outside the -GET event, a (global) data object node also exists and has the static type assigned to the node. The actual data is, however, returned in the local field node and is available only within the -GET event.
    Example
    The program uses the logical database F1S which has a structure where the table BOOKING appears below the table FLIGHT.
    NODES: SFLIGHT, SBOOK.
    GET SFLIGHT.
      WRITE: SFLIGHT-CARRID,
             SFLIGHT-CONNID,
             SLFIGHT-FLDATE,
             SFLIGHT-PLANETYPE.
    GET SBOOK.
      WRITE: SBOOK-BOOKID,
             SBOOK-CUSTOMID,
             SBOOK-ORDER_DATE.

  • Authorizations with PNP and Get Pernr.

    We have just noticed an issue with how our custom reports are working in regards to authorizations.  Our users have authorization to see Basic Pay infotype information up to the point where an associate becomes an executive.  When running our reports the latest salary shows up instead of the last one they are allowed to see or just leaving that field blank.  We are using the PNP logical database and Get Pernr.  Isn't that supposed to pick up whatever authorization is assigned to the person?
    Thanks,
    Mary

    I do not know how you come to this statement. Of course LDB checks ALL HR Authorization defined. This incoporates the personnel administration part as well as the combination to structural authorizations.
    However PNP will skip a PERNR if the user has only partial authorization by default. To get also only the restricted data what the user can see you must use the switch PNP_SW_SKIP_PERNR = 'N' at INITIALIZATION point.
    Please see the documentation available here:
      http://service.sap.com/erp-hcm
    On the left side follow the links:
      Services for mySAP ERP HCM
        Special Documentation
    Regards,
    Michael

  • Strange Behavior of GET PERNR

    Hi All,
    I am facing a strange behavior with GET Event for PNP LDB.
    In my selection-screen, i have fields like Payroll Area, Current Period, Other Period, personnel number.
    Usually, i populate Payroll area, other period(say 06-2007) and input some personnel number.
    When i tried to debug for one personnel, its not at all going into GET PERNR event...it directly goes to END-OF-SELECTION event.
    Please help on this.
    Regards,
    Kiran Chennapai

    Hi Manoj,
    The below is some part for my coding:
    START-OF-SELECTION.
      IF pnptimr9 = 'X'.
        PERFORM f_get_next_period.    "Take next period when the selection
        " is current period
      ENDIF.
    Get deatils of actions and pay-scales
      PERFORM f_get_data.
      CLEAR: g_num_processed, g_num_skipped, g_num_success, g_num_error.
    GET pernr.
      rp_provide_from_last p0001 space pn-begda pn-endda.
      IF pnp-sw-found = 1.
    Verify whether the personnel is under the given Payroll area or not
        CHECK p0001-abkrs = pnpxabkr.
        IF p_eegrp IS NOT INITIAL.
    Verify personnel's employee group is under the given EEgroup
          CHECK p_eegrp = p0001-persg.
        ENDIF.
    start processing for the selected personnel
        PERFORM f_process_data.
      ENDIF.
    END-OF-SELECTION.
    Do increment process for all the selected personnel
      IF NOT git_process[] IS INITIAL.
        PERFORM f_increment_process.
      ENDIF.
    When i tried to put a break-point at the first statement in the GET event and executed, its not going into GET event at all.(personnel number is existing in the system)
    Regards,
    Kiran Chennapai

  • After Get pernr

    Hi Sap Gurus,
    I am new to hr abapcolud clarify my doubts plzzzzzzz.
    After excuting our program in hr abap
    start-of-selection. will trigger am i correct
    in our program which infotype we have diclered those infotypes data comes in pnnnn  
    this pnnnn is internal table or structue,
    and after get pernr we will get that data into final internal table
    this get is event or what,  while i was debugging have seen that one as form
    Thanks,
    Prasad.

    PNNN is a structure
    The Pnnnn structure of the infotype is used as the field structure for the infotype entry screen
    When you declare an infotype using the INFOTYPES statement, an internal table Pnnnn with the structure Pnnnn is created and all records of the infotype are transferred to this table:
    At the GET PERNR event, the PERNR structure contains the data for a personnel number chosen on the basis of selection screen entries
    Data is retrieved at the GET PERNR event. The GET PERNR action is executed for all personnel numbers that were selected on the basis of selection screen entries
    GET PERNR fills the internal tables of infotypes that are declared for each employee using the INFOTYPES statement

  • [HR] Precise GET PERNR

    Hi. When I use GET PERNR, all pernr are taken so it takes a long minute to complete. How can I limit number of PERNR who are taken by GET statement? For example I'd like to process only pernr from particular shop or particular organization. I'll be thankful for tips. Greetings. P.

    I believe that the only thing that your you can do is to check manually with a CHECK after GET PERNR, of way that if it does not fulfill the conditions necessary, the PROVIDE continues with the following PERNR. Something like this:
    GET PERNR.
    check pernr-pernr in so_pernr.

  • Restrict GET PERNR

    Hi,
    I have a situation/special case when GET PERNR runs for all pernr.s (No input on selection screen of PNP LDB) where it causes unnecessary performance issue.
    Is there any way to execute GET PERNR event conditionally or run it for specific pernrs that I want.

    Hi,
    Why don't you just restrict them in selection screen?
    Anyhow if you don't what to do this and you know which EEs excatly you want to ommit do following.
    RANGES: ra_pernr FOR pernr-pernr OCCURS 0.
    "here hardcode all your EEs which you don't want to process. You either provide a range or add a row for each EE
    ra_pernr-sign   = 'I'.
    ra_pernr-option = 'EQ'.
    ra_pernr-low    = "lowest EE number or exact EE number
    ra_pernr-high  = "highest EE number or empty (if only one EE)
    APPEND ra_pernr.
    GET PERNR.
    check pernr-pernr not in ra_pernr.   "if EE is within the range he/she will be processed, otherwise next pernr is taken
    Alternativetly to last statement you can use
    GET PERNR.
    if pernr-pernr not in ra_pernr.
      REJECT.
    endif.
    ...but it will have same result
    Regards
    Marcin

Maybe you are looking for