Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Old and new exceptions cannot be used at the same time

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

Former Member
replied

Hi,

In the method definition (tab exceptions) check whether the "class exceptions" flag is set.

Regards,

Gerd Rother

2 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question