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
DATA: BEGIN OF i_tab OCCURS 0,
text(100),
END OF i_tab,
gv_dataset1(30) VALUE ’/temp/testfile.txt’.
OPEN DATASET gv_dataset1 FOR INPUT IN TEXT MODE.
DO.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
READ DATASET gv_dataset1 INTO i_tab.
APPEND i_tab.
CLEAR i_tab.
ENDDO.
CLOSE DATASET gv_dataset1.
- thitima's blog
- 11137 reads
how to get the data form BW to R/3.
Post new comment