Skip to Content
0
Former Member
Nov 29, 2011 at 07:55 AM

Exception triggering Commit work.

442 Views

Hi ,

I need to update a seris of tables and they must be transactional, i.e. all the data must be updated or not.

I have the following code.


*Fetch and Update Reference Profile Data
  me->process_rp_data( ).

*Fetch and Update Request Data
  me->process_req_data( ).

*Fetch and Update Collateral Data
  me->process_coll_data( ).

*Fetch and Update Project Data
  me->process_project_data( ).

  IF i_update_flag IS INITIAL.
    ROLLBACK WORK.
  ELSE.
    COMMIT WORK.
  ENDIF.

in all the above four methods there are update statements like below


  TRY .
      UPDATE (i_table_name) SET bp_number = sur_bp WHERE (lt_dyn_cond).
      IF sy-subrc NE 0.

        me->raise_exception( EXPORTING i_text_id    = zcx_rms_dedupe_process_excptns=>error_in_update
                                       i_bp_num     = vic_bp
                                       i_guid       = i_guid
                                       i_table_name = i_table_name
                                       i_process    = i_process ).
      ENDIF.

    CATCH cx_sy_dynamic_osql_error.
      me->raise_exception( EXPORTING i_text_id    = zcx_rms_dedupe_process_excptns=>error_in_update
                                     i_bp_num     = vic_bp
                                     i_guid       = i_guid
                                     i_table_name = i_table_name
                                     i_process    = i_process ).
  ENDTRY.

If in the third method, if the exception cx_sy_dynamic_osql_error is raised all the data that is updated in the first two methods are commited. Can any one help how to overcome this situtation. I do not want the data to be committed

Regards