Skip to Content
0
Oct 25, 2012 at 01:57 PM

Deep structure in action return

31 Views

Hello experts,

my problem is the next one:

I'm trying to excecute an action that returns a deep structure, that contains an return code and a table of messages but I don't know how to define it in the model.

I have defined an entity type ActionReturn that contains the subrc and the messages.

_entity_type = model->create_entity_type('ActionReturn').

* Properties

_property = _entity_type->create_property( iv_property_name = 'subrc' iv_abap_fieldname = 'SUBRC' ). _property->set_type_edm_string( ).

_property = _entity_type->create_property( iv_property_name = 'messages' iv_abap_fieldname = 'MESSAGES' ).

_entity_type->bind_structure('ZJHD_MODEL=>ACTIONRETURN').

And I have define the action Hello that returns the Action return defined before.

_action = model->create_action( 'Hello' ).

_action->set_action_for( 'User' ).

_action->set_http_method( 'GET' ).

* Returns ActionReturns

_action->SET_RETURN_ENTITY_TYPE('ActionReturn').

* 1..1

_action->set_return_multiplicity( CARDINALITY_ENTITY ).

* Input paramters are LogicalTimesheetId

_parameter = _action->create_input_parameter( iv_parameter_name = 'userName' iv_abap_fieldname = 'USERNAME' ).

_parameter->bind_data_element( 'SYSID' ).

Any ideas?