Ansicht
Dokumentation

ABENCDS_F1_LITERAL - CDS F1 LITERAL

ABENCDS_F1_LITERAL - CDS F1 LITERAL

General Data in Customer Master   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.
SAP E-Book

- literal

... $[#$|:domain.$]'character_literal'$|numeric_literal ...

Addition:

... #$|:domain.

Effect

Literal in a SELECT statement of a CDS view. It is either a character literal or a numeric literal:

  • A character literal 'character_literal' is a character string enclosed in quotation marks. If the character string consists exclusively of digits, the data type of the literal is NUMC. If this is not the case, the data type is CHAR. When activated, the length of the corresponding field in the database system is set to a size at least as large as the actual length of the literal. A character literal can have a maximum of 1333 characters.
  • A numeric literal numeric_literal is a series of digits between 0 and 9. It can be directly prefixed by a + or - sign and can contain a decimal point .) after the first digit. A numeric literal without a decimal point is handled as a field of the type INT1, INT2, INT4, or INT8, depending on the value. A numeric literal with a decimal point is floating point number of type FLTP. The value of a numeric literal cannot be greater than the value range of the valid types.

Literals can be used at all operand positions where this is documented.

Notes

  • 0.5 is a valid numeric literal, but .5 is not.
  • No byte-like literals are currently supported.
  • If specified, a literal prefixed with a sign is interpreted as an arithmetic expression and can be specified wherever it is permitted.
  • The built-in conversion function FLTP_TO_DEC can be used to convert literals with a decimal point to a packed number.

Example

The CDS view demonstrates various literals at operand positions.

@AbapCatalog.sqlViewName: 'CORP_SO_VW'
define view corp_sales_order as
  select from snwd_so
         association [1..1] to snwd_bpa as _partner
           on snwd_so.buyer_guid = _partner.node_key
         { key snwd_so.so_id as sales_order_id,
               snwd_so.buyer_guid,
               _partner.bp_id as corporation_id,
               _partner.company_name as corporation_name,
              'corporation' as legal_form,
             @Semantics.currencyCode
              'EUR' as currency_code,
             @Semantics.amount.currencyCode: 'currency_code'
               snwd_so.gross_amount as sales_order_gross_amount }
         where _partner.legal_form = 'Inc.' //Corporations only
           and snwd_so.currency_code = 'EUR'
           and snwd_so.gross_amount > 100000


Addition

... #$|:domain.

Effect

In certain operand positions, a literal can be prefixed with a name of a domain domain introduced using the character # or : and separated by a period (.). In this case, a check is made to verify whether the value of the literal is defined as a fixed value in the value range of the domain. If this is not the case or if the domain does not exist as an active domain, a syntax check warning occurs. Apart from this, the literal is handled like a regular literal.

A domain can be specified in front of a literal in the following operand positions:

Notes

  • In the case of character literals consisting only of letters, numbers, underscores (_), and slashes (/) and that start with a letter, underscore, or slash, the quotation marks can be omitted after the domain.
  • #domain.xXx has the same semantics as

  • #domain.'xXx'.

  • Numeric literals can only be checked using fixed values of numeric domains.
  • Currently, not all potential literal values can be represented as fixed values of domains. For example, a numeric domain can only have positive integers as fixed values and there are no fixed values for domains of type FLTP.

Example

Fixed value EXA of the domain ABDOCTYPE as the operand of the WHERE condition of a view.

AbapCatalog.sqlViewName: 'ABAPDOCTREE'
  define view abapdoc_tree as
  select from abapdocu_tree
         { * }
         where node_type = #ABDOCTYPE.'EXA';





ABAP Short Reference   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 8870 Date: 20240419 Time: 181825     sap01-206 ( 79 ms )