Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to maitain relatinoship for person and postion

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.

replied

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

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question