cancel
Showing results for 
Search instead for 
Did you mean: 

Passing datetime parameter input to odata created by cds view

prasad
Participant
0 Kudos

Hi All,

Created a parameterized CDS View with and company code, datetime as input as below.

 

@AbapCatalog.viewEnhancementCategory: [#NONE]

@AccessControl.authorizationCheck: #NOT_REQUIRED

@EndUserText.label: 'SAPS4'

@OData.publish: true

@Metadata.ignorePropagatedAnnotations: true

@ObjectModel.usageType:{

serviceQuality: #X,

sizeCategory: #S,

dataClass: #MIXED

}

define view entity ZCDS_Feed

with parameters

p_companycode :bukrs,

p_fromdate :crms4_changed_at,

p_todate :crms4_changed_at

as select from crms4d_serv_i [ objtype_h ='SDR2000266' ] as series_4

{

series_4.object_id as XContractNumber,

series_4.number_int as DocumentNumber,

series_4.po_number_ship as ContractNumber,

series_4.contstart as StartDate,

series_4.ci_contract_id as IS_TContractNumber,

series_4.sales_group_sd as OfficeCode,

series_4.cust_group5 as ClientTypeCode

}

where series_4.sales_org_sd = $parameters.p_companycode

and changed_at_i between $parameters.p_fromdate and $parameters.p_todate

 

Using odata publish annotation i have added the service

how would i pass the date time  was able to send parameter of type string as below 

/sap/opu/odata/sap/ZCDS_FEED_CDS/ZCDS_Feed(p_companycode='2305')/Set

from date and todate are of type TZNTSTMPS

 

Regards

Prasad

 

 

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Prasad,

Your URL with parameters would be like the following - /sap/opu/odata/sap/ZCDS_FEED_CDS/ZCDS_Feed(p_companycode='2305',p_fromdate=datetime'YYYY-MM-DDTHH:mm:ss',p_todate=datetime'YYYY-MM-DDTHH:mm:ss')/Set

 

Regards,

Ryan Crosby