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: 

Updating the Infotypes

Former Member
0 Kudos

Hi Gurus,

I have a requirement to update the infotype p0014 through report. Am getting all the modified values into the p0014 but it is not updated into the database. Am using the following code for this.

INFOTYPES : 0001,

0007,

0008,

0014 NAME OLD,

0014 NAME NEW.

NEW-AEDTM = SY-DATUM.

NEW-BETRG = WA_BASIC-HEATALLOWANCE.

NEW-UNAME = SY-UNAME.

RP-UPDATE OLD NEW.

Am modifying only these 3 fields in the infotype. RP-UPDATE is not updating the database. Is there any another macro or FM is there to update the database through infotype.

Regards

SC

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

I am sending a sample program , which I have down on infotype 0105 (communication). I hope that this program will help u out............

REPORT ZSAPHR_SAMP.

tables: pa0105.

infotypes: 0105.

DATA : I_RETURN TYPE BAPIRETURN1,

I_KEY TYPE BAPIPAKEY,

PERNR TYPE P0001-PERNR,

I_P0105 TYPE TABLE OF P0105 WITH HEADER LINE,

ENDDA TYPE P0105-ENDDA,

BEGDA TYPE P0105-BEGDA.

MOVE '00000010' TO PERNR.

BEGDA = SY-DATUM + 1.

ENDDA = SY-DATUM + 1.

i_p0105-pernr = PERNR.

i_p0105-infty = '0105'.

i_p0105-subty = '0002'.

i_p0105-endda = ENDDA.

i_p0105-begda = BEGDA.

I_P0105-USRTY = '0002'.

I_P0105-USRID = 'VOICE@YAHOO.COM'.

APPEND i_p0105.

CALL FUNCTION 'DEQUEUE_ALL' .

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

NUMBER = PERNR.

IF SY-SUBRC = 0.

WRITE 'Employee Locked Successfully'.

ENDIF.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

INFTY = '0105'

NUMBER = PERNR

SUBTYPE = '0002'

VALIDITYEND = BEGDA

VALIDITYBEGIN = ENDDA

RECORD = i_p0105

OPERATION = 'INS'

TCLAS = 'A'

DIALOG_MODE = '0'

NOCOMMIT = 'X'

IMPORTING

RETURN = I_RETURN

KEY = I_KEY.

IF SY-SUBRC = 0.

WRITE : 'FM returns sy-subrc 0'.

ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

give some points if this message helps U .

7 REPLIES 7

amit_khare
Active Contributor
0 Kudos

Use HR_INFOTYPE_OPERATION instead.

Regards,

Amit

Reward all helpful replies.

0 Kudos

Hi Gurus,

Thanks for the quick answers. I used the FM HR_INFOTYPE_OPERATION for updating the database through infotype. It giving the error message 'No Data Stored for 0014 in the selected period'. Can anyone give me the solution to resolve this?

Points will be awarded

Ravi

0 Kudos

Hi,

Check the operation you are passing to the FM.

If you are creating a new record, use 'INS', or if you wanna modify an existing one, use 'MOD'.

And if you are trying to modify an existing record, the begda & endda parameters should match the existing ones.

Former Member
0 Kudos

Hi,

You can update any Infotype using the FM HR_INFOTYPE_OPERATION.

Former Member
0 Kudos

Hello,

I am sending a sample program , which I have down on infotype 0105 (communication). I hope that this program will help u out............

REPORT ZSAPHR_SAMP.

tables: pa0105.

infotypes: 0105.

DATA : I_RETURN TYPE BAPIRETURN1,

I_KEY TYPE BAPIPAKEY,

PERNR TYPE P0001-PERNR,

I_P0105 TYPE TABLE OF P0105 WITH HEADER LINE,

ENDDA TYPE P0105-ENDDA,

BEGDA TYPE P0105-BEGDA.

MOVE '00000010' TO PERNR.

BEGDA = SY-DATUM + 1.

ENDDA = SY-DATUM + 1.

i_p0105-pernr = PERNR.

i_p0105-infty = '0105'.

i_p0105-subty = '0002'.

i_p0105-endda = ENDDA.

i_p0105-begda = BEGDA.

I_P0105-USRTY = '0002'.

I_P0105-USRID = 'VOICE@YAHOO.COM'.

APPEND i_p0105.

CALL FUNCTION 'DEQUEUE_ALL' .

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

NUMBER = PERNR.

IF SY-SUBRC = 0.

WRITE 'Employee Locked Successfully'.

ENDIF.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

INFTY = '0105'

NUMBER = PERNR

SUBTYPE = '0002'

VALIDITYEND = BEGDA

VALIDITYBEGIN = ENDDA

RECORD = i_p0105

OPERATION = 'INS'

TCLAS = 'A'

DIALOG_MODE = '0'

NOCOMMIT = 'X'

IMPORTING

RETURN = I_RETURN

KEY = I_KEY.

IF SY-SUBRC = 0.

WRITE : 'FM returns sy-subrc 0'.

ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

give some points if this message helps U .

Former Member
0 Kudos

Use Fm -

HR_INFOTYPE_OPERATION

0 Kudos

hi,

I have tried same function module same process for infotype 0014...but it's not working...

Thanks,

Santosh.