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: 

what is the best method to MODIFY the HR INFOTYPE tables

former_member184119
Active Contributor
0 Kudos
321

Hi All,

I need one small requirement . I need to create one conversion program where i need to move the data from district field to city field in the address infotype making district field data empty.

whether any one can tell me what is the best process to achieve this..

I am just thinking HR_INFOTYPE_OPERATION and HR_MAINTAIN_MASTERDATA...Which one is the best ? What is the exact difference between those two function modules..

I am just thinking i can code this way please correct me if i am wrong...

stat-o-selectn.

get pernr.

loop at p0006.

call fnction bapi_employee

move p0006-district to city.

call fn hr_ifnotype_operation.

call function bapi_dequee.

endloop.

Regards

sas

Edited by: saslove sap on Mar 2, 2009 6:29 AM

1 ACCEPTED SOLUTION

amit_khare
Active Contributor
0 Kudos
119

FM HR_INFOTYPE_OPERATION will internally call FM HR_MAINTAIN_MASTERDATA.

You can use HR_INFOTYPE_OPERATION, select the approprite value for ACTIO.

7 REPLIES 7

amit_khare
Active Contributor
0 Kudos
120

FM HR_INFOTYPE_OPERATION will internally call FM HR_MAINTAIN_MASTERDATA.

You can use HR_INFOTYPE_OPERATION, select the approprite value for ACTIO.

0 Kudos
119

Hi Amit,

Oh...Thanks .That would be great.

So i am just doing the either way.

Please let me know is this fine or any drawbacks.....as this will effect my database tables i am not going to take cahnce to implement in the sap versions...i dont have sand box either

Just declaring the


Data: I0006 LIKE P0006 OCCURS 0 WITH HEADER LINE.

start-of-selection.
Get pernr.
*just have one doubt irrespective of time constarints & every thing i need to move all the district data to*
*city field is this looping is fine??Is it going to capture all the records??or any codition along with loop?*
loop at p0006.
pooo6-dist to p0006-city
p006-dist = space.

move p0006 to i0006.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
    EXPORTING
      NUMBER = PERNR-PERNR
    IMPORTING
      RETURN = RETURN.

  IF RETURN IS INITIAL.

    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
      EXPORTING
        INFTY                  = '0006'
        NUMBER                 = PERNR-PERNR
*               SUBTYPE                =
*                objectid               = i0024-objps
*                LOCKINDICATOR          = i0024-sprps
        VALIDITYEND            = '99991231'
        VALIDITYBEGIN          = I0006-BEGDA
      RECORDNUMBER           = I0006-SEQNR
        RECORD                 = I0006
        OPERATION              = 'MOD'
      IMPORTING
        RETURN                 = RETURN.
*               KEY                    =

    IF NOT RETURN IS INITIAL.
      WRITE: / 'IT0008 FAIL - PERNR:' , PERNR-PERNR .

    ENDIF.



    CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
      EXPORTING
        NUMBER = PERNR-PERNR
      IMPORTING
        RETURN = RETURN.

  ELSE.

    WRITE: / PERNR-PERNR, ' - Locked employee'.

  ENDIF.

Edited by: saslove sap on Mar 2, 2009 7:55 AM

0 Kudos
119

By default Get PErnr will only fetch employee record with end date LE 12/31/9999.

I will suggest to use SELECT and get all the data in an internal table and then update as you want all data irrespective of time.

0 Kudos
119

????

Amit obviously all the records are less than 12/31/9999 then whats the problem? I didnt get that...

Just thinking to use select statment is the last option due to performance....

regards

sas

0 Kudos
119

It looks for Active records with that end date.

0 Kudos
119

Amit,

are you sure about this point???

On the selection-screen there is a option to select Employement status where i selected that as inactive employees and executed the report the report is fecthing those inactive employeess either :-(...

regards

sas

Former Member
0 Kudos
119

Hi,

You are right.Using the function module "HR_INFOTYPE_OPERATION" is the best way of modify a infotype table.

-Bhumika