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: 

How to Create Function Module to update infotype pa0016

Former Member
0 Kudos

Dear Friends,

I have requirement in which i have to create a function module which will take pernr, massn, massg, date which will update the infotype PA0016.

This will update the pa0016-CTTYP from temparoy to permanent. .

Anybody can help me out in the same.

Thakns,

Ravi Grover

1 ACCEPTED SOLUTION

former_member217316
Contributor
0 Kudos

Hi Ravi

Try this FM: HR_MAINTAIN_MASTERDATA.

You will have to use this FM within a loop statement for updates of multiple employees.

To improve the performance of this, use the FM: HR_PSBUFFER_INITIALIZE.

Hope this helps.

Harsh

4 REPLIES 4

Former Member
0 Kudos

Hi,

You can make use of the BAPI-HR_INFOTYPE_OPERATION for any Infotype related operations.

You need to pass your infotype no. begin and end date and operation type etc.,. as Import parameters to this FM.

Below are different operations we pass to this FM.

CHANGE - 'MOD'

CREATE - 'INS'

DELETE - 'DEL'

Also please check for where-used list of this FM to get better understanding on how to use it. And read the Function Module documentation as well.

Regards,

Vimala P

former_member217316
Contributor
0 Kudos

Hi Ravi

Try this FM: HR_MAINTAIN_MASTERDATA.

You will have to use this FM within a loop statement for updates of multiple employees.

To improve the performance of this, use the FM: HR_PSBUFFER_INITIALIZE.

Hope this helps.

Harsh

Former Member
0 Kudos

Hi,

The HR_INFOTYPE_OPERATION function module is used for the Maintenance of HR infotypes, such as inserting, changing, deleting data etc .

Parameters Explained

Here is a list of the fm's parameters and how they are used, obviously not all parameters will be used depending on what function you are performing i.e. insert, change, delet etc

infty - Infotype being updated

objectid - object id from infotype

number - Personnel number

validityend - validity end date

validitybegin - validity begin date

record - infotype record values to be updated, inserted etc (will be structure of infortyoe you are updating)

recordnumber - sequence nunber from infotype record you are updating

Operation - describes what operation is to be performed

COP = Copy

DEL = Delete

DIS = Display

EDQ = Lock/unlock

INS = Create

LIS9 = Delimit

MOD = Change

INSS = Create for Actions is not converted to Change

nocommit - commit yes('X') / no(' ')

dialog_mode - dialog mode or not, default is '0'

Example coding for INS operation

 CONSTANTS: insert TYPE pspar-actio VALUE 'INS'.

      "This code is requred and locks the record ready for modification
      CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
        EXPORTING
         number = p_pernr.


      validitybegin = p_record-begda.
      validityend   = p_record-endda.
      p_record-pernr = p_pernr
      p_record-begda =  pn-begda.
      p_record-endda =  validityend.
      p_record-subty = p_SUBTY.  "subtype of new entry
      p_record-SCREF = p_SUBTY.  "subtype of new entry
      "plus populate any other fields you need to update

      CALL FUNCTION 'HR_INFOTYPE_OPERATION'
        EXPORTING
          infty         = '0071'
          subtype       = p_record-subty
          number        = p_record-pernr     "employeenumber
          validityend   = validityend
          validitybegin = validitybegin
          record        = p_record
          operation     = insert
          nocommit      = nocommit
          dialog_mode   = '0'
        IMPORTING
          return        = return_struct
          key           = personaldatakey
        EXCEPTIONS
          OTHERS        = 0.

     "unlock record after modification
     CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
       EXPORTING
        number = p_pernr.

Hope this will helpful.

Regards,

Renuka S.

Former Member
0 Kudos

Hi,

Write a BDC to update the contract type field. (Record PA30 transaction for PA0016)

Regards,

Srini.