Skip to Content
author's profile photo
Former Member

HR_INFOTYPE_OPERATION - explain

Hi experts,

Can any one explain the function module HR_INFOTYPE_OPERATION and give me a example. ?

Regards,

Murugan Arumugam

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on Sep 20, 2007 at 10:13 AM

    hi,

    pls check this link.

    hrinfotypeoperation

    regards,

    jinesh

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 20, 2007 at 10:08 AM

    Hi,

    1. this is the full coding.

    2. just copy paste in new program.

    3. U can change the infotype, pernr and other values as per requirement.

    4.

    Report abc.

    *----


    Data

    DATA : P0015 LIKE P0015.

    DATA : RETURN LIKE BAPIRETURN1.

    DATA : KEY LIKE BAPIPAKEY.

    DATA : RETURNE LIKE BAPIRETURN1 .

    *----


    Values (Change as per Requirement)

    P0015-PERNR = '1'.

    P0015-BEGDA = '2061101'.

    P0015-ENDDA = '2061101'.

    P0015-LGART = '3075'.

    P0015-PREAS = '01'.

    P0015-WAERS = 'INR'.

    P0015-BETRG = '2500'.

    *----- First Enqu

    CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

    EXPORTING

    NUMBER = p0015-pernr

    IMPORTING

    RETURN = RETURNE.

    *----


    Update

    CALL FUNCTION 'HR_INFOTYPE_OPERATION'

    EXPORTING

    INFTY = '0015'

    NUMBER = P0015-PERNR

    SUBTYPE = P0015-SUBTY

    OBJECTID = P0015-OBJPS

    LOCKINDICATOR = P0015-SPRPS

    VALIDITYEND = P0015-ENDDA

    VALIDITYBEGIN = P0015-BEGDA

    RECORDNUMBER = P0015-SEQNR

    RECORD = P0015

    OPERATION = 'INS'

    TCLAS = 'A'

    DIALOG_MODE = '0'

    IMPORTING

    RETURN = RETURN

    KEY = KEY.

    IF RETURN IS NOT INITIAL.

    WRITE :/ 'Error Occurred'.

    ENDIF.

    *----


    Dequeue

    CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

    EXPORTING

    NUMBER = P0015-PERNR

    Check this also.

    https://forums.sdn.sap.com/click.jspa?searchID=5379322&messageID=3258061

    Thanks,

    Reward If Helpful.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi viji,

      Following is the my code to upload infotype 0008 (basic pay).

      The internal table contains 2 records.

      1. for type 1000(basic pay)

      2. for type 1050(DA).

      but only DA is updated. basic pay is not updated.

      Pls help me to do.

      &----


      *& Report Z_R_BDA_UPLOAD

      *&

      &----


      *&

      *&

      &----


      REPORT Z_R_BDA_UPLOAD.

      *LOOP AT i_award.

      *infotype : 0008.

      TABLES : P0008.

      DATA: G_RETURN TYPE bapireturn1,

      infty_key TYPE bapipakey.

      DATA : BEGIN OF I_DATA OCCURS 0,

      pernr like p0008-pernr,

      BEGDA like p0008-begda,

      ENDDA like p0008-endda,

      TRFGR like p0008-trfgr,

      TRFST like p0008-trfst,

      LGA01 like p0008-lga01,

      BET01 like p0008-bet01,

      END OF I_DATA.

      DATA : BEGIN OF I_DATA2 OCCURS 0,

      pernr like p0008-pernr,

      BEGDA like p0008-begda,

      ENDDA like p0008-endda,

      TRFGR like p0008-trfgr,

      TRFST like p0008-trfst,

      LGA01 like p0008-lga01,

      BET01 like p0008-bet01,

      END OF I_DATA2.

      • Lock the employee before updating IT0105.

      I_DATA-pernr = '4834'.

      I_DATA-BEGDA = '20070401'.

      *I_DATA-ENDDA = '99991231'.

      I_DATA-TRFGR = 'G2'.

      I_DATA-TRFST = '0'.

      I_DATA-LGA01 = '1000'.

      I_DATA-BET01 = 15022.

      APPEND I_DATA.

      I_DATA-pernr = '4834'.

      I_DATA-BEGDA = '20070401'.

      *I_DATA-ENDDA = '99991231'.

      I_DATA-TRFGR = 'G2'.

      I_DATA-TRFST = '0'.

      I_DATA-LGA01 = '1050'.

      I_DATA-BET01 = 8202.

      APPEND I_DATA.

      *CLEAR P0008.

      LOOP AT I_DATA.

      MOVE-CORRESPONDING I_DATA TO p0008.

      CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

      EXPORTING

      number = P0008-pernr

      IMPORTING

      return = g_return.

      CALL FUNCTION 'HR_INFOTYPE_OPERATION'

      EXPORTING

      infty = '0008'

      number = p0008-pernr

      • SUBTYPE =

      • OBJECTID =

      • LOCKINDICATOR =

      validityend = p0008-ENDDA

      validitybegin = p0008-BEGDA

      • RECORDNUMBER =

      record = p0008

      operation = 'INS'

      TCLAS = 'A'

      • DIALOG_MODE = '0'

      NOCOMMIT = ''

      • VIEW_IDENTIFIER =

      • SECONDARY_RECORD =

      IMPORTING

      return = G_return

      key = infty_key

      .

      CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

      EXPORTING

      number = P0008-PERNR.

      ENDLOOP.

  • author's profile photo
    Former Member
    Posted on Sep 20, 2007 at 10:11 AM

    hi,

    With HR_INFOTYPE_OPERATION you can

    Maintenance of HR infotype entries, used to create (operation = INS), change (operation = MOD), delete (operation = DEL) and create successor (operation = COP)

    sample code

    CASE innnn-infty.

    WHEN '0105'.

    DATA: lt_p0002 TYPE TABLE OF p0002,

    ls_p0002 LIKE LINE OF lt_p0002,

    lt_p0002_ret TYPE p0002 OCCURS 0 WITH HEADER LINE,

    l_return TYPE bapireturn1,

    l_uname LIKE sy-uname,

    lt_p0105 TYPE TABLE OF p0105,

    ls_p0105 LIKE LINE OF lt_p0105,

    lt_p0105_ret TYPE p0105 OCCURS 0 WITH HEADER LINE,

    l_usrid_long LIKE p0105-usrid_long.

    IF sy-ucomm EQ 'UPD'

    AND innnn-data1(4) = '0001'.

    CONCATENATE innnn-data1+4(30) '@xxx.dk' INTO l_usrid_long.

    CONDENSE l_usrid_long NO-GAPS.

    TRANSLATE l_usrid_long TO UPPER CASE.

    CALL FUNCTION 'HR_READ_INFOTYPE'

    EXPORTING

    pernr = innnn-pernr

    infty = '0105'

    begda = innnn-begda

    endda = innnn-endda

    TABLES

    infty_tab = lt_p0105.

    LOOP AT lt_p0105 INTO ls_p0105 WHERE subty EQ '0010'.

    IF ls_p0105-usrid_long NE l_usrid_long.

    ls_p0105-usrid_long = l_usrid_long.

    lt_p0105_ret = ls_p0105.

    IF lt_p0105_ret-begda LT innnn-begda.

    lt_p0105_ret-begda = innnn-begda.

    ENDIF.

    IF lt_p0105_ret-endda GT innnn-endda.

    lt_p0105_ret-endda = innnn-endda.

    ENDIF.

    APPEND lt_p0105_ret.

    ENDIF.

    ENDLOOP.

    IF sy-subrc NE 0.

    lt_p0105_ret = innnn.

    lt_p0105_ret-subty = '0010'.

    lt_p0105_ret-usrty = '0010'.

    CLEAR lt_p0105_ret-usrid.

    lt_p0105_ret-usrid_long = l_usrid_long.

    ENDIF.

    CALL FUNCTION 'HR_INFOTYPE_OPERATION'

    EXPORTING

    infty = '0105'

    number = innnn-pernr

    subtype = '0010'

    record = lt_p0105_ret

    operation = 'COP'

    IMPORTING

    return = l_return.

    CALL FUNCTION 'HR_READ_INFOTYPE'

    EXPORTING

    pernr = innnn-pernr

    infty = '0002'

    begda = innnn-begda

    endda = innnn-endda

    TABLES

    infty_tab = lt_p0002.

    LOOP AT lt_p0002 INTO ls_p0002.

    IF ls_p0002-inits NE innnn-data1+4(30).

    lt_p0002_ret = ls_p0002.

    IF lt_p0002_ret-begda LT innnn-begda.

    lt_p0002_ret-begda = innnn-begda.

    ENDIF.

    IF lt_p0002_ret-endda GT innnn-endda.

    lt_p0002_ret-endda = innnn-endda.

    ENDIF.

    lt_p0002_ret-inits = innnn-data1+4(30).

    APPEND lt_p0002_ret.

    ENDIF.

    ENDLOOP.

    CALL FUNCTION 'HR_INFOTYPE_OPERATION'

    EXPORTING

    infty = '0002'

    number = innnn-pernr

    record = lt_p0002_ret

    operation = 'COP'

    IMPORTING

    return = l_return.

    COMMIT WORK.

    ENDIF.

    ENDCASE

    <b>Reward points if helpful,</b>

    Regards,

    jinesh.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 07:27 AM

    Thanks a lot

    Add comment
    10|10000 characters needed characters exceeded