Skip to content

whothefluff/abap-bapi-return-mapping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

abap-bapiret-mapping

Convert BAPI return errors of common types like BAPIRET2, BAPIRET1, BAPIRETURN, BAPIRETURN1, BAPIRETC, etc. into class-based exceptions

Use

Reuse class ZCL_BAPIRET_TO_BAPI_E_FUNCTION (which returns a child of ZCX_NO_CHECK with a getter for all messages of type error):

data(bapi_error_msg) = new zcl_free_message( `Creation of x failed` ).

call function 'BAPI_CREATE_*'
  tables
    return = return.

data(e) = new zcl_bapiret_to_bapi_e_function( bapi_error_msg )->apply( return ).

if e is bound.

  raise exception e.

endif.
data(to_bapi_e) = new zcl_bapiret_to_bapi_e_function( ).

call function 'BAPI_CREATE_*'
  tables
    return = return.

data(e) = to_bapi_e->apply( return ).

if e is bound.

  data(errors) = e->errors( ).

endif.

Or create your own implementation of ZIF_BAPI_TO_EXC_FUNCTION.

dependencies:

About

Map bapiret structures with errors to class-based exceptions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages