cancel
Showing results for 
Search instead for 
Did you mean: 

How to maitain relatinoship for person and postion

Former Member
0 Kudos

Hi, Experts,

Help need urgently..

I use FM: HR_MAINTAIN_MASTERDATA to create a new person in my code. And assign a position to him/her. The relationship exists in PA0001 but I can't find the relationship in HRP1001.

As you know if I use Tcode PA30 create new employee and assign the position the relationship would be saved in table HRP1001.

Who Knows how would I give the relationship for table HRP1001 in code.

So appreciate for your help.

David.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

David,

Use the FM RH_RELATION_MAINTAIN for maintaining relation.

If u want to create relation use FCODE = 'INSE'...which is used for creation...

Refer below code for eg..,

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.

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.

COMMIT WORK.

ENDLOOP.

Regards,

Thyagu.N

Former Member
0 Kudos

Thanks for your quickly responds and really solve my issue.

Thanks.

Best Regards,

David

Edited by: David Li on Sep 25, 2008 6:18 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,

When you hire a person then a new entry is created in table HRP1001 ( A-008) - Holder Relationship with a corresponding Pernr and Name.

You can use the TCode -PP01

Enter the Position No.

Chech for Relationship - A-008 - Holder.

Hope this helps.

Regards,

Param

Edited by: Param Dayal on Sep 24, 2008 7:04 PM