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

DO_WHILE_VARY_NOT_IN_RANGE, run time error

Former Member
0 Likes
608

Hi All,

Thank you for viewing this post. I am working for an upgrade project (4.6 C to ECC. 6).

I am facing a run time error in the following statement. As a part of upgrade I have changed the statement to the following.

DO 12 TIMES VARYING lv_wog FROM <fs1> NEXT <fs2> range i_cosp.

DATA : i_cosp TYPE STANDARD TABLE OF t_cosp WITH HEADER LINE.

FIELD-SYMBOLS: <fs1> TYPE ANY,

<fs2> TYPE ANY.

Previously, the statement was :

DO 12 TIMES VARYING lv_wog FROM <fs1> NEXT <fs2>.

can you pls give me suggestion regarding this post as soon as possible.

Thanks

Sam.

3 REPLIES 3
Read only

Former Member
0 Likes
539

DO VARYING is obsolete in ECC 6.0 , Alternate logic will be with the field symbols.

data: lv_fname(30), lv_index(2) type n.
field-symbols: <fs> type any.

loop at it_cosp into ls_cosp.
lv_index = 1.
DO.

CONCATENATE 'WTG0' lv_index into lv_fname.
assign component lv_fname of structure ls_cosp to <fs>.
if sy-subrc eq 0.
 " <fs> hold the value 
else.
 exit.
endif.
lv_index = lv_index + 1.
ENDDO.
endloop.

Note:

Don't use ASAP here, if it is really argent log a OSS message.

Read only

0 Likes
539

Hi Vijay,

Thanks for the quick reply. I am little weak in field symbols.

fs1 and fs2 are two different field symbols which are defined as type any.

In debugging mode I found that fs1 has value of 55.06- and fs2 has 0.

and lv_ctr has value of 12, and lv_wog has value of 0.

DATA: lv_ctr(2) TYPE n VALUE 0,

lv_wog LIKE i_cosp-wog001

DATA : i_cosp TYPE STANDARD TABLE OF t_cosp WITH HEADER LINE.

TYPES : BEGIN OF t_cosp,

objnr LIKE cosp-objnr,

gjahr LIKE cosp-gjahr,

wrttp LIKE cosp-wrttp,

versn LIKE cosp-versn,

kstar LIKE cosp-kstar,

beknz LIKE cosp-beknz,

perbl LIKE cosp-perbl,

twaer LIKE cosp-twaer,

wog001 LIKE cosp-wog001,

wog002 LIKE cosp-wog002,

wog003 LIKE cosp-wog003,

wog004 LIKE cosp-wog004,

wog005 LIKE cosp-wog005,

wog006 LIKE cosp-wog006,

wog007 LIKE cosp-wog007,

wog008 LIKE cosp-wog008,

wog009 LIKE cosp-wog009,

wog010 LIKE cosp-wog010,

wog011 LIKE cosp-wog011,

wog012 LIKE cosp-wog012,

timestmp LIKE cosp-timestmp.

TYPES : END OF t_cosp.

I_cosp is having 0 value in it.

I think the problem lies with this i_cosp as it no value in it.

Please suggest.

I used ASAP as this is high priority issue.

Thanks

sam

Read only

0 Likes
539

But not able to understand your problem..?

if there is no value in i_cosp then you will see all zeros.

where is your data population logic..?