In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Timestamp in ABAP transparent table. Data type is dec:
There is a requirement: calculate the number of days between the two timestamps and discard the hours after the 8 digits of the timestamp year-month-day: minutes: seconds.
For example: if the timestamp is 20180918173132, discard 173132, keep only 20180918, and then calculate the day interval.
It is not possible to directly use CDS view's string manipulation function substring because the timestamp type dec does not match the string type expected by substring.
Solution:
First cast the timestamp field type from dec to abap.dats:
@ AbapCatalog.sqlViewName: 'zproday'@AbapCatalog.compiler.compareFilter: true@AccessControl.authorizationCheck: # CHECK@EndUserText.label:' Day between'define view zdate_day_between as select from comm_product {key comm_product.product_id as prod_id,comm_product.product_guid as prod_guid,comm_product.valid_from as valid_from,comm_product.valid_to as valid_to,cast (substring (cast (valid_from as abap.char (32)), 1mai 8) as abap.dats) as from_date Cast (substring (cast (valid_to as abap.char (32)), 1pc8) as abap.dats) as to_date}
Then use the CDS view standard time processing function DATS_DAYS_BETWEEN:
@ AbapCatalog.sqlViewName: 'zdbetw'@AbapCatalog.compiler.compareFilter: true@AccessControl.authorizationCheck: # CHECK@EndUserText.label:' Day between'define view zc_date_day_between as select from zdate_day_between as host {key host.prod_guid,host.prod_id,host.from_date,host.to_date,DATS_DAYS_BETWEEN (host.from_date,host.to_date) as no_of_days}
Test results:
For more original Jerry articles, please follow the official account "Wang Zixi":
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.