alex_khryst

OData service requests processing example

Aug 13th, 2021 (edited)
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 23.40 KB | None | 0 0
  1. class zkhr_gw_odata_dpc_ext definition
  2.   public
  3.   inheriting from zkhr_gw_odata_dpc
  4.   create public .
  5.   " this class is used to implement business logic in processing requests to a odata service
  6.   " by implementing exact methods of inherited base class we are able to change request processing flow
  7.   " moreover, only in that way we are able to implement some features of odata service, like search, expand, filter, etc.
  8.   public section.
  9.     " class constants for implementing custom query parameter
  10.     constants old_param type string value `OLD`. " parameter name
  11.     constants old_border type int2 value 65.
  12.  
  13.     " to get expanded entity with $expand query option we should redefine this method
  14.     methods /iwbep/if_mgw_appl_srv_runtime~get_expanded_entity redefinition.
  15.  
  16.     " to process and implement custom actions to odata service we should redefine this method
  17.     methods /iwbep/if_mgw_appl_srv_runtime~execute_action redefinition.
  18.  
  19.     " to create deep entity (with depended instances in one request) we should redefine this method
  20.     methods /iwbep/if_mgw_appl_srv_runtime~create_deep_entity redefinition.
  21.  
  22.     " to process $batch query option we should redefine three methods of pre- post and process of request
  23.     " they implement many request processing at one time
  24.     methods /iwbep/if_mgw_appl_srv_runtime~changeset_begin redefinition.
  25.     methods /iwbep/if_mgw_appl_srv_runtime~changeset_process redefinition.
  26.     methods /iwbep/if_mgw_appl_srv_runtime~changeset_end redefinition.
  27.  
  28.   protected section.
  29.     " give access to set of entity and returns many of them in GET
  30.     methods employeeset_get_entityset redefinition.
  31.  
  32.     " process access to one exact entity by GET
  33.     methods employeeset_get_entity redefinition.
  34.  
  35.     " process creation of the new entity by POST request
  36.     methods employeeset_create_entity redefinition.
  37.  
  38.     " implements logic of entry updating by PUT request
  39.     methods employeeset_update_entity redefinition.
  40.  
  41.     " process deletion of an entry by DELETE request
  42.     methods employeeset_delete_entity redefinition.
  43.  
  44.     " another GET request only for one task
  45.     methods taskset_get_entity redefinition.
  46.  
  47.     " another GET request for set of tasks
  48.     methods taskset_get_entityset redefinition.
  49.   private section.
  50.     " flag, that indicate if errors occurred while processing $batch request
  51.     data changeset_errors_occurred type abap_bool value abap_false.
  52.  
  53.     methods parse_custom_uri_parameters
  54.       importing
  55.         request    type ref to /iwbep/cl_mgw_request
  56.       exporting
  57.         parameters type /iwbep/t_mgw_name_value_pair.
  58. endclass.
  59.  
  60.  
  61.  
  62. class zkhr_gw_odata_dpc_ext implementation.
  63.  
  64.   method employeeset_get_entityset.
  65.     data filters type /iwbep/t_mgw_select_option.
  66.     data filter type /iwbep/s_mgw_select_option.
  67.     data so_employeeid type /iwbep/s_cod_select_option.
  68.     data so_employeeid_table type table of /iwbep/s_cod_select_option.
  69.     data so_employeename type /iwbep/s_cod_select_option.
  70.     data so_employeename_table type table of /iwbep/s_cod_select_option.
  71.     data orderby_table type /iwbep/t_mgw_tech_order.
  72.     data orderby type /iwbep/s_mgw_tech_order.
  73.     data top type int4.
  74.     data skip type int4.
  75.     data employeeset type zkhr_gw_odata_mpc=>tt_employee.
  76.     data employee type zkhr_gw_odata_mpc=>ts_employee.
  77.     data count type i.
  78.     data search_string type string.
  79.     data parameters type /iwbep/t_mgw_name_value_pair.
  80.     data request type ref to /iwbep/cl_mgw_request.
  81.  
  82.     " downcasting of request object and its technical fields
  83.     request ?= io_tech_request_context.
  84.  
  85.     " parsing custom uri
  86.     me->parse_custom_uri_parameters(
  87.      exporting
  88.         request = request
  89.      importing
  90.         parameters = parameters ).
  91.  
  92.     try.
  93.         " attempt to get value of custom query parameter
  94.         data(old_only_param) = parameters[ name = me->old_param ].
  95.       catch cx_sy_itab_line_not_found.
  96.     endtry.
  97.  
  98.  
  99.  
  100.     " getting search string from the request context
  101.     search_string = io_tech_request_context->get_search_string(  ).
  102.  
  103.     " search processing (does not work in our system but still)
  104.     if search_string is not initial.
  105.       insert value #( sign = 'I' option = 'CP' low = |*{ search_string }*| ) into table so_employeename_table.
  106.       insert value #( sign = 'I' option = 'CP' low = |*{ search_string }*| ) into table so_employeeid_table.
  107.       select * from zkhr_employee into corresponding fields of table employeeset
  108.       where zkhr_employee~employeeid in so_employeeid_table
  109.       or zkhr_employee~employeename in so_employeename_table.
  110.  
  111.       " processing custom parameter
  112.     elseif old_only_param is not initial and to_lower( old_only_param-value ) = 'true'.
  113.       select * from zkhr_employee into corresponding fields of table employeeset
  114.       where zkhr_employee~employeeage ge me->old_border.
  115.  
  116.       " in the end try to get and use filters
  117.     else.
  118.       " getting info about filters from the request context
  119.       filters = io_tech_request_context->get_filter(  )->get_filter_select_options(  ).
  120.  
  121.       if filters is not initial.
  122.         " there filtering works only with two fields of the entity
  123.         " you should add more logic to enable additional filtering
  124.  
  125.         " getting filter property of the entity
  126.         read table filters with table key property = 'EMPLOYEEID' into filter.
  127.  
  128.         if sy-subrc eq 0.
  129.           " if there about employee id we add all values to an internal table
  130.           loop at filter-select_options into so_employeeid.
  131.             insert so_employeeid into table so_employeeid_table.
  132.           endloop.
  133.         endif.
  134.  
  135.         read table filters with table key property = 'EMPLOYEENAME' into filter.
  136.  
  137.         if sy-subrc eq 0.
  138.           loop at filter-select_options into so_employeename.
  139.             insert so_employeename into table so_employeename_table.
  140.           endloop.
  141.         endif.
  142.       endif.
  143.  
  144.       " selecting entries using filters, which got previously
  145.       select * from zkhr_employee into corresponding fields of table employeeset
  146.       where zkhr_employee~employeeid in so_employeeid_table
  147.       and zkhr_employee~employeename in so_employeename_table.
  148.       " ets ands, you can add more
  149.     endif.
  150.  
  151.     " $orderby processing
  152.     " getting info about ordering parameter
  153.     orderby_table = io_tech_request_context->get_orderby(  ).
  154.  
  155.     if orderby_table is not initial.
  156.       " getting first ordering object
  157.       read table orderby_table into orderby index 1.
  158.       if sy-subrc eq 0.
  159.         " choosing the way to order selected entries
  160.         if orderby-order eq 'desc'.
  161.           " choosing field of ordering
  162.           case orderby-property.
  163.             when 'EMPLOYEEID'.
  164.               sort employeeset by employeeid descending.
  165.             when 'EMPLOYEEAGE'.
  166.               sort employeeset by  employeeage descending.
  167.           endcase.
  168.         elseif orderby-order eq 'asc'.
  169.           case orderby-property.
  170.             when 'EMPLOYEEID'.
  171.               sort employeeset by employeeid descending.
  172.             when 'EMPLOYEEAGE'.
  173.               sort employeeset by  employeeage descending.
  174.           endcase.
  175.         endif.
  176.       endif.
  177.     endif.
  178.  
  179.     " getting value of $top query parameter
  180.     top = io_tech_request_context->get_top(  ).
  181.  
  182.     "getting value of $skip query parameter
  183.     skip = io_tech_request_context->get_skip(  ).
  184.  
  185.     " making post processing according to top and skip parameters
  186.     if skip is not initial.
  187.       delete employeeset to skip.
  188.     endif.
  189.     if top is not initial.
  190.       delete employeeset to top + 1.
  191.     endif.
  192.  
  193.     et_entityset = employeeset.
  194.  
  195.   endmethod.
  196.  
  197.   method employeeset_get_entity.
  198.  
  199.     data keys type /iwbep/t_mgw_tech_pairs.
  200.     data employee_id type zkhr_gw_odata_mpc=>ts_employee-employeeid.
  201.     data key_tab type /iwbep/s_mgw_tech_pair.
  202.  
  203.     " getting value of the required entry id
  204.     keys = io_tech_request_context->get_keys(  ).
  205.     read table keys into key_tab with key name = 'EMPLOYEEID'.
  206.  
  207.     if sy-subrc eq 0.
  208.       employee_id = key_tab-value.
  209.     endif.
  210.  
  211.     " getting exact one entry
  212.     select single * from zkhr_employee into corresponding fields of er_entity
  213.     where employeeid = employee_id.
  214.  
  215.     if er_entity is initial.
  216.       raise exception type /iwbep/cx_mgw_busi_exception
  217.         exporting
  218.           textid           = /iwbep/cx_mgw_busi_exception=>business_error
  219.           entity_type      = io_tech_request_context->get_entity_type_name( )
  220.           http_status_code = /iwbep/cx_mgw_busi_exception=>gcs_http_status_codes-not_found
  221.           message          = |Employee with id { employee_id } id does not exist.|.
  222.     endif.
  223.   endmethod.
  224.  
  225.   method employeeset_create_entity.
  226.     data employee like er_entity.
  227.     " getting fields of a brand new entity
  228.     io_data_provider->read_entry_data( importing es_data = employee ).
  229.     " filling admin field
  230.     employee-mandt = sy-mandt.
  231.     " filling returning object for response
  232.     er_entity = employee.
  233.     " adding new entry to the active table
  234.     insert into zkhr_employee values employee.
  235.   endmethod.
  236.  
  237.   method employeeset_update_entity.
  238.     data requested_input_data like er_entity.
  239.     " getting fields and their value to update
  240.     io_data_provider->read_entry_data( importing es_data = requested_input_data ).
  241.     " filling admin field. again
  242.     requested_input_data-mandt = sy-mandt.
  243.  
  244.     " updating requested entry
  245.     update zkhr_employee from requested_input_data.
  246.  
  247.     " if something went wrong, raise business exception
  248.     " and remember, you should always return something in such requests
  249.     if sy-subrc <> 0.
  250.       raise exception type /iwbep/cx_mgw_busi_exception
  251.         exporting
  252.           textid           = /iwbep/cx_mgw_busi_exception=>business_error
  253.           entity_type      = io_tech_request_context->get_entity_type_name( )
  254.           http_status_code = /iwbep/cx_mgw_busi_exception=>gcs_http_status_codes-not_found
  255.           message          = |Employee with { requested_input_data-employeeid } id does not exist.|.
  256.     endif.
  257.   endmethod.
  258.  
  259.   method employeeset_delete_entity.
  260.     data key_tab type /iwbep/s_mgw_tech_pair.
  261.     data employee_id type zkhr_gw_odata_mpc=>ts_employee-employeeid.
  262.     data keys type /iwbep/t_mgw_tech_pairs.
  263.  
  264.     " getting keys of the request
  265.     keys = io_tech_request_context->get_keys(  ).
  266.  
  267.     " getting key value of id to delete
  268.     read table keys with key name = 'EMPLOYEEID' into key_tab.
  269.     if sy-subrc = 0.
  270.       employee_id = key_tab-value.
  271.     endif.
  272.     " deleting entry from the active table
  273.     delete from zkhr_employee where employeeid = employee_id.
  274.  
  275.     if sy-subrc <> 0.
  276.       raise exception type /iwbep/cx_mgw_busi_exception
  277.         exporting
  278.           textid           = /iwbep/cx_mgw_busi_exception=>business_error
  279.           entity_type      = io_tech_request_context->get_entity_type_name( )
  280.           http_status_code = /iwbep/cx_mgw_busi_exception=>gcs_http_status_codes-not_found
  281.           message          = |Couldn't delete employee: employee with { employee_id } id does not exist.|.
  282.    endif.
  283.  endmethod.
  284.  
  285.  method /iwbep/if_mgw_appl_srv_runtime~get_expanded_entity.
  286.    data deep_employee type zkhr_gw_odata_mpc_ext=>deep_employee.
  287.    data keys type /iwbep/s_mgw_name_value_pair.
  288.    data employeeid type zkhr_gw_odata_mpc=>ts_employee-employeeid.
  289.    data expanded_clause like line of et_expanded_tech_clauses.
  290.    data compare_result type io_expand->ty_e_compare_result.
  291.    data entityset_name type /iwbep/mgw_tech_name.
  292.  
  293.    " getting info about navigation in request to expand
  294.    " you can use only predefined
  295.    compare_result = io_expand->compare_to_tech_names( 'EMPLOYEETOTASKSNAV' ).
  296.    " getting name of the entity to expand
  297.    entityset_name = io_tech_request_context->get_entity_set_name(  ).
  298.    " now we have info about entityset and navigation, so let
  299.    if entityset_name eq 'EmployeeSet' and ( compare_result eq io_expand->gcs_compare_result-match_subset
  300.                                             or compare_result eq io_expand->gcs_compare_result-match_equals ).
  301.      " filling key table with entities to expand
  302.      read table it_key_tab into keys with key name = 'EmployeeId'.
  303.      if sy-subrc = 0.
  304.        employeeid = keys-value.
  305.      endif.
  306.  
  307.      " selecting one entity
  308.      select single * from zkhr_employee into corresponding fields of deep_employee
  309.      where employeeid = employeeid.
  310.  
  311.      " selecting all depended entities
  312.      if deep_employee is not initial.
  313.        select * from zkhr_task into corresponding fields of table deep_employee-employeetotasksnav
  314.        where employeeid = employeeid.
  315.  
  316.      endif.
  317.  
  318.  
  319.      expanded_clause = 'EMPLOYEETOTASKSNAV'.
  320.      append expanded_clause to et_expanded_tech_clauses.
  321.    endif.
  322.  
  323.    " filling response objects
  324.    me->copy_data_to_ref(
  325.       exporting
  326.           is_data = deep_employee
  327.       changing
  328.           cr_data = er_entity ).
  329.  
  330.  endmethod.
  331.  
  332.  method taskset_get_entity.
  333.    data keys type /iwbep/t_mgw_tech_pairs.
  334.    data taskid type zkhr_gw_odata_mpc=>ts_task-taskid.
  335.    data key_tab type /iwbep/s_mgw_tech_pair.
  336.  
  337.    keys = io_tech_request_context->get_keys(  ).
  338.    read table keys into key_tab with key name = 'TASKID'.
  339.  
  340.    if sy-subrc eq 0.
  341.      taskid = key_tab-value.
  342.    endif.
  343.  
  344.    select single * from zkhr_task into corresponding fields of er_entity
  345.    where taskid = taskid.
  346.  
  347.    if er_entity is initial.
  348.      raise exception type /iwbep/cx_mgw_busi_exception
  349.        exporting
  350.          textid           = /iwbep/cx_mgw_busi_exception=>business_error
  351.          entity_type      = io_tech_request_context->get_entity_type_name( )
  352.          http_status_code = /iwbep/cx_mgw_busi_exception=>gcs_http_status_codes-not_found
  353.          message          = |Tasl with { taskid } id does not exist.|.
  354.    endif.
  355.  endmethod.
  356.  
  357.  method taskset_get_entityset.
  358.    data key type /iwbep/s_mgw_tech_pair.
  359.    data keys type /iwbep/t_mgw_tech_pairs.
  360.    data employeeid type zkhr_gw_odata_mpc=>ts_employee-employeeid.
  361.    data taskid type zkhr_gw_odata_mpc=>ts_task-taskid.
  362.  
  363.    keys = io_tech_request_context->get_source_keys(  ).
  364.  
  365.    read table keys into key with key name = 'EMPLOYEEID'.
  366.    if sy-subrc = 0.
  367.      employeeid = key-value.
  368.    endif.
  369.    if employeeid is not initial.
  370.      select * from zkhr_task into corresponding fields of table et_entityset
  371.      where zkhr_task~employeeid = employeeid.
  372.    else.
  373.      select * from zkhr_task into corresponding fields of table et_entityset.
  374.    endif.
  375.  endmethod.
  376.  
  377.  method parse_custom_uri_parameters.
  378.    " request check
  379.    if request is not bound.
  380.      return.
  381.    endif.
  382.  
  383.    clear parameters.
  384.  
  385.    " getting request string
  386.    read table request->get_request_details(  )-technical_request-request_header
  387.        into data(request_header) with key name = '~request_uri'.
  388.    if sy-subrc = 0.
  389.      " filling system field with index of question mark in request string
  390.      search request_header-value for '?'.
  391.  
  392.      if sy-subrc = 0.
  393.        " splitting substring with parameters by & clause
  394.        data(pos) = sy-fdpos + 1.
  395.        split request_header-value+pos at '&' into table data(uri_params).
  396.  
  397.        " looping through parameters and filling name-value table
  398.        loop at uri_params into data(param).
  399.          append initial line to parameters assigning field-symbol(<init_param>).
  400.          split param at '=' into <init_param>-name <init_param>-value.
  401.          <init_param>-name = to_upper( <init_param>-name ).
  402.        endloop.
  403.      endif.
  404.    endif.
  405.  
  406.  endmethod.
  407.  
  408.  method /iwbep/if_mgw_appl_srv_runtime~execute_action.
  409.    data parameter type /iwbep/s_mgw_name_value_pair.
  410.    data employee type zkhr_gw_odata_mpc=>ts_employee.
  411.    data employees type zkhr_gw_odata_mpc=>tt_employee.
  412.    data task type zkhr_gw_odata_mpc=>ts_task.
  413.  
  414.    " processing request according to action name
  415.    " ATTANTION! case is important
  416.    case iv_action_name.
  417.      when 'GetEmployeesByAge'.
  418.        clear employees.
  419.        " getting parameter according to imported function signature
  420.        read table it_parameter into parameter with key name = 'Age'.
  421.        data age type int2.
  422.        if sy-subrc = 0.
  423.          age = parameter-value.
  424.        endif.
  425.        " selecting employees with exact age
  426.        select * from zkhr_employee into table employees
  427.        where employeeage = age.
  428.  
  429.        " if we couldn't get anything, do response with error
  430.         if employees is initial.
  431.           raise exception type /iwbep/cx_mgw_busi_exception
  432.             exporting
  433.               textid  = /iwbep/cx_mgw_busi_exception=>business_error
  434.               message = 'Could not find employee data.'.
  435.         endif.
  436.         " copying selected data
  437.         me->copy_data_to_ref(
  438.             exporting
  439.                 is_data = employees
  440.             changing
  441.                 cr_data = er_data ).
  442.       when 'ChangeTaskStatus'.
  443.         clear task.
  444.         read table it_parameter into parameter with key name = 'TaskId'.
  445.         data taskid type string.
  446.         if sy-subrc = 0.
  447.           taskid = parameter-value.
  448.         endif.
  449.         select single * from zkhr_task into corresponding fields of task
  450.         where taskid = taskid.
  451.         if task is initial.
  452.           raise exception type /iwbep/cx_mgw_busi_exception
  453.             exporting
  454.               textid  = /iwbep/cx_mgw_busi_exception=>business_error
  455.               message = |Could not find task with { taskid } id.|.
  456.         endif.
  457.         task-taskstatus = cond #( when task-taskstatus = 'C'
  458.                                   then 'O'
  459.                                   else 'C' ).
  460.         update zkhr_task from task.
  461.         if sy-subrc <> 0.
  462.           raise exception type /iwbep/cx_mgw_busi_exception
  463.             exporting
  464.               textid  = /iwbep/cx_mgw_busi_exception=>business_error
  465.               message = |Could not update task with { taskid } id.|.
  466.         endif.
  467.         me->copy_data_to_ref(
  468.             exporting
  469.                 is_data = task
  470.             changing
  471.                 cr_data = er_data ).
  472.     endcase.
  473.   endmethod.
  474.  
  475.   method /iwbep/if_mgw_appl_srv_runtime~create_deep_entity.
  476.     data deep_employee type zkhr_gw_odata_mpc_ext=>deep_employee.
  477.     data employee type zkhr_gw_odata_mpc=>ts_employee.
  478.     data tasks type zkhr_gw_odata_mpc=>tt_task.
  479.  
  480.     " filling predefined deep entity fields with values from the request body
  481.     io_data_provider->read_entry_data( importing
  482.                                         es_data = deep_employee ).
  483.     move-corresponding deep_employee to employee.
  484.     employee-mandt = sy-mandt.
  485.  
  486.     " creating main entity
  487.     insert into zkhr_employee values employee.
  488.  
  489.     " creating depended entities
  490.     loop at deep_employee-employeetotasksnav into data(task).
  491.       task-employeeid = employee-employeeid.
  492.       task-mandt = sy-mandt.
  493.       insert task into table tasks.
  494.     endloop.
  495.  
  496.     insert zkhr_task from table tasks.
  497.  
  498.     " as always, return created entries
  499.     me->copy_data_to_ref( exporting
  500.                             is_data = deep_employee
  501.                           changing
  502.                             cr_data = er_deep_entity ).
  503.   endmethod.
  504.  
  505.   method /iwbep/if_mgw_appl_srv_runtime~changeset_begin.
  506.     " build-up before $batch processing
  507.     me->changeset_errors_occurred = abap_false.
  508.     if lines( it_operation_info ) > 1.
  509.       cv_defer_mode = abap_true.
  510.     endif.
  511.   endmethod.
  512.  
  513.   method /iwbep/if_mgw_appl_srv_runtime~changeset_end.
  514.     " if something went wrong, do rollback in tables
  515.     if me->changeset_errors_occurred = abap_true.
  516.       call function 'BAPI_TRANSACTION_ROLLBACK'.
  517.     endif.
  518.   endmethod.
  519.  
  520.   method /iwbep/if_mgw_appl_srv_runtime~changeset_process.
  521.     data context type ref to /iwbep/cl_mgw_request.
  522.     data entity type ref to data.
  523.     data key type /iwbep/t_mgw_name_value_pair.
  524.     data response type /iwbep/if_mgw_appl_types=>ty_s_changeset_response.
  525.  
  526.     " looping through all subrequests
  527.     loop at it_changeset_request reference into data(change_request).
  528.       try.
  529.           " getting info about subrequest
  530.           context ?= change_request->request_context.
  531.         catch cx_root into data(ex).
  532.           raise exception type /iwbep/cx_mgw_tech_exception
  533.             exporting
  534.               textid   = /iwbep/cx_mgw_tech_exception=>internal_error
  535.               previous = ex.
  536.       endtry.
  537.  
  538.       try.
  539.           " try to execute subrequest according to its type
  540.           case change_request->operation_type.
  541.             when /iwbep/if_mgw_appl_types=>gcs_operation_type-create_entity.
  542.               " create
  543.               me->/iwbep/if_mgw_appl_srv_runtime~create_entity(
  544.                   exporting
  545.                       io_data_provider = change_request->entry_provider
  546.                       io_tech_request_context = context
  547.                   importing
  548.                       er_entity = entity  ).
  549.             when /iwbep/if_mgw_appl_types=>gcs_operation_type-update_entity.
  550.               " update
  551.               me->/iwbep/if_mgw_appl_srv_runtime~update_entity(
  552.                   exporting
  553.                       io_data_provider = change_request->entry_provider
  554.                       io_tech_request_context = context
  555.                   importing
  556.                       er_entity = entity ).
  557.             when /iwbep/if_mgw_appl_types=>gcs_operation_type-patch_entity.
  558.               " patch
  559.               me->/iwbep/if_mgw_appl_srv_runtime~patch_entity(
  560.                   exporting
  561.                       io_data_provider = change_request->entry_provider
  562.                       io_tech_request_context = context
  563.                   importing
  564.                       er_entity = entity ).
  565.             when /iwbep/if_mgw_appl_types=>gcs_operation_type-execute_action.
  566.               " action execution
  567.               me->/iwbep/if_mgw_appl_srv_runtime~execute_action(
  568.                   exporting
  569.                       io_tech_request_context = context
  570.                       iv_action_name = context->/iwbep/if_mgw_req_func_import~get_function_import_name( )
  571.                       it_parameter = context->/iwbep/if_mgw_req_func_import~get_parameters( )
  572.                   importing
  573.                       er_data = entity ).
  574.           endcase.
  575.  
  576.           " filling results of a subrequest in the response table
  577.           response-operation_no = change_request->operation_no.
  578.           response-entity_data = entity.
  579.           insert response into table ct_changeset_response.
  580.  
  581.         catch /iwbep/cx_mgw_busi_exception into data(busi_ex).
  582.           " exceptions processing
  583.           me->changeset_errors_occurred = abap_true.
  584.  
  585.           call function 'BAPI_TRANSACTION_ROLLBACK'.
  586.  
  587.           raise exception type /iwbep/cx_mgw_busi_exception
  588.             exporting
  589.               http_status_code = busi_ex->get_http_status_code( )
  590.               textid           = /iwbep/cx_mgw_busi_exception=>business_error
  591.               previous         = busi_ex
  592.               message          = busi_ex->message.
  593.         catch /iwbep/cx_mgw_tech_exception into data(tech_ex).
  594.           me->changeset_errors_occurred = abap_true.
  595.  
  596.           call function 'BAPI_TRANSACTION_ROLLBACK'.
  597.  
  598.           raise exception type /iwbep/cx_mgw_tech_exception
  599.             exporting
  600.               http_status_code = tech_ex->get_http_status_code( )
  601.               textid           = /iwbep/cx_mgw_tech_exception=>internal_error
  602.               previous         = tech_ex.
  603.       endtry.
  604.     endloop.
  605.   endmethod.
  606. endclass.
Add Comment
Please, Sign In to add comment