Application Development 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: 

Loopping in an String array

Former Member
0 Kudos

How to loop in a String array in ABAP?

5 REPLIES 5

Former Member
0 Kudos

Hi,

I think you can do this way;

Do...

read dataset....

enddo.

Hope it works,

Thanks,

Sandeep.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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.