SRF_Helper_Cut_Decimals

DDL: SRF_HELPER_CUT_DECIMALS SQL: SRFCUTDECIMALS Type: view

Cuts of decimals from an amount field

SRF_Helper_Cut_Decimals is a CDS View that provides data about "Cuts of decimals from an amount field" in SAP S/4HANA. It reads from 1 data source (I_SAPClient) and exposes 2 fields.

Data Sources (1)

SourceAliasJoin Type
I_SAPClient I_SAPClient from

Parameters (1)

NameTypeDefault
P_Amount abap.curr( 23,2 )

Annotations (8)

NameValueLevelField
AbapCatalog.sqlViewName SRFCUTDECIMALS view
AccessControl.authorizationCheck #NOT_ALLOWED view
EndUserText.label Cuts of decimals from an amount field view
ClientHandling.type #INHERITED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.usageType.serviceQuality #X view

Fields (2)

KeyFieldSource TableSource FieldDescription
dec230endasP_AmountNoDecimals
P_AbsoluteAmountNoDecimals
@AbapCatalog.sqlViewName: 'SRFCUTDECIMALS'
@AccessControl.authorizationCheck: #NOT_ALLOWED
@EndUserText.label: 'Cuts of decimals from an amount field'
@ClientHandling: { type: #INHERITED, algorithm: #SESSION_VARIABLE }
@ObjectModel.usageType: { dataClass: #MIXED, sizeCategory: #S, serviceQuality: #X }

/*******************************************************************************
 * Cuts off the decimals from an amount, i.e. positive amounts are rounded     *
 * down and negative are rounded up                                            *
 *******************************************************************************/

define view SRF_Helper_Cut_Decimals

  with parameters
    P_Amount : abap.curr( 23,2 )

  as select from I_SAPClient //dummy select


{

  case $parameters.P_Amount
    when abs(:P_Amount ) then cast(floor($parameters.P_Amount) as abap.dec( 23, 0)) // positive

    else                      cast(ceil($parameters.P_Amount) as abap.dec( 23, 0))  // negative

    end as P_AmountNoDecimals,

  cast(floor(abs($parameters.P_Amount)) as abap.dec( 23, 0)) as P_AbsoluteAmountNoDecimals
}