Novice self-taught ABAP (1)--Data type

Source: Internet
Author: User

One, the data statement

1.TYPE TYPE

Ex: You can declare multiple variables with a colon.

  DATA: gv_num1 TYPE I,

Gv_num2 TYPE I.

2.LIKE Num (num can be a variable of any data type-field, parameter, struct, system variable, etc.)

Ex

  DATA: gv_num3 like Gv_num1.

3.VALUE int

If you use the value is initial statement, the initial value of the variable is the initial value of the referenced data type.

However, when defining a fixed value, be sure to define its initial value using the value statement.

DATA: gv_num TYPE i value 123,

Gv_flag value ' X ',

Gv_val Value is initial,

Gv_idx like Sy-tabix value 45.

4LRNGTH N

Used to specify the field length, but only for C, N, P, x types

DATA: gv_num TYPE n LENGTH 2.

5.DECIMALS N

Decimals n is used to specify 1~14 decimal places only for data type P

DATA: gv_num TYPE P decimals 3.

Novice self-taught ABAP (1)--Data type

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.