Annotation @Environment.systemField

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

@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.

image.png

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.

data: lt_result TYPE TABLE OF Zproductdescription.

SELECT * FROM Zproductdescription INTO TABLE @lt_result .

image.png

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

image.png

相关文章
|
Java 数据库连接 mybatis
Consider defining a bean of type ‘com.example.democrud.democurd.usermapper.DaoMapper‘ in your config
Consider defining a bean of type ‘com.example.democrud.democurd.usermapper.DaoMapper‘ in your config
190 0
|
NoSQL Redis
Consider defining a bean of type ‘com.bsj.system.service.RedisService‘ in your configuration
Consider defining a bean of type ‘com.bsj.system.service.RedisService‘ in your configuration
556 0
|
2月前
|
Java Nacos 微服务
JSR-330 ‘javax.inject.Inject‘ annotation found and supported for autowiring
这篇文章讨论了在Spring Boot项目中遇到的JSR-330 `javax.inject.Inject`注解相关问题,以及如何解决因版本不兼容导致服务注册失败的问题。
|
5月前
[已解决]llegal target for variable annotation
[已解决]llegal target for variable annotation
50 1
|
Java Maven Spring
4. 成功解决:Spring Boot Configuration Annotation Processor not configured
在 Spring Boot 项目中,添加一个配置文件时,会提示“Spring Boot Configuration Annotation Processor not configured”
1716 0
|
druid
A bean with that name has already been defined in class path resource and overriding is disabled.
A bean with that name has already been defined in class path resource and overriding is disabled.
209 0
|
Java Spring
Spring Boot Configuration Annotation Processor not configured
Spring Boot Configuration Annotation Processor not configured
448 0
|
XML Java 数据格式
JavaConfig与常见Annotation(必知必会系列)
上一篇我们介绍了 Spring中Bean的生命周期,这一篇我们接着学习在Spring Boot中的一些常用注解。
156 0
JavaConfig与常见Annotation(必知必会系列)
Annotation @Environment.systemField
Annotation @Environment.systemField
Annotation @Environment.systemField
|
Java Spring
Regarding @Inject annotation
Regarding @Inject annotation
Regarding @Inject annotation