天天看點

使用CDS view直接從資料庫表裡取出服務訂單的行項目

How to get Service Order item detail by directly query from Database table

Requirement

Create a CDS view to return highlighted information below. ( In the past we can use CRM_ORDER_READ to get them in ABAP code )

使用CDS view直接從資料庫表裡取出服務訂單的行項目

First we can get order guid from order id by this table:

使用CDS view直接從資料庫表裡取出服務訂單的行項目

(1). 根據order id得到order guid:00163EA720001ED285EFEFADF195A1B2

将order guid傳入header field得到item資訊:

使用CDS view直接從資料庫表裡取出服務訂單的行項目

同時拿到該item的guid: 00163EA720001ED285EFF4706041A1B5

Mockup裡的Item No. 10維護在NUMBER_INT field裡:

使用CDS view直接從資料庫表裡取出服務訂單的行項目

Product description在DESCRIPTION field裡,因為隻有這個field區分大小寫。

使用CDS view直接從資料庫表裡取出服務訂單的行項目

(2). 取item的quantity

将step1得到的item_guid傳入下表:

使用CDS view直接從資料庫表裡取出服務訂單的行項目

得到quantity:

使用CDS view直接從資料庫表裡取出服務訂單的行項目

(3). 取quantity unit

将step1拿到的item guid傳入下表拿到quantity unit:

使用CDS view直接從資料庫表裡取出服務訂單的行項目

(4). 取product 的status

将step1取得的item guid 00163EA720001ED285EFF4706041A1B5傳入下表:

使用CDS view直接從資料庫表裡取出服務訂單的行項目

得到status code:

使用CDS view直接從資料庫表裡取出服務訂單的行項目