Programming
Date Operation in ABAP/4
The date variable in ABAP/4 have format "YYYYMMDD". If you want to get no. of year, month or day for the date, you can offset this variable.
Example
DATA: lv_date TYPE D VALUE sy-datum, "20050312
lv_year(4),
lv_month(2),
lv_day(2).
lv_year = lv_date(4). "2005
lv_month = lv_date+4(2). "03
lv_day = lv_date+6(2). "12
If you want to find next n day of the date, you can apply opration sign ’+’ to this point.
Example
- thitima's blog
- 1 comment
- Read more
- 1846 reads
How to converts string number into integer without leading zeroes in ABAP/4
We can apply function module "CONVERSION_EXIT_ALPHA_OUTPUT’ to convert string number to integer without leading zeroes.
Example
DATA: lv_number TYPE I,
lv_string(10) TYPE C VALUE ’0000000012’.
CALL FUNCTION ’CONVERSION_EXIT_ALPHA_OUTPUT’
EXPORTING
INPUT = lv_string
IMPORTING
OUTPUT = lv_number
.
- thitima's blog
- Add new comment
- Read more
- 16556 reads
How to converts number into string with leading zeroes in ABAP/4
We can apply function module "CONVERSION_EXIT_ALPHA_INPUT’ to convert number into string with leading zeroes.
Example
DATA: lv_number TYPE I VALUE 12,
lv_string(10) TYPE C.
CALL FUNCTION ’CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
INPUT = lv_number
IMPORTING
OUTPUT = lv_string
.
- thitima's blog
- Add new comment
- Read more
- 4272 reads
How to read data from application server to internal table in ABAP/4
Normally, when you want to read the file from application server, you will have 5 steps:
- Open file in application server by statement:
OPEN DATASET file_name FOR INPUT IN TEXT MODE.
- Checking the file is opened sucessfully by SY-SUBRC = 0
- After checking, you can read data from file by statement:
READ DATASET file_name INTO itab.
Note: This statement should be in DO statement - Append data to internal table
- Close file by statement:
CLOSE DATASET file_name
Example
- thitima's blog
- 1 comment
- Read more
- 10748 reads
How to transfer data from internal table to application server in ABAP/4
Normally, when you want to transfer data the file to application server, you will
have 3 steps:
-
Open file in application server by statement:
OPEN DATASET file_name FOR OUTPUT IN TEXT MODE.
-
Transfer data from file by statement:
TRANSFER itab TO file_name.
Note: This statement should be in LOOP statement for Internal table -
Close file by statement:
CLOSE DATASET file_name.
Example
- thitima's blog
- Add new comment
- Read more
- 1664 reads
How to apply function module 'DATE_COMPUTE_DAY' in ABAP/4
The function module "DATE_COMPUTE_DAY" will return the day by 1...7 when you input date. If the date have day:
- Monday : System will return value = 1
- Tuesday : System will return value = 2
- Wednesday : System will return value = 3
- Thursday : System will return value = 4
- Friday : System will return value = 5
- Saturday : System will return value = 6
- Sunday : System will return value = 7
Example
CALL FUNCTION ’DATE_COMPUTE_DAY’
EXPORTING
date = l_date1
IMPORTING
DAY = l_day. "Return Value
- thitima's blog
- Add new comment
- Read more
- 2907 reads
Recent comments
3 years 34 weeks ago
3 years 39 weeks ago
3 years 39 weeks ago
3 years 40 weeks ago
3 years 40 weeks ago
3 years 42 weeks ago
3 years 42 weeks ago
3 years 42 weeks ago
3 years 43 weeks ago
3 years 43 weeks ago