Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error in HCM organization unit update via class method

timo_saviahde
Explorer
0 Kudos

Hello!

I am doing customer WebDynpro ABAP development with SAP HCM. Basically I am developing WDA program
that creates new HR employees to SAP HCM.

I have a problem with SAP HR organization's position - employee assigment when creating employee,
that has limited validity with organization assigment.

Basically I want to create person that has most of HR infotypes with validity period that ends
at date 31.12.9999. Only infotype 1 (organization assigment) validity period is needed to be ended
with other date than 31.12.9999 (with actual organization's position). The rest of validity period
should be assigned to position 99999999 (= user is no more assigned to actual position, 99999999 is default position).

So result in infotype 1 should be like this:

Validity start  Validity end  Position
8.8.2013        12.8.2013     50000114
13.8.2013       31.12.9999    99999999

I'm using function HR_PAD_HIRE_EMPLOYEE to create new employee with validty period that ends at 31.12.9999.
After that I use class CL_HRPA_MASTERDATA_FACTORY with interface IF_HRPA_PLAIN_INFOTYPE_ACCESS by INSERT method to make new entry to infotype 1 data with position 99999999. (I can't do that in HR_PAD_HIRE_EMPLOYEE function, because I need only it 1 with different validity periods than rest ones - if I try to limit only it 1 validty period in function, it gives me an error that says that there must be no gaps in it data.)

My solution is working fine (at infotype 1: infotype is delimited correctly when creating new it entry), but actual lines in organization assigment table (HRP1001) goes now like this:


P 150139   01 B 008 1  08.08.2013 12.08.2013 S 50000114  1001 P 00150139 B008 07.08.2013 SAVIAHDE_T    S 50000114
P 150139   01 B 008 1  13.08.2013 31.12.9999 S 50000114  1001 P 00150139 B008 07.08.2013 SAVIAHDE_T    S 50000114
S 50000114 01 A 008 1  08.08.2013 12.08.2013 P 00150139  1001 S 50000114 A008 07.08.2013 SAVIAHDE_T    P 00150139
S 50000114 01 A 008 1  13.08.2013 31.12.9999 P 00150139  1001 S 50000114 A008 07.08.2013 SAVIAHDE_T    P 00150139

So basically there is now 4 lines created. It should be only 2 lines like this:


P 150139   01 B 008 1  08.08.2013 12.08.2013 S 50000114  1001 P 00150139 B008 07.08.2013 SAVIAHDE_T    S 50000114
S 50000114 01 A 008 1  08.08.2013 12.08.2013 P 00150139  1001 S 50000114 A008 07.08.2013 SAVIAHDE_T    P 00150139

Those 4 lines in HRP1001 table results situation that employee has 2 position - person assigments in HR organization.
Both assigments are starting date 8.8.2013 without ending date.

So basically class' methods creates (delimites existing it entry and creates one new it entry) infotype 1 correctly, but HRP1001 table is not updated correctly via class CL_HRPA_MASTERDATA_FACTORY with interface IF_HRPA_PLAIN_INFOTYPE_ACCESS via INSERT method.

 

If we do new employee creation in SAP GUI using transaction PA40, the organization assigments in HRP1001 are assigned correctly.

I found notes

Note 1667139 - IT0001: Previous record assigned to default position
Note 1674514 - IT0001: Previous record assigned to default position [2]

Note 1864520 - IT0001: Error message "S 00000000 does not exist"


, but they are not exactly valid to my situation. And in other hand our system have them installed.

I think that I found the class method where this position update goes somehow wrong: Infotype 1 is updated by using class CL_HRPA_INFTY_0001
and position determination is handled at method INTEGRATION_PA_OM that uses FILL_POSITION_TAB method. Method FILL_POSITION_TAB receives information about new position (99999999) via IT data (P0001-PLANS). When new position (99999999) is same as default position in attribute a_defplans and without organization, method valuates position table correctly - in my case like this:

OTYPE OBJID    BEGDA    ENDDA    PROZT  OPERA
S     50000114 20130808 99991231 0.00   DEL
S     50000114 20130808 20130812 0.00   INSO
S     99999999 20130813 99991231 100.00 INSN

But when execution comes to method UPDATE_RELATIONSHIPS (in class CL_HRPA_INFTY_0001) something goes wrong and the
line that contains default position (99999999) is not handled correcty. I'm not sure, but it seems like lines with value 'INSN' in table's OPERA column is not handled at all and therefore the organization entry is updated wrongly.

So is there something wrong with class method that needs to be fidex?

-Timo

Message update at 9th of August 2013:

I made some modifications to my program. Now I write also infotype 0 data with ending emloyee's job information (in same "call stack" as it 1 data) and something got fixed in HR organization: Now the first part of validity periods is correctly in SAP HR organization: Entry with validity period  8.8.2013 - 12.8.2013 is displayed correctly in HR organization.

But I still have second position assigment (with validty date range 13.8.2013 - 31.12.9999) in HRP1001 table (and therefore also in HR organization).

So problem is still that SAP's class method / functions writes additional entires in HRP1001 table with date range 13.8.2013 - 31.12.9999 using original position 50000114.

Dirty fix for this could be that I delete those additional lines from HRP1001 table using SQL clause(s), but I do not want to do this, because there is possibility that something else gets broken...

-Timo

Message was edited by: Timo Saviahde

1 ACCEPTED SOLUTION

timo_saviahde
Explorer
0 Kudos

Hi!

No-one answered --> I did dirty fix with abap code that fixes entires in HRP1001 table. Seems to work just fine.

-Timo

15 REPLIES 15

timo_saviahde
Explorer
0 Kudos

Hi!

No-one answered --> I did dirty fix with abap code that fixes entires in HRP1001 table. Seems to work just fine.

-Timo

0 Kudos

Hi Saviahde,

I have the similar requirement.

Here when a record is created in PP01(1001) for a Position, the Organisation Unit should get Updated for the Employee Position in the Infotype 0001.

By using one Function Module, i can insert a record in 1001, but unable to update the same in Infotype 0001.

Can you please suggest any solution...

Thanks & Best Regards,

0 Kudos

Hi Dinu!

What function module you are using?

-Timo

0 Kudos

Hi Timo,

I have used below FM to insert OM Record.

RH_PNNNN_MAINTAIN

0 Kudos

Hi Dinu!

Have you looked this thread:

?

-Timo

0 Kudos

Timo,

after inserting record into OM, i am using  HR_INFOTYPE_OPERATION to insert a record in Infotype 0001.

But i am having some issue in the PA30 Scree. When i am trying to create manual entry in PA30 for Infotype 1, system is showing message as " data hidden by screen modifications ".

and i continues create entry. I can see all the updated data .

Trying to solve the issue with the inoftype Updation. If u have any solution. Please let me know

0 Kudos


Hi!

Usually message "data hidden by screen modifications" is information message (green icon). Not a warning (yellow icon) nor error (red icon).

So, are you sure that you have error message in your PA30 screen? Because, if it continues processing after enter (or save), it is just a information or warning message, not error.

-Timo

0 Kudos

Yea Timo,

Firstly i am using  RH_PNNNN_MAINTAIN to create OM Record.

Now, i am using HR_INFOTYPE_OPERATION a record in 0001 Infotype.

Let for ex: i am using BEGDA as 02-09-2014.

I posted entries for OM and 0001 infotypes. But here, I can see the created entry in PP01 but not in the PA30-0001 Infotype.

and here in PA30 i created manual entry with date 03-09-2014, when i save the data, i can also see the entry created with date 02-09-2014.

I think my logic is created a record in Infotype 0001 but not updating it.

Can you please tell me, how to update it.

0 Kudos

Hi!

I think that you should first create IT 0001 data with HR_INFOTYPE_OPERATION. After creation check that is there OM relationships created between person and position (in both directions) by HR_INFOTYPE_OPERATION.

And if there is no relations created in OM, you should create it with some function (I haven't been using RH_PNNNN_MAINTAIN function, so I'm not sure what it will actually do).

In my case, I have been using Decoupled Infotype Framework's ABAP classes and there is OM relationship handling build-in by SAP (that is does not work correctly in some cases).

-Timo

Former Member
0 Kudos

Hello Timo,

When you create a realtionship in OM it will create two reltionships as below that is standard.

1. Employee(P) holds that respecitve position(S) from that period. This relationship is A008

2.For the same period reverse mapping is Position(S) occupied by the employee(P). This relationship is B008.

So this is SAP standard behavior and excellent approach to achieve reverse mapping no need to worry.

Regards,

Mayure.

0 Kudos

Hi Mayure!

I must ask, because I'm not sure what you ment: Do you mean that my solution to delete those unneeded entires from HRP1001 table with SQL is ok?

Because the problem was this:

"So problem is still that SAP's class method / functions writes additional entires in HRP1001 table with date range 13.8.2013 - 31.12.9999 using original position 50000114."

I debugged those SAP codes and my opinion was that SAP standard is not working as it should work, when creating organization assignments when creating contracts that are not valid to end of time (IT 0 and 1 have 2 entries: 1) person creation action with organization position 2) action for person's resigning with position 99999999 that starts before end of time 31.12.9999).

-Timo

0 Kudos

Hi Timo,

No need to delete the unneeded entries . In fact those are not unneeded entries.

As in SAP OM module for every relationship between two objects (Here in your case P & S) there will be two records. One is top-bottom and bottom-down relationship.

Even you can get more clarity by creating a relationship from PP01 T.Code it will also create two records for one relationship.

And also have a look about OM relationship types in the link

HCM - Creating an Organizational Structure

Plz revert back if any clarification required.

Regards,

Mayure.

0 Kudos

Hi!

Yes I know this.

But the problem is this:

When changing person's position in organization (by using infotypes 0 and 1) when person resigns the system

1) Creates new position assignment for dummy position 9999999 and

2) Delimits old assignment to be ended at day before resigning date.

3) But it also creates new organization assignment to old position starting at person's resigning date.

And the place where this is messed up is in method UPDATE_RELATIONSHIPS (in class CL_HRPA_INFTY_0001): something goes wrong and the line that contains default position (99999999) is not handled correcty. I'm not sure, but it seems like lines with value 'INSN' in table's OPERA column is not handled at all and therefore the organization entry is updated wrongly.

So in my point of view there is definitelly something wrong in class based infotype 1 handling. When this is done in backend (SAP GUI) this all goes just fine by standard behaviour.

-Timo

0 Kudos

OK Timo.

So the problem is that it was creating two records but the allocation percentage weighting (PROZT) is 100% to default position 99999999 and 0% to the old position.

I will get back to you again . I will check that method and will reply you back.

Regards,

Mayure.

0 Kudos

Hi!

If I recall correctly there is not even posibility to give percent in infotype 1 and therefore the percent is not transfered to method...

-Timo