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: 

Update data in infotype 14

anupam_srivastava2
Participant
0 Kudos
1,061

Hi All

I have got all the data in infoytpe 14, only thing is I need to update the Assignment field in that infotype. Now I have also to check for particular wage types only I need to update and have to check the begda and enda.

I have searched the forum and found some FM - HR_maintain_masterdata. But I dont know if I can use it for updating records or just uploading.

If any body as used it before and can guide me that will be of great help.

thanks

7 REPLIES 7

Former Member
0 Kudos
232

Hi,

Use this function module

HR_INFOTYPE_OPERATION

pass all the fields of a structure record

pass 'MOD' to operation parameter

Regards

Krishna

Edited by: Krishna Gowrneni on Jun 4, 2009 6:58 PM

0 Kudos
232

Hi I am using HR_INFOTYPE_OPERATION FM, but I only need to update zuord field which is Assignment number. so what values should I pass in Record.

my code is this



TYPES : BEGIN OF datap,
           pernr(8) type n ,
           begda like sy-datum,
           endda like sy-datum,
           lgart(4) type c,
           zuord(20) type c,

        END OF datap.
DATA: T_item1 TYPE STANDARD TABLE OF datap.
DATA: H_item1 TYPE datap.


loop at T_item into h_item.

  MOVE h_item-pernr to h_item1-pernr.
  concatenate h_item-begda+6(4) h_item-begda+3(2) h_item-begda+0(2) into h_item1-begda.
  concatenate h_item-endda+6(4) h_item-endda+3(2) h_item-endda+0(2) into h_item1-endda.
  move h_item-lgart to h_item1-lgart.
  move h_item-zuord to h_item1-zuord.


  CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
      INFTY                  = '0014'
      NUMBER                 = h_item-pernr
      SUBTYPE                = h_item-lgart
*     OBJECTID               =
*     LOCKINDICATOR          =
      VALIDITYEND            = h_item1-endda
      VALIDITYBEGIN          = h_item1-begda
*     RECORDNUMBER           =
      RECORD                 = h_item1
      OPERATION              = 'mod'
*     TCLAS                  = 'A'
*     DIALOG_MODE            = '0'
*     NOCOMMIT               =
*     VIEW_IDENTIFIER        =
*     SECONDARY_RECORD       =
*   IMPORTING
*     RETURN                 =
*     KEY                    =
            .

  endloop.

It gives error when I execute the program, If some body can clarify how pass value in Record.

thanks

0 Kudos
232

loop at T_item into h_item.

1. get the record which u have to modify into wa... use a select stmt to fetch the required record

2. change field zuord of this wa with ur data.

3. pass this wa to FM.

.......

endloop.

Edited by: Veeranji Reddy on Jun 8, 2009 4:49 PM

0 Kudos
232

I have pass the follwoing values to the FM . but it doesnt give any error message and doesnt update the value even. what could be the cause.



 p0014-zuord = h_item1-zuord.


  CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
      INFTY                  = p0014-infty
      NUMBER                 = p0014-pernr
      SUBTYPE                = p0014-subty
      OBJECTID               = p0014-objps
      LOCKINDICATOR          = p0014-sprps
      VALIDITYEND            = p0014-endda
      VALIDITYBEGIN          = p0014-begda
      RECORDNUMBER           = p0014-seqnr
      RECORD                 = p0014
      OPERATION              = 'mod'
     TCLAS                  = 'A'
     DIALOG_MODE            = '0'
*     NOCOMMIT               =
*     VIEW_IDENTIFIER        =
*     SECONDARY_RECORD       =
*   IMPORTING
*     RETURN                 =
*     KEY                    =
            .

Former Member
0 Kudos
232

Hi,

'HR_INFOTYPE_OPERATION' using operation

Thnx.

Former Member
0 Kudos
232

Hi ,

first u got to read the infotype for corresponding pernr 'Personnel Number' whose data need to be updated.

1. Read infotype using fm HR_READ_INFOTYPE.

2. thn lock the employee so that the records stored

for the person cannot be accessed using fm BAPI_EMPLOYEE_ENQUEUE.

3. perform changes i.e. update records using fm HR_INFOTYPE_OPERATION.

4. read the data & display if reqd.

5. Unlock pernr -- BAPI_EMPLOYEE_DEQUEUE.


infotypes: p0014.     // creates an internal table p0014.


*pass values into the fields u want to modify..
p0014- zuord = '  <value> '.

 CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
      INFTY                  = '0014'
      NUMBER                 = p_pernr     // maintain p_pernr as parameter
      SUBTYPE                = p0014-subty
*     OBJECTID               =
*     LOCKINDICATOR          =
      VALIDITYEND            = p0014-endda
      VALIDITYBEGIN          = p0014-begda
*     RECORDNUMBER           =
      RECORD                 = p0014
      OPERATION              = 'mod'
*     TCLAS                  = 'A'
*     DIALOG_MODE            = '0'
*     NOCOMMIT               =
*     VIEW_IDENTIFIER        =
*     SECONDARY_RECORD       =
*   IMPORTING
*     RETURN                 =
*     KEY                    =
            .
 
  endloop.

following link would be helpful..

https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/modifying%2ban%2binfotype%2bby%2breading...

anupam_srivastava2
Participant
0 Kudos
232

thanks