Application Development and Automation 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: 
Read only

hr_infotype_operation error

Former Member
0 Likes
1,348

i am testing hr_infotype_operation FM

for some reason it dumps with the message:

*******************************************************************************************************

COMMIT_IN_PERFORM_ON_COMMIT

Error analysis

You cannot call a COMMIT WORK in a FORM not executed by the variants

PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK until the commit of the

calling program.

*******************************************************************************************************

my code:

REPORT z_test_hrinfotyop_el.

*Data

DATA : p0008 LIKE p0008.

DATA : return LIKE bapireturn1.

DATA : key LIKE bapipakey.

DATA : returne LIKE bapireturn1 .

*Values

p0008-pernr = '00004272'.

p0008-begda = '20080101'.

p0008-endda = '99991231'.

p0008-trfar = '01'.

p0008-trfgb = '04'.

p0008-trfgr = 'GG2'.

p0008-ancur = 'MYR'.

p0008-lga01 = '1000'.

p0008-bet01 = '5000'.

PERFORM save_record.

&----


*& Form save_record

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM save_record .

*Enqueue

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = p0008-pernr

IMPORTING

return = returne.

*Update

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0008'

number = p0008-pernr

  • subtype = p0008-subty

  • objectid = p0008-objps

  • lockindicator = p0008-sprps

validityend = p0008-endda

validitybegin = p0008-begda

  • recordnumber = p0008-seqnr

record = p0008

operation = 'INS'

  • tclas = 'A'

  • dialog_mode = '0'

nocommit = 'X'

IMPORTING

return = return

key = key.

IF return IS NOT INITIAL.

WRITE 😕 'Error Occurred'.

ELSE.

COMMIT WORK.

ENDIF.

*Dequeue

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = p0008-pernr.

ENDFORM. " save_record

i am testing hr_infotype_operation FM

for some reason it dumps with the message:

*******************************************************************************************************

COMMIT_IN_PERFORM_ON_COMMIT

Error analysis

You cannot call a COMMIT WORK in a FORM not executed by the variants

PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK until the commit of the

calling program.

*******************************************************************************************************

my code:

REPORT z_test_hrinfotyop_el.

*Data

DATA : p0008 LIKE p0008.

DATA : return LIKE bapireturn1.

DATA : key LIKE bapipakey.

DATA : returne LIKE bapireturn1 .

*Values

p0008-pernr = '00004272'.

p0008-begda = '20080101'.

p0008-endda = '99991231'.

p0008-trfar = '01'.

p0008-trfgb = '04'.

p0008-trfgr = 'GG2'.

p0008-ancur = 'MYR'.

p0008-lga01 = '1000'.

p0008-bet01 = '5000'.

PERFORM save_record.

&----


*& Form save_record

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM save_record .

*Enqueue

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = p0008-pernr

IMPORTING

return = returne.

*Update

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0008'

number = p0008-pernr

  • subtype = p0008-subty

  • objectid = p0008-objps

  • lockindicator = p0008-sprps

validityend = p0008-endda

validitybegin = p0008-begda

  • recordnumber = p0008-seqnr

record = p0008

operation = 'INS'

  • tclas = 'A'

  • dialog_mode = '0'

nocommit = 'X'

IMPORTING

return = return

key = key.

IF return IS NOT INITIAL.

WRITE 😕 'Error Occurred'.

ELSE.

COMMIT WORK.

ENDIF.

*Dequeue

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = p0008-pernr.

ENDFORM. " save_record

9 REPLIES 9
Read only

Former Member
0 Likes
1,208

remove the COMMIT WORK statement after

CALLING FUNCTION 'HR_INFOTYPE_OPERATION' ...

.

.

.

.

.

IF return IS NOT INITIAL.

WRITE 😕 'Error Occurred'.

ELSE.

COMMIT WORK. <----


ENDIF.

Read only

0 Likes
1,208

hi Srinivas Gurram Reddy,

nothing happens when i do your suggestion.

what else can i do?

Read only

Former Member
0 Likes
1,208

Hi

Also pass the field nocommit = space

and try again

Regards

Shiva

Read only

0 Likes
1,208

hi Shivakumar Hosaganiger,

it dumps when i do that.

Read only

0 Likes
1,208

Hi Laure,

So, did you find any solution? We encounter the same issue now.

Read only

0 Likes
1,208

Hi Laure,

have u got the solution for this problem?

i think in the code-function module we need to pass all mandatory values. Like Dialog Mode etc...

and also NO_COMMIT = space is good.

Read only

0 Likes
1,208

Hi Laure,

Don't pass the commit flag as 'X'.

Also check the return structure after the function call in debug mode. It should have more details.

Regards,

Ramnivas

Read only

GirieshM
Active Contributor
0 Likes
1,208

Hi,

Remove the else part completely and try to give the commit work statement after the perform statement.

If return is not initial.

write:/ Error Occured.

Endform.

*perform XXXXXXX .

commit work.*

Read only

Former Member
0 Likes
1,208

Why do you want to use COMMIT WORK explicitly.

Just pass the value space to NOCOMMIT parameter of the function midule.

Regards,

Rupesh