‎2009 Apr 01 1:34 PM
hi,
i have an internal table it_content (it_content type standard table of sdokcntbin)
the lines in this are type raw.
I read a file from the appln server in binary mode and build this table .
I need to know the total length of this table . How do i get the total length of the table contents?
‎2009 Apr 01 2:21 PM
Hi,
When you declare your internal table, its row type is fixed (here RAW type).
Determining the table's content size is probably not impossible, but somewhat difficult and is not effective.
I guess your goal is to get total size of read file. For this count the bytes while reading the file.
DATA: itab TYPE TABLE OF sdokcntbin WITH HEADER LINE.
DATA: file TYPE rlgrap-filename VALUE '/some_application_server_file.txt',
curr_bytes TYPE i,
tot_bytes TYPE i.
OPEN DATASET file FOR INPUT IN BINARY MODE.
IF sy-subrc = 0.
DO.
READ DATASET file INTO itab ACTUAL LENGTH curr_bytes. "when reading the file obtain read bytes
IF sy-subrc <> 0.
EXIT.
ELSE.
APPEND itab.
ADD curr_bytes TO tot_bytes. "...and count them all
ENDIF.
ENDDO.
"all data read in one shot
IF curr_bytes <> 0.
APPEND itab.
ADD curr_bytes TO tot_bytes.
ENDIF.
WRITE: 'In table there are ', tot_bytes, ' bytes'.
CLOSE DATASET file.
ENDIF.
Regards
Marcin
‎2009 Apr 01 2:40 PM
to check the no of records in the table
use:
data: n type i .
Describe table Itab lines n.
and check the system variable.
sy-tfill and sy-tleng.
Regds
Sachhi
‎2009 Apr 02 11:09 AM