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 INFO TYPE P0014

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

even no data is there, you are trying to modify the record. that is wrong.

you can find the answer from the error message. Debug , find the problem and fix the issue on your own.

8 REPLIES 8

former_member188685
Active Contributor
0 Kudos

even no data is there, you are trying to modify the record. that is wrong.

you can find the answer from the error message. Debug , find the problem and fix the issue on your own.

0 Kudos

Hi Vijay,

There are 3 records for P0014 for which i need to change to enddate .

Regards,

Kumar

0 Kudos

make sure you are passing correct BEGDA and ENDDA to Validity Begin and Validity End (Also to P0014 Record).

if you pass incorrect dates then you will not be able to modify those records.

0 Kudos

Hi Vijay,

Wht would be the Begin Date and Endate would be in this , i think am passing the right values but could get the record modified.

P0014

PERNR ENDDA BEGDA

My Record : 0123456 31.12.9999 01.05.2005

Want to change as Below

PERNR ENDDA BEGDA

My Record : 0123456 27.04.2009 01.05.2005

Regards,

Kumar

0 Kudos

are you able to simulate the same using PA30..?

it all depends on Time Constraint

According to your reply, you are changing the dates. Try to simulate the same in PA30. if it is allowed then ok.

And one more thing Try to Send the importing parameters validity end and Validity begin with the exsisitng values(Old values)./

0 Kudos

Hi Vijay,

I changed the dates using PA30 and its allowing me to change and passing the old dates to FM as below and its comming up with the same error ...

LOOP AT P0014.

w_begin = P0014-BEGDA.

w_end = P0014-ENDDA.

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 = w_begin

VALIDITYEND = w_end

RECORD = P0014

OPERATION = <OPERATION>

DIALOG_MODE = '0'

NOCOMMIT = 'X'

IMPORTING

RETURN = l_bapireturn.

IF NOT l_bapireturn IS INITIAL .

FLAG = 'X'.

EXIT.

ENDIF.

Regards,

Kumar

0 Kudos

you need to pass subtype also.

are you sure you are getting the error message..

IF  l_bapireturn-type = 'E' . "only if error
FLAG = 'X'. 
EXIT.
ENDIF.

0 Kudos

Hi Kumar,

Try to pass all the parameters

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = w_infotype "0014"

number = w_pernr "722218

subtype = w_subty "same as from pa0014

objectid = w_objps " same as pa0014

lockindicator = w_sprps "same as pa0014

validityend = w_endda

validitybegin = w_begda

recordnumber = w_seqnr "same as pa0014

record = wa_p0041

operation = w_operation " MOD

tclas = 'A'

dialog_mode = '0'

nocommit = ' '

IMPORTING

return = wa_return.

IF wa_return-number EQ '000'.

w_return_fg = 'X'.

ENDIF.

ALSO check the lock status of that employee, May be it is locked by you in transaction PA30

Regards

Krishna

Edited by: Krishna Gowrneni on Apr 27, 2009 8:34 PM