Skip to Content
0
Former Member
Apr 27, 2009 at 01:40 PM

UPDATE INFO TYPE P0014

220 Views

Hi,

Am trying to update this infotype P0014 and its giving me an error saying that 'No data stored for 0014 in the selected period '. Any suggestions pls. I am trying to change the ENDDA of P0014.

Code :

INFOTYPES : 0014.

  • 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_p0001 like p0001.

DATA: FLAG TYPE C.

parameters: p_pernr like p0001-pernr.

start-of-selection.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = p_pernr

IMPORTING

return = l_bapireturn.

IF l_bapireturn-id NE space.

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

exit.

ENDIF.

***-INFOTYPE '0014'

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

PERNR = P_PERNR

INFTY = '0014'

BEGDA = '20040401'

ENDDA = '99991231'

TABLES

INFTY_TAB = P0014

EXCEPTIONS

INFTY_NOT_FOUND = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DELETE P0014 WHERE ENDDA LT SY-DATUM.

CLEAR P0014.

LOOP AT P0014.

P0014-ENDDA = SY-DATUM.

ASSIGN P0014 TO <INFTY_S>.

ASSIGN 'MOD' TO <OPERATION>.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

INFTY = '0014'

NUMBER = P_PERNR

VALIDITYBEGIN = SY-DATUM

RECORD = P0014

OPERATION = <OPERATION>

DIALOG_MODE = '0'

NOCOMMIT = 'X'

IMPORTING

RETURN = l_bapireturn.

IF NOT l_bapireturn IS INITIAL .

FLAG = 'X'.

EXIT.

ENDIF.

ENDLOOP.

*---CHECK THE FLAG IF IT RETURNS ANY MESSAGES

IF NOT FLAG IS INITIAL.

ROLLBACK WORK.

ELSE.

COMMIT WORK.

ENDIF.

CLEAR FLAG.

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_p0001-pernr

IMPORTING

return = l_bapireturn.

Error : No data stored for 0014 in the selected period

Thanks,

Kumar.

Don't use caps in your subject line and Post your question with proper subject line

Edited by: Vijay Babu Dudla on Apr 27, 2009 9:41 AM