Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

where condition error when loop through a C itab

former_member625844
Participant
0 Likes
1,015

I wrote below code.

DATA:kstar_t TYPE STANDARD TABLE OF kstar .

LOOP AT kstar_t TRANSPORTING NO FIELDS WHERE kstar <= '89999999' AND kstar >= '8000000' .

ENDLOOP.

I want to check in table kstar_t whether exist data in some range. But it has error "kstar has no structure so do not have a component kstar". So what's the correct way to loop where in a single field table? Thx.

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
978

You have 2 types of internal tables, those with lines which are structures containing components (field names), and those without component -> usually the "pseudo-component" TABLE_LINE can address the whole line:

DATA:kstar_t TYPE STANDARD TABLE OF kstar .

LOOP AT kstar_t TRANSPORTING NO FIELDS WHERE table_line <= '89999999' AND table_line >= '8000000'.

ENDLOOP.
2 REPLIES 2
Read only

Sandra_Rossi
Active Contributor
979

You have 2 types of internal tables, those with lines which are structures containing components (field names), and those without component -> usually the "pseudo-component" TABLE_LINE can address the whole line:

DATA:kstar_t TYPE STANDARD TABLE OF kstar .

LOOP AT kstar_t TRANSPORTING NO FIELDS WHERE table_line <= '89999999' AND table_line >= '8000000'.

ENDLOOP.
Read only

thkolz
Contributor
0 Likes
978

You need to create a proper table type:

TYPES:
BEGIN OF ty_kstar,
kstar TYPE kstar,
END OF ty_kstar.

TYPES:
tt_kstar TYPE STANDARD TABLE OF ty_kstar.

DATA:
t_kstar TYPE tt_kstar.

*...

LOOP AT t_kstar INTO DATA(s_kstar) WHERE kstar BETWEEN '8000000' AND '89999999'.
* Do something.
ENDLOOP.