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: 

Problem with HR_INFOTYPE_OPERATION via BADI

Former Member
0 Kudos

Hi.

I'm trying to update endda date of infotype 0041, via BADI.

I need to update this date when i change endda date on infotype 0016, so when i do this and i press 'save' button, my badi is fired and i call HR_INFOTYPE_OPERATION.

This method seems to work fine, because if go to infotype 0041 screen, this date is there, but when i refresh the transaction or go to pa0041 table the value is not changed.

Seems like the new value is in some kind of intermediate memory, but the values are not submitted to the database table.

Any ideas??

6 REPLIES 6

Former Member
0 Kudos

hi

good

go through this code and use the function module accordingly.

REPORT ZZKNB_BAPI_INFOTYPE_CALL .

  • Use 'BAPI_EMPLOYEE_ENQUEUE' to lock the employee before updating

DATA: l_bapireturn LIKE bapireturn1.

DATA: bapipakey_tab LIKE bapipakey OCCURS 0 WITH HEADER LINE.

data: l_p0169 like p0169.

parameters: p_pernr like p0169-pernr default '07000003'.

start-of-selection.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = p_pernr

IMPORTING

return = l_bapireturn.

IF l_bapireturn-id NE space.

WRITE: / l_p0169-pernr, 'Enqueue failed'.

exit.

ENDIF.

*-- Suported operations:

*-- change (operation = 'MOD')

*-- Create (operation = 'INS')

*-- DELETE (operation = 'DEL')

*-- CREATESUCCESSOR (operation = 'COP')

.

l_p0169-barea = '7A'.

l_p0169-pltyp = 'RRSP'.

l_p0169-bplan = 'RRSP'.

l_p0169-elidt = '20000101'.

l_p0169-enrty = 'M'.

l_p0169-perio = '4'.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0169'

subty = 'RRSP'

number = p_pernr

record = l_p0169

validitybegin = '20021001'

validityend = '99991231'

operation = 'INS'

  • dialog_mode = '0' "Use default

  • nocommit = '1' "Use default

IMPORTING

return = l_bapireturn

key = bapipakey_tab.

IF l_bapireturn-id NE space.

WRITE: / p_pernr,

20 'Create was unsuccessful',

l_bapireturn-id,

l_bapireturn-message+0(40).

ELSE.

WRITE: / p_pernr,

20 'Create was successful',

l_bapireturn-id,

l_bapireturn-message+0(40).

ENDIF.

  • Use 'BAPI_EMPLOYEE_DEQUEUE' to un-lock the employee before updating

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = l_p0169-pernr

IMPORTING

return = l_bapireturn.

thanks

mrutyun^

Former Member
0 Kudos

I already know how to use the function module, but this problem seems to be a little bit more complicated.

The FM works fine, return value is initial, but the values are not submitted to the table.

Any ideas?

Former Member
0 Kudos

Hi

Guess you can have a COMMIT WORK to commit the changes to the database.

<FM Call>

If sy-subrc EQ 0.

Commit work.

Endif.

Regards

Raj

0 Kudos

I've already tried commit work but sadly didn't work.

0 Kudos

Any ideas?

Former Member
0 Kudos

Hi,

SUBMIT this report inside your BAdI, instead of a direct call to the function module.. this will initiate a separate work process for infotype 2001 & there will not be any more lock conflicts..

<b>Reward points</b>

Regards