Skip to Content
0
Jan 13, 2021 at 03:11 AM

Odata V4 Action Parameter Ommitting is not supported

1130 Views

Hello experts.

I'm currently doing a V4 Odata service with a code base implementation. I'm not using CDS views.

I've gone through the blogs of Andre Fischer which has really helped me getting started. However I'm currently stuck on actions and functions. As far as I can see when I develop the service, if I do a function Import it will automattically distinguish as a GET request, where action is a POST. In my usecase I need a post.

I've created an action import called delete data where I'm setting a category as a parameter. When I try to call that action import I get an error message back

"error": {"code": "/IWBEP/CM_V4S_RUN/025","message": "Parameter 'Category' is missing; Omitting is not supported",

When I debug I can see that it fails on this piece of code.

But I can't see what this "provided" refers to.

Below is my ABAP code for the action import.

  lo_action = io_model->create_action(/s4as/if_cost_center_types=>gcs_function_names-delete_data ).
    lo_action->set_edm_name('FuDeleteData').
**"Function Parameters
    lo_parameter = lo_action->create_parameter('CATEGORY').
    lo_parameter->set_edm_name('Category').
    lo_parameter->set_primitive_type('CATEGORY').
**    "Function Return
    lo_return = lo_action->create_return().
    lo_return->set_primitive_type('STRING_MESSAGE').
**    "Function Import
    lo_action_import = lo_action->create_action_import(/s4as/if_cost_center_types=>gcs_function_import_names-delete_data ).
    lo_action_import->set_edm_name('DeleteData').