Skip to Content
avatar image
Former Member

Programmatically create a relationship between two positions in HR

Hi,

I have a requirement to create relationships in HRP1001 between two given positions with a start and end date.

I need to write an upload program to do this but want to avoid Batch Input if possible.

Are there any relevant function modules that can do what transaction PP01 does?

Many Thanks

David

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 04, 2008 at 09:49 AM

    Hi,

    Try using this code

    LOOP AT T_MAINTAIN INTO WA_MAINTAIN.

    WA_MAINTAIN-FCODE = 'INSE'.

    WA_MAINTAIN-PLVAR = '01'.

    WA_MAINTAIN-ISTAT = '1'.

    *Relate account to project

    IF WA_MAINTAIN-OTYPE = 'O' AND WA_MAINTAIN-SCLAS = 'O'.

    WA_MAINTAIN-RSIGN = 'B'.

    WA_MAINTAIN-RELAT = '002'.

    *Relate position to project

    ELSEIF WA_MAINTAIN-OTYPE = 'O' AND WA_MAINTAIN-SCLAS = 'S'.

    WA_MAINTAIN-RSIGN = 'B'.

    WA_MAINTAIN-RELAT = '003'.

    *Relate job to position

    ELSEIF WA_MAINTAIN-OTYPE = 'S' AND WA_MAINTAIN-SCLAS = 'C'.

    WA_MAINTAIN-RSIGN = 'B'.

    WA_MAINTAIN-RELAT = '007'.

    *Relate employee to position

    ELSEIF WA_MAINTAIN-OTYPE = 'S' AND WA_MAINTAIN-SCLAS = 'P'.

    WA_MAINTAIN-RSIGN = 'A'.

    WA_MAINTAIN-RELAT = '008'.

    ENDIF.

    *Relate position to position

    ELSEIF WA_MAINTAIN-OTYPE = 'S' AND WA_MAINTAIN-SCLAS = 'S'.

    WA_MAINTAIN-RSIGN = 'A'.

    WA_MAINTAIN-RELAT = '002'.

    ENDIF.

    WA_MAINTAIN-ENDDA = '99991231'.

    *FM to create relationship

    CALL FUNCTION 'RH_RELATION_MAINTAIN'

    EXPORTING

    ACT_FCODE = WA_MAINTAIN-FCODE

    ACT_PLVAR = WA_MAINTAIN-PLVAR

    ACT_OTYPE = WA_MAINTAIN-OTYPE

    ACT_OBJID = WA_MAINTAIN-OBJID

    ACT_ISTAT = WA_MAINTAIN-ISTAT

    ACT_RSIGN = WA_MAINTAIN-RSIGN

    ACT_RELAT = WA_MAINTAIN-RELAT

    ACT_SCLAS = WA_MAINTAIN-SCLAS

    ACT_SOBID = WA_MAINTAIN-SOBID

    ACT_BEGDA = WA_MAINTAIN-BEGDA

    ACT_ENDDA = WA_MAINTAIN-ENDDA

    ACT_PROZT = WA_MAINTAIN-PROZT

    EXCEPTIONS

    MAINTAINANCE_FAILED = 1

    OTHERS = 2.

    IF SY-SUBRC <> 0.

    • WRITE : WA_INPUT-OBJID.

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

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

    ENDIF.

    ENDLOOP.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 09:31 AM

    HI,

    Please try Fm RH_RELATION_MAINTAIN.

    error-message-in-rhrelationmaintain

    Regards

    Sumit Agarwal

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 09:48 AM

    Hi,

    I hope the below link will help you.

    Creating Relationships in HR

    Thanks,

    Khushboo.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 09:50 AM

    use RH_OM_PP01_INFTY_CHECK function module

    Add comment
    10|10000 characters needed characters exceeded