03-14-2008 12:24 PM
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
03-14-2008 12:31 PM
remove the COMMIT WORK statement after
CALLING FUNCTION 'HR_INFOTYPE_OPERATION' ...
.
.
.
.
.
IF return IS NOT INITIAL.
WRITE 😕 'Error Occurred'.
ELSE.
COMMIT WORK. <----
ENDIF.
03-14-2008 12:37 PM
hi Srinivas Gurram Reddy,
nothing happens when i do your suggestion.
what else can i do?
03-14-2008 12:38 PM
03-14-2008 12:43 PM
04-16-2011 10:49 PM
Hi Laure,
So, did you find any solution? We encounter the same issue now.
04-17-2011 5:48 AM
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.
04-18-2011 12:58 PM
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
04-18-2011 8:02 AM
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.*
04-18-2011 10:42 AM
Why do you want to use COMMIT WORK explicitly.
Just pass the value space to NOCOMMIT parameter of the function midule.
Regards,
Rupesh