2010 Apr 28 6:55 AM
DATA: fname TYPE rlgrap-filename value '.\SUBSTANC11111111.TXT',
wa_tab1 TYPE t_tab1,
it_tab1 TYPE TABLE OF t_tab1.
OPEN DATASET FNAME FOR INPUT in TEXT MODE ENCODING DEFAULT.
do.
IF SY-SUBRC = 0.
write 'opened'.
read dataset fname into wa_tab1.
APPEND wa_tab1 to it_tab1.
ELSE.
exit.
ENDIF.
ENDDO.
close DATASET fname.
2010 Apr 28 7:57 AM
Hello,
I think the problem is with the file path you are giving.
Check the subrc value after OPEN DATASET.
Useful answer must be rewarded and the solution has to be posted.
2010 Apr 28 7:02 AM
Try this alternate solution. Instead of directly reading to internal table, read the to the string and then move to internal table.
data : l_string type string.
read dataset fname into l_string.
move the data from l_string to wa_itab1 and then Append to It_tab1Regards
Vinod
2010 Apr 28 7:02 AM
I guess the problem is with the sy-subrc check done for the open datset statement. Instead check it for read dataset statement and check
2010 Apr 28 7:57 AM
Hello,
I think the problem is with the file path you are giving.
Check the subrc value after OPEN DATASET.
2010 Apr 28 8:06 AM
2010 Apr 28 8:23 AM
Welocme to SDN Network.
Always using subrc check after read statement is a good practice. Change your code like this and check.
do.
write 'opened'.
read dataset fname into wa_tab1.
IF SY-SUBRC = 0.
APPEND wa_tab1 to it_tab1.
endif.
ELSE.
exit.
ENDDO.
Regards
VEnk@
2010 Apr 28 10:56 AM
2010 Apr 28 10:59 AM
2010 Apr 28 11:21 AM
Useful answer must be rewarded and the solution has to be posted.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |