Hr_read_infotype use

what is the use of thisFM
is it mainly used for authorization
or i can use it to fetch every field of any PA table without the use of select statement

plz help

Similar Messages

  • HR ABAP - Using of function module HR_READ_INFOTYPE

    Hi,
    I want to replace the below SELECT statement with the function module by HR_READ_INFOTYPE.
    IF l_begda LE '20100331'.
              l_assgnda = '20100401'.
            ELSE.
              l_assgnda = l_begda.
            ENDIF.
    SELECT SINGLE werks
            FROM pa0315
            INTO e_t_data-zz_werks
            WHERE pernr = wa-pernr
            AND endda GE l_assgnda   
            AND begda LE l_assgnda.
    But the problem is, in the where condition i have to use LE or GE condition for endda and begda. So how can i use  the function module  for replacing the select statement without changing the functionality.

    Hi,
    You are selecting a single entry... So you will just need to pass the variable l_assgnda to the BEGDA and ENDDA parameters of the FM...
    added: also, if that infotype can have concurrent records (but in that case the select is not correct), you will have to take the first one from INFTY_TAB...
    Cheers,
    Manu.
    Edited by: Manu D'Haeyer on Dec 29, 2011 2:40 PM

  • Use HR_READ_INFOTYPE or select (for all entries)

    Hi
    As I have understood the difference between FM HR_READ_INFOTYPE and a select directly from PA0001 (as example) is that the FM take the authorization into account. (please correct me if I am wrong).
    My problem is that I need to select from the infotype for a lot of pernr, so I would use this statement:
        SELECT * FROM pa0001 INTO CORRESPONDING FIELDS OF TABLE wt_pa0001
          FOR ALL ENTRIES IN wt_pernr
             WHERE pernr = wt_pernr-pernr
              AND begda LE pn-endda
              AND endda GE pn-begda.
    but then I don't get the authorization check.
    For the FM HR_READ_INFOTYPE I can't use the "FOR ALL ENTRIES".
    Can I do it in an easy way, or do need to do the select, and then use an authority check after the select from each infotype?

    Calling HR_READ_INFOTYPE or selecting directly from the tables may depend on how much data you are processing.  If you only need to retrieve a few records, you could process the PERNR records you need in a loop and call HR_READ_INFOTYPE for each.  If you're processing a larger number of records, check the authorization for the each table first and then do a SELECT for all entries.  Before you read, make sure that your "FOR ALL ENTRIES" table is not empty.  In order to make your code more generic, you may want to use function module HR_CHECK_AUTHORITY_INFTY to check the authorization for each infotype.  This is the FM that the HR_READ_INFOTYPE function module uses.
    .. Craig

  • Read infotype using HR_READ_INFOTYPE

    Hi all,
    I Try to read infotype (pa0021) using HR_READ_INFOTYPE. Its getting fine.
    Im using Web Dynpro ABAP Interactive form.
    I want to insert some value in infotype pa0021, so i used HR_INFOTYPE_OPERATION.
    Data's are Inserting.
    The problem is if i press the Save button, Inserting values are not getting, when i use HR_READ_INFOTYPE in the same session. The new values are updated in the Backend but its not getting
    in the same session. because if i press the save button means, i want to save the data and again i want to show the saved data back .But if i close the session and open once again means its reflection the new values.
    I used BAPI_TRANSACTION_COMMIT also but i no success.
    Please Give some solution for this problem, its very urgent.
    Thanks & Regards,
    Hemachandran.R
    Edited by: hemachandran R on Oct 22, 2008 8:54 AM
    Edited by: hemachandran R on Oct 22, 2008 8:54 AM

    Hi hemachandran R ,
    When all your conditions are satisfied, You can get the updated values from the contexts which you are using to update in the contexts by which you are displaying it on the screen.
    You need not to fetch the data from the back end.
    Regards,
    Rohit

  • Reading Infotype using HR_READ_INFOTYPE

    Hi all,
    I Try to read infotype (pa0021) using HR_READ_INFOTYPE. Its getting fine.
    Im using Web Dynpro ABAP Interactive form.
    I want to insert some value in infotype pa0021, so i used HR_INFOTYPE_OPERATION.
    Data's are Inserting.
    The problem is if i press the Save button, Inserting values are not getting, when i use HR_READ_INFOTYPE in the same session. The new values are updated in the Backend but its not getting
    in the same session. because if i press the save button means, i want to save the data and again i want to show the saved data back .But if i close the session and open once again means its reflection the new values.
    I used BAPI_TRANSACTION_COMMIT also but i no success.
    Please Give some solution for this problem, its very urgent.
    Thanks & Regards,
    Hemachandran.R
    Edited by: hemachandran R on Oct 22, 2008 9:02 AM

    Hi Hema,
    Make a new context attribute 'ca_temp'
    and then
    set single attribute
            lo_el_context->set_attribute(
              EXPORTING
                name =  `CA_TEMP`
                value = <new_value> ).
    And use this CA_TEMP where ever you want. for more than one value make node in place of attribute.
    Hope it works.
    Regards,
    Rohit

  • HOW to use HR_READ_INFOTYPE FM

    Hi Guy's,
    How to use " HR_READ_INFOTYPE" Function module.
    Thanks and Regards,
    Bhavani

    hi use this,
    *& Report  ZVENKAT_03
    REPORT  ZVENKAT_03.
    tables:p0002.
    data: it_data type p0002 occurs 0 with header line.
    data: it_data1 type p0008 occurs 0 with header line.
    data:v_name1 like p0002-cname,
         v_date like p0041-dat01.
    data:begin of it_p0002 occurs 0,
         pernr like p0002-pernr,
         begda like p0002-begda,
         endda like p0002-endda,
         vorna like p0002-vorna,
         nachn like p0002-nachn,
         end of it_p0002.
    data:begin of it_p0008 occurs 0,
         pernr like p0008-pernr,
         begda like p0008-begda,
         endda like p0008-endda,
         ansal like p0008-ansal,
         bet01 like p0008-bet01,
         preas like p0008-preas,
         end of it_p0008.
    parameters:p_pernr like p0002-pernr.
    start-of-selection.
    CALL FUNCTION 'HR_READ_INFOTYPE'
      EXPORTING
        pernr                 = p_pernr
        infty                 = '0002'
      TABLES
        infty_tab             = it_data.
    if sy-subrc eq 0.
    it_p0002-pernr = it_data-pernr.
    it_p0002-begda = it_data-begda.
    it_p0002-endda = it_data-endda.
    it_p0002-vorna = it_data-vorna.
    it_p0002-nachn = it_data-nachn.
    append it_p0002.
    clear it_p0002.
    endif.
    CALL FUNCTION 'HR_READ_INFOTYPE'
      EXPORTING
        pernr                 = it_data-pernr
        infty                 = '0008'
       BEGDA                  = it_data-begda
       ENDDA                  = it_data-endda
      TABLES
        infty_tab             = it_data1.
    if sy-subrc eq 0.
    it_p0008-pernr = it_data1-pernr.
    it_p0008-begda = it_data1-begda.
    it_p0008-endda = it_data1-endda.
    it_p0008-ansal = it_data1-ansal.
    it_p0008-bet01 = it_data1-bet01.
    it_p0008-preas = it_data1-preas.
    append it_p0008.
    clear it_p0008.
    endif.
    sort it_p0002 by pernr begda.
    read table it_p0002 index 1.
    write:/ it_p0002-pernr,it_p0002-begda,it_p0002-endda,it_p0002-vorna,it_p0002-nachn.
    sort it_p0008 by pernr.
    read table it_p0008 with key pernr = it_p0002-pernr.
    write:/ it_p0008-pernr,it_p0008-begda,it_p0008-endda,it_p0008-ansal,it_p0008-bet01,it_p0008-preas.
    sort it_p0008 by pernr.
    read table it_data1 index 2 .
    write:/ it_data1-ansal.
    regards,
    venkat.

  • How to use FM HR_READ_INFOTYPE

    Hello experts,
    I want to use FM HR_READ_INFOTYPE to read infotype 0000.
    I want to read the whole table PA0000 not only a certain pernr. So what value I have to pass to parameter pernr in order to read the whole infotype 0000 (table PA0000)?
    CALL FUNCTION 'HR_READ_INFOTYPE'
             EXPORTING
             TCLAS                 = 'A'
               pernr                 =
               infty                 = '0000'
             BEGDA                 = '18000101'
             ENDDA                 = '99991231'
             BYPASS_BUFFER         = ' '
             LEGACY_MODE           = ' '
           IMPORTING
             SUBRC                 =
             tables
               infty_tab             = lt_pa0000
            EXCEPTIONS
              INFTY_NOT_FOUND       = 1
              OTHERS                = 2.
    Where can I get comprehensive information about FM interfaces?
    Thanks
    hiza

    hi ,
    we cannot get data of all the pernrs using the fm but we get data of some of pernrs using the multiple selection we get the data as follows..
    tables:pa0000.
    data: begin of it_pa0000 occurs 0,
          pernr like pa0000-pernr,
          begda like pa0000-begda,
          endda like pa0000-endda,
          stat2 like pa0000-stat2,
          end of it_pa0000.
    select-options:s_pernr for pa0000-pernr.
    select pernr
           begda
           endda
           stat2
           from pa0000
           into table it_pa0000
           where pernr in s_pernr
           and stat2 = '3'.
    sort it_pa0000 by pernr .
    delete adjacent duplicates from  it_pa0000  comparing pernr.
    loop at it_pa0000.
    write:/ it_pa0000-pernr,
            it_pa0000-begda,
            it_pa0000-endda,
            it_pa0000-stat2.
    endloop.

  • Using function module HR_READ_INFOTYPE

    Hi,
    I am fetching the data from PA0001,PA0002 and PA0105 using function module HR_READ_INFOTYPE.But when I am passing the prnr as 7 , it is getting changed to 7000 in the function module. Thats why it is not fetching the data.Please suggest why is it happening. ALso I have to fetch name of the pernr. But from PA0002 , I am not able to fetch the name.Please suggest the solution.

    Make sure for data Declaration in you program you have defined Pernr like
            pernr         LIKE p0000-pernr,            "Personnel Number
    Also check the valid infotype records exists for the dates you are passing
      CALL FUNCTION 'HR_READ_INFOTYPE'
              EXPORTING
                 TCLAS                 = 'A'
                 pernr                 = g_t_table-pernr
                 infty                 = '0002'
                 begda                 = g_t_table-begda
                 endda                 = g_t_table-endda
    *             BYPASS_BUFFER         = ' '
    *             LEGACY_MODE           = ' '
    *           IMPORTING
    *             SUBRC                 =
              TABLES
                infty_tab             = p0002
              EXCEPTIONS
                infty_not_found       = 1
                OTHERS                = 2

  • Use FM - HR_READ_INFOTYPE one time but to read mulitple Info types

    Dear All,
    I have a select-option where in users enter the Info types Numbers.
    Now I have to read and every infotype and display related data from each info type .
    I have to use FM - HR_READ_INFOTYPE  but we need to declare data for each and every infotype so I need to use this 10 times in case If I have 10 infotype.
    Is their any generlaised way exist where in I will pass the variable e.g., P0001 and build the internal table and use it for a FM. Kindly explain.
    Regards,
    Mangalagi S V

    Yes you can.
    1.) Declare fields as follows:
    FIELD-SYMBOLS <it> TYPE STANDARD TABLE.
    DATA  l_table_name LIKE feld-name.
    DATA: wa_0008 TYPE STANDARD TABLE OF p0008,
              0008_line LIKE LINE OF wa_0008.
    2)  In Step 3 I have a form that you will need to call like this:
            MOVE 'wa_0008' TO l_table_name.
            ASSIGN (l_table_name) TO <it>.
            PERFORM read_infotype USING pernr
                                        '0008'
                                        begda
                                        endda.
            wa_0008 = <it>.
    3) Your form will need to look like this
    FORM read_infotype USING pers_num
                             it_num
                             begin
                             end.
      CALL FUNCTION 'HR_READ_INFOTYPE'
        EXPORTING
          pernr             = pers_num
          infty             = it_num
          begda             = begin
          endda             = end
        TABLES
          infty_tab         = <it>
        EXCEPTIONS
          infty_not_found = 1
          OTHERS          = 2.
      IF sy-subrc  = 1.
      ENDIF.
    ENDFORM.                    " read_infotype
    You can then call your form passing different infotype numbers to it.
    Hope that helps.
    Mary

  • HR_READ_INFOTYPE...not working.. for infty 2011

    hi
    i have just put this code and its not working for the pernr for which i have data..which i can c in pa20 transaction.
    actually its throwing exceptionn as infotype not found.
    where as 2011 is std infotype...
    DATA : p_2011 TYPE STANDARD TABLE OF p2011 WITH HEADER LINE.
    start-of-selection.
    get pernr.
    CALL FUNCTION 'HR_READ_INFOTYPE'
          EXPORTING
            pernr     = pernr-pernr
            infty     = '2011'
          TABLES
            infty_tab = p_2011
           EXCEPTIONS
       INFTY_NOT_FOUND       = 1
       OTHERS                = 2.
    end-of-selection.
    plz help me
    regards
    vivek

    The previous response is correct.. Time Events are stored in the TEVEN db Table.. the Infotype 2011 is only a frontend to load this table.. you cannot use HR_READ_INFOTYPE in this case as the Infotype 2011 table ( PA2011 ) doesn't exist. PL go through the following <a href="http://help.sap.com/saphelp_erp2005/helpdata/en/8a/98589346c411d189470000e829fbbd/frameset.htm">SAP Help</a> on Infotype 2011.
    You can use the function call HR_EVENT_READ to read the Time events data displayed on Infotype 2011.
    ~Suresh

  • ABAP-HR report using only OOPs...

    Hi experts,
                                         Can u please tell me is this possible to write a report with out using LDBs but only using OOPs.. are there any classes or methods works as macros in LDBs?
    If yes, please guid me with proper hints.
    Thanks & Regards,
    Friendof all..

    Hi Friendof mine...;)
    LDB though a classic approach provides very flexible way of data extraction, authorization, screens etc. So in my opinion you should stick to using it in some part, in order to get that services provided by standard. I doubt there is an OO approach to substitute the same entirely.
    Anyhow, if you want to transit to an OO HR, I would suggest to read about [Decoupling Infotype concept|http://help.sap.com/erp2005_ehp_04/helpdata/EN/4f/d52552575e11d189270000e8322f96/frameset.htm]. There is a separate framework available which you can use for master data reading/writing. It is a bit complex at first but serve an alternative to standard FMs like HR_READ_INFOTYPE , HR_INFOTYPE_OPERATION . For more refer a [Writing Infotype Records subsection|http://help.sap.com/saphelp_erp2005/helpdata/en/43/21d1014bba2bebe10000000a1553f7/frameset.htm] of above link.
    To sum up. This framework won't provide you full range options which you have in place by means of LDB. You can however mix classic approach (with GET PERNR events, LDB selection screen etc) with new OO approach for data extraction. The latter becomes recommended by SAP, but is more complex and requires preety good understanding of basic OO concepts (you mostly work with interfaces so the actual code is not so transparent to you). Anyhow I think it's worth trying, even just for sport.
    Furhter reading which might help to get the idea http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/14694. [original link is broken] [original link is broken] [original link is broken]
    Regards
    Marcin

  • HR_READ_INFOTYPE in OO context

    Hy everyone,
    I stumbled upon a problem and I kindly ask for your advice. Here is the context:
    - I am inside a BADI implementation
    - need to read the 0001 HR infotype for a given PERNR and target TARGETDATE, specifically I need the BTRTL and PERSK fields.
    I used to do this in 'normal' ABAP programs with something like:
    INFOTYPES: 0001.
    ...(some other code)...
    CALL FUNCTION 'HR_READ_INFOTYPE'
    EXPORTING
        pernr = pernr
        infty = '0001'
        begdata = TARGETDATE
        enddata = TARGETDATE
      TABLES infty_tab = p0001.
    tempBTRTL = p0001-BTRTL.
    tempPERSK = p0001-PERSK.
    Now using this code is not allowed (INFOTYPES is not allowed in OO context).
    Tried to declare DATA: p0001 TYPE TABLE OF p0001 INITIAL SIZE 0. => but then cannot access fields BTRTL or PERSK because p0001 has no header line. (also header line is not allowed in OO context).
    Can you help with suggesting how to get the required info?

    ABAP objects not use internal tables with header line. Because of this you need to create the table without header line and a workarea for manage data. For example
    data lt_p0001 type standard table of p0001.
    data wa_p0001 type p0001.
    loop at lt_p0001 into wa_p0001.
    endloop.
    read table lt_p0001 into wa_p0001 index 1.

  • Insert or change the employee status (pa0000-stat1) using HR_MAINTAIN_MAST

    hi abapers
    i am using HR_MAINTAIN_MASTERDATA to insert or modify employee status (pa0000-stat1).
    IN HR_MAINTAIN_MASTERDATA there is return statement in import. and i am giving BAPIRETURN1 and BAPIRETURN2 and pass data(employee status to be changed) to proposed_values table
    when i check return IS iNITIAL or not. return is coming initial. what does it mean??
    actually i am new in HR module. plz help
    thanks
    Sachin

    hi Napsterr
    yes i am getting '000'.
    when i am giving incorrect data , some error is coming.
    what does it mean?
    employee status is not yet inserted or modified.
    here is my code. please tell me where i am missing.
    REPORT  ZTEST_STATUSUPDATE2.
    Parameter p_pernr like pa0000-pernr.
    Parameter p_stat1 like pa0000-stat1.
    DATA: OPERATION     LIKE PSPAR-ACTIO,
            RETURN1        LIKE BAPIRETURN1,
            RETURN        LIKE BAPIRETURN,
            VALIDITYBEGIN LIKE P0001-BEGDA,
            ILINES        LIKE SY-TABIX.
      DATA: VALUES        LIKE PPROP OCCURS 10 WITH HEADER LINE,
            IP0000        LIKE P0000 OCCURS  1 WITH HEADER LINE.
        CALL FUNCTION 'HR_READ_INFOTYPE'
          EXPORTING
            PERNR     = p_pernr
            INFTY     = '0000'
            BEGDA     = SY-DATUM
            ENDDA     = SY-DATUM
          TABLES
            INFTY_TAB = IP0000.
          DESCRIBE TABLE IP0000 LINES ILINES.
          IF ILINES EQ 0.
            OPERATION     = 'INS'.
            VALIDITYBEGIN = SY-DATUM.
          ELSE.
            READ TABLE IP0000 INDEX 1.
            VALIDITYBEGIN = IP0000-BEGDA.
            OPERATION     = 'MOD'.
          ENDIF.
          VALUES-INFTY = '0000'.
          VALUES-FNAME = 'P0000-stat1'.
          VALUES-FVAL  = p_stat1.
          APPEND VALUES.
          CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'
            EXPORTING
              PERNR           = p_pernr
              ACTIO           = OPERATION
              BEGDA           = VALIDITYBEGIN
              ENDDA           = '99991231'
              SUBTY           = SPACE
              NO_ENQUEUE      = SPACE
              NO_EXISTENCE_CHECK       = 'X'
            IMPORTING
               RETURN        = RETURN
              RETURN1         = RETURN1
            TABLES
              PROPOSED_VALUES = VALUES
            MODIFIED_KEYS   =
            EXCEPTIONS
              OTHERS          = 1.
          IF ( return-type EQ 'E' OR return1-type EQ 'E').
          MESSAGE 'error' type 'E'.
           ELSEIF  RETURN is INITIAL.
            MESSAGE 'initial value' type 'I'.
          ELSE.
            MESSAGE ID     RETURN1-ID
                    TYPE   'S'
                    NUMBER RETURN1-NUMBER
                    WITH   RETURN1-MESSAGE_V1 RETURN-MESSAGE_V2
                           RETURN1-MESSAGE_V3 RETURN-MESSAGE_V4.
    endif.
    thanks
    Sachin

  • How to use betrg and sumbb in FM?

    Hi experts,
    The specification given is to get the personal_no(pernr),Complete name(CNAME) of the employees who are having active status i.e(STAT2 = 3) is the condition  from pa0000,and for that list of employees get the  basic pay(BETRG) using "HR_Read_Infotype" function module,and  gross salary(SUMBB) using "HR_GET_TOTAL_AMOUNT_P0008" and display all the output using ALV grid  display.I am getting so many errors in doing that report.I need some codings for that urgently.Kindly give me some ideas or codings if possible.
    Thanks in advance,
    Sakthi.
    Message was edited by:
            Sakthi saravanan

    Hi,
    Follow the below steps:
    1)Declare an internal table ITAB with all the fields which needs to be displayed in ALV Grid.
    2)Get PERNR, CNAME into internal table ITAB with appropriate condition in SELECT statment.
    3)Get all details into ITAB:
    Start DO<>TIMES loop.
    READ table ITAB into WA_TAB.
    Get BETRG and SUMBB using FMs into WA_TAB and then
    MODIFY ITAB FROM WA_TAB INDEX SY-INDEX.
    ENDDO.
    Now internal table has all data.
    4)Display it using proper coding in ALV GRID.
    *if you need help in ALV Grid then let me know.
    *Always reward points for helpful answers
    Regards,
    Amit

  • Regarding the Function module HR_READ_INFOTYPE

    Hi Experts,
    I'm using the Function module HR_READ_INFOTYPE and the code is as following
    CALL FUNCTION 'HR_READ_INFOTYPE'
            EXPORTING
              pernr     = g_pernr
              infty     = '0002'
            TABLES
              infty_tab = it0002.
          CLEAR wa0002.
          READ TABLE it0002 INTO wa0002 WITH KEY pernr = g_pernr.
    it is not fetching the data for a particular PERNR but the sy-subrc is 0 after the executing the Function module.
    Please help me out.
    Thanks
    Nivash S

    Hi Experts,
    Thanks for Ur advice. Actually there is no authorization for that particular PERNR thats why it has skipped that particular record.
    Thanks Once again,
    Nivash S
    Edited by: Nivash S on May 12, 2009 8:49 AM

Maybe you are looking for