专栏首页Jerry的SAP技术分享How to create CDS view to return Service order item detail data

How to create CDS view to return Service order item detail data

版权声明:本文为博主汪子熙原创文章,未经博主允许不得转载。 https://jerry.blog.csdn.net/article/details/89925555

Requirement

You are asked to create a CDS view which must return the following information of Service order line item.

(1). Create a CDS view which return system status code and description like below:

view source code:

@AbapCatalog.sqlViewName: 'zstatustext'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'system status code and description'
define view Z_C_Status_Text as select from tj02 inner join tj02t as _tj02t on 
 tj02.istat = _tj02t.istat and _tj02t.spras = 'E'                                
{
   key tj02.istat,
   _tj02t.txt04,
   _tj02t.txt30
}

(2). Create a CDS view which contains product guid together with their status code and description:

source code:

@AbapCatalog.sqlViewName: 'zprdstatus'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'product guid and status code'
define view Z_I_Prod_Status as select from crmd_product_i 
inner join crm_jest as _status on crmd_product_i.guid = _status.objnr
inner join Z_C_Status_Text as _text on _status.stat = _text.istat
{
   key crmd_product_i.guid,
   _status.stat,
   _text.txt04,
   _text.txt30
}

where _status.inact = '' and _status.stat like 'I%' and _status.stat <> 'I1030';

(3) Create final CDS view which returns all necessary information:

source code:

@AbapCatalog.sqlViewName: 'zitemdetail'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'item detail'
define view Z_I_Item_Detail as select from crmd_orderadm_i 
inner join crmd_schedlin as _schedule 
  on crmd_orderadm_i.guid = _schedule.item_guid
inner join crmd_product_i as _prod on crmd_orderadm_i.guid = _prod.guid
inner join Z_I_Prod_Status as _prd_status
  on crmd_orderadm_i.guid = _prd_status.guid
{
   key crmd_orderadm_i.guid,
   key crmd_orderadm_i.header,
   crmd_orderadm_i.number_int,
   crmd_orderadm_i.description,
   _schedule.quantity,
   _prod.process_qty_unit as unit,
   _prd_status.stat,
   _prd_status.txt04,
   _prd_status.txt30

}

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 如何判断SAP CDS view的association是inner join还是outer join实现的

    I have used the following syntax to directly return the corresponding descriptio...

    Jerry Wang
  • 在SAP ABAP和Hybris Commerce里启动后台作业

    所有的cron job handler class必须声明AbstractJobPerformable为父类并重载perform方法。

    Jerry Wang
  • CRM订单上状态字段在UI的显示逻辑

    (1) WebUI上的One order header和status是1:N的关系:在WebUI上的search结果里,会把一个order当前所有的status...

    Jerry Wang
  • yeoman-generator 中的 run loop 实现

    yeoman genenrator 的 run loop,每一个添加进去的方法都会在 generator 调用的时候被调用,而且通常来讲,这些方法是按照顺序调用...

    腾讯IVWEB团队
  • 开发工具总结(6)之Android Studio模板配置详解(提高开发效率必备技能)

    版权声明:本文为博主原创文章(部分引用他人博文,已加上引用说明),未经博主允许不得转载。https://www.jianshu.com/p/1fe87050c1...

    AWeiLoveAndroid
  • 百度阿里头条算法面经

    最近秋招很多消息和内推都是通过牛客获得的,回馈一下发一波面经,希望能帮到大家~ 楼主华五本科海外硕士,一份美国大厂数据挖掘实习,没有相关领域的paper,投的都...

    牛客网
  • Hive案例05-学生成绩表综合案例

    CoderJed
  • Redis的数据安全

    Redis是一种远程内存数据库,主要用C语言编写完成,它也是基于键值对(key-value)的NoSQL数据库,提供了由String(字符串)、hash(哈希)...

    MySQL数据库技术栈
  • Python基本的变量类型

    ZONGLYN
  • 走近科学:破解苹果MacBook摄像头进行秘密监控

    近日,一位不幸的外国女青年收到了多张自己的裸照,根据拍摄角度观察,这些裸照是几个月以来通过笔记本的内置摄像头拍摄的。小编此时不禁要说:裸体上网是个不好的习惯啊!...

    FB客服

扫码关注云+社区

领取腾讯云代金券