2005 Dec 09 5:48 PM
Hi,
I want to delete the classes of a material. I am using this function as:
CALL FUNCTION 'BAPI_OBJCL_DELETE'
EXPORTING
OBJECTKEY = "any MATNR
OBJECTTABLE = 'MARA'
CLASSNUM = "CLASS NUMBER
CLASSTYPE = "KLART
TABLES
RETURN = FUNC_RETURN.
READ TABLE FUNC_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC = 0.
ROLLBACK WORK.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING WAIT = 'X'.
ENDIF.
and,
DATA FUNC_RETURN LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
When I debuuged code I am seeing that 'BAPI_TRANSACTION_COMMIT' is reached. But the problem is sometimes class is not deleted. But sometimes it is deleted. It is so interesting. I am commitng the work. But deleting maybe unsuccessful. Why this is so?
Thanks for your helps.
try to pass changenumber also and check it...
it is doing similar to previous or not...
2005 Dec 09 5:58 PM
<b>p_aennr LIKE cuco-aennr.</b>
v_objek = p_objek.
v_class = p_class.
v_classtype = p_klart.
v_aennr = p_aennr.
CALL FUNCTION 'BAPI_OBJCL_DELETE'
EXPORTING
objectkey = v_objek
objecttable = c_objtable " 'MARA'
classnum = v_class
classtype = v_classtype
<b> changenumber = v_aennr</b>
keydate = c_keydate
TABLES
return = it_return.try to pass changenumber also...
2005 Dec 09 5:59 PM
try to pass changenumber also and check it...
it is doing similar to previous or not...
2005 Dec 09 6:01 PM
Hi Huseyin,
If the table FUNC_RETURN itself is empty?
In that case, the sy-subrc will not be equal to zero.
Check if that table is initial or not.
Regards,
ravi
2005 Dec 09 6:08 PM
IF NOT FUNC_RETURN[] IS INITIAL.
READ TABLE FUNC_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC = 0.
ROLLBACK WORK.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING WAIT = 'X'.
ENDIF.
ENDIF.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |