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

Loopping in an String array

Former Member
0 Likes
3,568

How to loop in a String array in ABAP?

5 REPLIES 5
Read only

Former Member
0 Likes
1,729

Hi,

I think you can do this way;

Do...

read dataset....

enddo.

Hope it works,

Thanks,

Sandeep.

Read only

Former Member
0 Likes
1,729

when you talk about loop....a loop is meant to traverse multiple entries....for example in a table...we can loop on rows...

what exactly do you mean by looping on a string array (As such there are no arrays in ABAP).

if you have multiple strings, you can put each string in an internal table and then loop through this internal table using the LOOP AT....ENDLOOP statements.

in case of a single string, you can traverse it using offsets

eg : STR+0(10) ---> which means start from position 0 and read 10 characters.

please clarify a bit more on your requirement.

Read only

Former Member
0 Likes
1,729

DATA : TEXT(50) VALUE 'TEST STRING',

LEN TYPE I,

POS TYPE I,

V_CHAR.

COMPUTE LEN = STRLEN( TEXT ).

DO LEN TIMES.

V_CHAR = TEXT+POS(1).

POS = POS + 1.

ENDDO.

HERE V-CHAR CONTAINS THE LETTRS OF THE STRING FOR EACH LOOP PASS.

REGARDS

SHIBA DUTTA

Read only

Former Member
0 Likes
1,729

i mean there's a inbulit data type sesf_string_tab which holds a list of strings and i want to loop through it

Read only

0 Likes
1,729

declare an internal table of type sesf_string_tab.

data itab type sesf_string_tab with header line.

loop at itab.

write:/ itab-string. "If string is a field in the structure sesf_string_tab

endloop.