cancel
Showing results for 
Search instead for 
Did you mean: 

problem while inserting a record to infotype 416

Former Member
0 Kudos
650

Iam facing a problem while inserting a record to the infotype 416 for a personnel no using the FM 'HR_INFOTYPE_OPERATION'.I have created a FM to insert a record to the infotype 416.In that FM iam using the FM 'HR_INFOTYPE_OPERATION' to create a record for infotype 416.while executing my FM the FM 'HR_INFOTYPE_OPERATION' is returning the return value 0.But when i check in PA30 for the infotype 416,there is no record created for that personnel no.Also in the table PA0416 the record is not get created.SO what might be the problem.can anyone please provide me help on this.

I have attached the code of my FM for ur reference.

FUNCTION Y_ESS_FL_ENCASH.

DATA: G_COMPENSATION_AMOUNT LIKE PA0416-AMONT,

G_RETURN TYPE BAPIRETURN1.

DATA T_PA0416 LIKE P0416 OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

TCLAS = 'A'

PERNR = '00000014'

INFTY = '0416'

  • BEGDA = sy-datum

  • ENDDA = sy-datum

BYPASS_BUFFER = 'X'

  • LEGACY_MODE = ' '

  • IMPORTING

  • SUBRC =

TABLES

INFTY_TAB = T_PA0416

  • EXCEPTIONS

  • INFTY_NOT_FOUND = 1

  • OTHERS = 2

.

LOOP AT T_PA0416

WHERE SUBTY = '1002'.

ENDLOOP.

IF SY-SUBRC <> 0.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

NUMBER = '00000014'

IMPORTING

RETURN = G_RETURN.

IF SY-SUBRC <> 0.

MESSAGE I016(RP) WITH ' RECORD IS ALREADY LOCKED'.

ENDIF.

T_PA0416-PERNR = '00000014'.

T_PA0416-SUBTY = '1002'.

T_PA0416-INFTY = '0416'.

T_PA0416-OBJPS = ''.

T_PA0416-SPRPS = ''.

T_PA0416-SEQNR = ''.

T_PA0416-AEDTM = SY-DATUM.

T_PA0416-UNAME = SY-UNAME.

T_PA0416-ENDDA = SY-DATUM.

T_PA0416-BEGDA = SY-DATUM.

T_PA0416-NUMBR = '10'.

T_PA0416-WGTYP = '1530'.

T_PA0416-AMONT = '15000'.

T_PA0416-WAERS = 'INR'.

T_PA0416-QUONR = '1'.

APPEND T_PA0416.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

INFTY = '0416'

NUMBER = '00000014'

SUBTYPE = '1002'

  • OBJECTID =

  • LOCKINDICATOR =

VALIDITYEND = '31129999'

VALIDITYBEGIN = SY-DATUM

  • RECORDNUMBER = ''

RECORD = T_PA0416

OPERATION = 'INS'

TCLAS = 'A'

  • DIALOG_MODE = '0'

  • NOCOMMIT = 'X'

  • VIEW_IDENTIFIER =

  • SECONDARY_RECORD =

IMPORTING

RETURN = G_RETURN.

  • KEY =

IF G_RETURN+0(1) EQ 'E'.

MESSAGE I086(ZHR) WITH 'Record is not inserted in IT416'.

ELSE.

COMMIT WORK.

ENDIF.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

NUMBER = '00000014'

IMPORTING

RETURN = G_RETURN.

ENDIF.

ENDFUNCTION.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Murthy,

I don't see (at least not yet) anything particularly wrong with the code that you are using.

But just to be on the safe side, are you sure that the ENQUEUE is successful? Because, after 'BAPI_EMPLOYEE_ENQUEUE', you are checking for sy-subrc. you should actually be checking for G_RETURN. Isn't that so ?

Regards,

anand mandalika.

ssimsekler
Active Contributor
0 Kudos

Hi Murthy

With a first glance, I think you have given a wrong parameter value to "validityend". It should be '99991231' not '31129999' .

If your problem still persists, try inserting the data online from PA30. If your input causes no errors, then please state what the return parameter contains.

Regards

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>