02-21-2019 3:38 PM
Hi all
I've created a CDS view, that is using BOPF for transactional purpose.
On BOPF I've created an action:
and would like to publish as functionsimport for odata consumption.
I've found a guide https://help.sap.com/doc/saphelp_nw75/7.5.5/en-US/07/1a1fd1465749dca2872640cba8d82e/content.htm?load... but I would like to provide on CDS view level instead of field level.
How to do it?
Thanks
02-21-2019 3:49 PM
02-22-2019 12:59 PM
Sorry, for my bad expression. What I mean is, I would like to provide an action, that defined in teh BOPF for the OData consumption.
The CDS view looks as the following:
@AbapCatalog.sqlViewName: 'ZAMICLASSSEL'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Classification selection'
@VDM.viewType: #COMPOSITE
@ObjectModel: {
transactionalProcessingEnabled: true,
writeActivePersistence: 'ZAM_T_CLASS_SEL',
compositionRoot: true,
createEnabled: false,
updateEnabled: false,
deleteEnabled: false
}
define view ZAM_I_CLASS_SEL
as select from ZAM_I_CLASS_HEAD
association [1..1] to ZAM_I_CLASSTYPE as _ClassType on $projection.ClassType = _ClassType.ClassType
association [1..1] to ZAM_I_CLASS_KEYWS as _ClassKeyword on $projection.ClassNum = _ClassKeyword.ClassNum
and $projection.ClassType = _ClassKeyword.ClassType
{
@ObjectModel.foreignKey.association: '_ClassType'
key ClassType,
@ObjectModel.foreignKey.association: '_ClassKeyword'
key ClassNum,
ValidFrom,
ValidUntil,
_ClassType,
_ClassKeyword
}
and the generated node:
and created action on BOPF:
Now, I want to provide the action for consumption as part of OData and do not know, how to do it.
Here is the content of action class:
CLASS zcl_am_a_characteristics DEFINITION
PUBLIC
INHERITING FROM /bobf/cl_lib_a_supercl_simple
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS /bobf/if_frw_action~execute
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_am_a_characteristics IMPLEMENTATION.
METHOD /bobf/if_frw_action~execute.
BREAK-POINT.
ENDMETHOD.
ENDCLASS.
When the action get called through the OData, I would like to receive the value from ClassType and ClassNum that is defined on CDS view above. It should be like defining function import with particular import parameters
and another return type like:
I hope, it is more clear, what I am trying to archive.
Thanks
02-22-2019 1:00 PM
02-22-2019 1:43 PM
Hi Anujit Marty,
You need to enable the action in odata consumption view first, see the SAP help example below
But make sure you select the exporting type as "Node" in the BOPF action.
Let me know in case of issues.
BR,
Mahesh