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 Infotype 0006

vijy_mukunthan
Active Contributor
0 Kudos
811

hi friends

I am working on ISR workflow for address change. After the approval the infotpey 0006 should update. Is there any function module or class which updates the infotype 0006 when pernr is enterned.

Regards

vijay

1 ACCEPTED SOLUTION

Former Member
0 Kudos
189

Hello,

You should always update Info type using HR_INFOTYPE_OPERATION because it updates the information of the employee for the HR database not just the table. Below Code will be of help to you.

LOOP AT t_insert INTO w_insert.

w_pernr = w_insert-ownnum.

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

pernr = w_pernr

infty = c_infty "'0105'

TABLES

infty_tab = t_0105

EXCEPTIONS

infty_not_found = 1

OTHERS = 2.

READ TABLE t_0105 INTO w_0105 WITH KEY pernr = w_insert-ownnum"#EC *

subty = c_subu.

IF sy-subrc = 0.

MOVE w_0105 TO w_p0105.

w_p0105-usrid = w_insert-lanid.

CLEAR w_0105.

ELSE.

w_p0105-pernr = w_pernr.

w_p0105-usrid = w_insert-lanid.

w_p0105-begda = sy-datum.

w_fnr = 'X'.

ENDIF.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = w_pernr.

w_p0105-pernr = w_pernr.

IF w_fnr = 'X'.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = c_infty "'0105'

number = w_p0105-pernr

subtype = c_subu "'0001'

validityend = w_p0105-endda

validitybegin = w_p0105-begda

record = w_p0105

operation = c_oprn "'INS'

tclas = 'A'

dialog_mode = '0'

IMPORTING

return = w_return.

ELSE.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = c_infty "'0105'

number = w_p0105-pernr

subtype = c_subu "'0001'

validityend = w_p0105-endda

validitybegin = w_p0105-begda

record = w_p0105

operation = 'MOD' "'MOD'

tclas = 'A'

dialog_mode = '0'

IMPORTING

return = w_return.

ENDIF.

CLEAR w_fnr.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = w_pernr.

Endloop.

Hope it helps.

Thanks,

Jayant

Search SDN before posting.

7 REPLIES 7

Former Member
0 Kudos
189

You should just write:

update pa0006
set ....
where ....

0 Kudos
189

>

> You should just write:

>

>

update pa0006
> set ....
> where ....

No, you should NOT do a direct update on the table like this. Have a look at function module HR_INFOTYPE_OPERATION.

marcelo_ramos
Active Contributor
0 Kudos
189

Hi Vijay,

This thread will be moved from to .

Please see the [Forum Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] for more informations.

Also read this thread .

Greetings,

Marcelo Ramos

Former Member
0 Kudos
190

Hello,

You should always update Info type using HR_INFOTYPE_OPERATION because it updates the information of the employee for the HR database not just the table. Below Code will be of help to you.

LOOP AT t_insert INTO w_insert.

w_pernr = w_insert-ownnum.

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

pernr = w_pernr

infty = c_infty "'0105'

TABLES

infty_tab = t_0105

EXCEPTIONS

infty_not_found = 1

OTHERS = 2.

READ TABLE t_0105 INTO w_0105 WITH KEY pernr = w_insert-ownnum"#EC *

subty = c_subu.

IF sy-subrc = 0.

MOVE w_0105 TO w_p0105.

w_p0105-usrid = w_insert-lanid.

CLEAR w_0105.

ELSE.

w_p0105-pernr = w_pernr.

w_p0105-usrid = w_insert-lanid.

w_p0105-begda = sy-datum.

w_fnr = 'X'.

ENDIF.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = w_pernr.

w_p0105-pernr = w_pernr.

IF w_fnr = 'X'.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = c_infty "'0105'

number = w_p0105-pernr

subtype = c_subu "'0001'

validityend = w_p0105-endda

validitybegin = w_p0105-begda

record = w_p0105

operation = c_oprn "'INS'

tclas = 'A'

dialog_mode = '0'

IMPORTING

return = w_return.

ELSE.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = c_infty "'0105'

number = w_p0105-pernr

subtype = c_subu "'0001'

validityend = w_p0105-endda

validitybegin = w_p0105-begda

record = w_p0105

operation = 'MOD' "'MOD'

tclas = 'A'

dialog_mode = '0'

IMPORTING

return = w_return.

ENDIF.

CLEAR w_fnr.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = w_pernr.

Endloop.

Hope it helps.

Thanks,

Jayant

Search SDN before posting.

0 Kudos
189

hi jayant

Thank you. i thnk your function module will be helpful for my scenario. I have a query. What should be the value entered in recordnumber and record. In which table these value would be availabe so that i can pick the data and check for the available data.

Rite now i checked with endda and begda l import parameters its gives the result has no data has changed but for that begda and endda there is updated data is available. So what should i entered in the recordnumber and record import paramater.

Regards

vijay

0 Kudos
189

hi

I am using the isr from portal i found some class while debugging .CL_HR_MASTERDATA_DB there is a method called DB_OPER_NEW_DATA-->NNNN. Is this be usful to update the infotype 0006. The function module HR_INFOTYPE_OPERATION will do that. But i am just exploring is there any other different in class just i need to try.

Regards

vijay

Former Member
0 Kudos
189

Use FM HR_MAINTAIN_MASTERDATA to update ..