05-06-2010 4:37 PM
Hi,
I am getting this error, "Old and new exceptions cannot be used at the same time" for the following code, does anyone have any info on this
method add_item_to_cart.
*check if item exists
try.
zcl_ec_cart=>read_cart_item( i_cust_id = i_cartitem_att-cust_id
i_produ = i_cartitem_att-produ ).
RAISE EXCEPTION TYPE zcx_ec_cart
EXPORTING
textid = zcx_ec_cart=>already_exists
produ = i_cartitem_att-PRODU.
EXIT.
catch zcx_ec_cart .
endtry.
data l_cart type ref to zcl_ec_cart.
l_cart = zcl_ec_cart=>create_cart_item( i_cust_id = i_cartitem_att-cust_id
i_produ = i_cartitem_att-produ ).
move-corresponding i_cartitem_att to l_cart->cart_att.
l_cart->update_cart_item( ).
commit work.
endmethod.
the error points to the RAISE EXCEPTION statement
Edited by: Bijo Samuel on May 6, 2010 5:38 PM
05-06-2010 4:45 PM
Hi,
In the method definition (tab exceptions) check whether the "class exceptions" flag is set.
Regards,
Gerd Rother
05-06-2010 4:45 PM
Hi,
In the method definition (tab exceptions) check whether the "class exceptions" flag is set.
Regards,
Gerd Rother
05-06-2010 4:47 PM
Does your method have any non-class based exceptions defined ? SAP says:
The statement RAISE EXCEPTION must not be used in a method or a function module in whose interface non class-based exceptions are declared.
Source: [http://help.sap.com/abapdocu_70/en/ABAPRAISE_EXCEPTION_CLASS.htm]
05-06-2010 4:53 PM
thanks gerd, problem solved. thanks
@suhas, no, see the code above. thanks