前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Annotation @Environment.systemField

Annotation @Environment.systemField

作者头像
Jerry Wang
发布2019-08-23 15:00:40
4550
发布2019-08-23 15:00:40
举报

The below view declares two argument langauge and system user. The view is used to retrieve product id with description via inner join.

代码语言:javascript
复制
@AbapCatalog.sqlViewName: 'zprdtext'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Jerry product description'
define view Zproductdescription
with parameters
    @Consumption.hidden: true
    @Environment.systemField: #SYSTEM_LANGUAGE
    P_Language              : syLangu,

    @Consumption.hidden: true
    @Environment.systemField : #USER
    p_uname : syst_uname  


as select from comm_product as product inner join comm_prshtext as _text
on product.product_guid = _text.product_guid {
   key product.product_id,
   product.product_type,
   _text.short_text as description
} where product.upname = :p_uname and _text.langu = :p_Language

When we locally preview the view, we are asked to provide the value for these two argument.

In productive use, it is this @Environment.systemField annotation which takes effect. In open SQL we do not need to explicitly pass value to these two parameters. See following ABAP code: all products created by Jerry are fetched, although no parameter for user name is passed.

代码语言:javascript
复制
data: lt_result TYPE TABLE OF Zproductdescription.

SELECT * FROM Zproductdescription INTO TABLE @lt_result .

You can verify via ST05 that ABAP runtime automatically fills these two parameter for you:

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年08月22日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档