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: 

Regarding conditional statement

Former Member
0 Kudos

Hello Everyone,

There is a field of more than 500 characters in internal table .

i need to read that table characterwise.

In a conditional statement ( do ) we need to assign the internal table field to a variable by character wise.

in each do loop we need to retrieve one character and store it in a field.

please do the need.

Thanks & regards,

Lakshmi.

4 REPLIES 4

Former Member
0 Kudos

Hi,

How about using OFFSET operations?



len = strlen( itab-fld ).
pos = 0.
do len times.
 
   <fld> = itab-fld+pos(1).
   ..... " Additional coding
   pos = pos + 1.
   
enddo.

Regards

Eswar

former_member156446
Active Contributor
0 Kudos

Hi check this


itab-text.          "<<<<<<<< the ffiel where you have the data

field-symbols: <fs> type any.

lv_len = strln(itab-text).

lv_buff = 0.

do lv_len times.

assign lv_buff to <fs>

lv_buff = lv_buff + 1.

<fs> = itab-text+lv_buff(lv_len).

enddo.

Former Member
0 Kudos

just an another way to handle

len = strlen( itab-fld ).

pos = 0.

data fld type c.

do len times.

fld = itab-fld( pos ).

..... " Additional coding

pos = pos + 1.

enddo.

Former Member
0 Kudos

use the following code

DATA: v_lengts TYPE i,

v_var1 TYPE c,

v_var2 TYPE i VALUE 0,

v_var3 TYPE i VALUE 1,

BEGIN OF itab OCCURS 0,

len(500) TYPE c,

END OF itab.

LOOP AT itab.

v_lengts = STRLEN( itab-len ).

DO v_lengts TIMES.

v_var1 = itab-len+v_var2(v_var3).

v_var2 = v_var2 + 1.

ENDDO.

ENDLOOP.