Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whothefluff/abap-gateway-actions
Gateway actions
https://github.com/whothefluff/abap-gateway-actions
abap action functionimport gateway odata serviceoperation
Last synced: about 1 month ago
JSON representation
Gateway actions
- Host: GitHub
- URL: https://github.com/whothefluff/abap-gateway-actions
- Owner: whothefluff
- Created: 2024-06-23T23:23:37.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-27T11:44:24.000Z (5 months ago)
- Last Synced: 2024-09-30T23:24:23.980Z (about 2 months ago)
- Topics: abap, action, functionimport, gateway, odata, serviceoperation
- Language: ABAP
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# abap-gateway-actions
Helps modularize the non-entity stuff
## Use
Define a subclass of _ZCL_GATEWAY_ACTION_:
```abap
class function_import_something definition
create public "#EC CLAS_FINAL
inheriting from zcl_gateway_action.public section.
types t_return_data type zcl_project_mpc=>somethingresponse.
methods run redefinition.
endclass.
class function_import_something implementation.method run.
types rfc_return.
data(rfc_dest) = /iwbep/cl_sb_gen_dpc_rt_util=>get_rfc_destination( me->runtime( )->get_dp_facade( ) ).
data(parameters) = me->request( )->get_parameters( ).
data(rfc_return) = value rfc_return( ).
call function 'Z_SOMETHING'
destination rfc_dest
exporting
i_param = parameters[ name = to_upper( `Param` ) ]-value
importing
e_val = rfc_return.r_val = new me->t_return_data( corresponding #( rfc_return ) ).
endmethod.
endclass.
```
Create an instance and call the method
```abap
method /iwbep/if_mgw_appl_srv_runtime~execute_action.types: begin of action,
name type string,
impl type ref to zif_gateway_action,
end of action,
actions type sorted table of action with unique key name.data(tech_request) = io_tech_request_context. "just to make the code a bit shorter
data(actions) = value actions( ( name = `DoSomething`
impl = new function_import_something( i_request = tech_request
i_runtime = me ) ) ).er_data = actions[ name = tech_request->get_function_import_name( ) ]-impl->run( ).
endmethod.
```