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

explain me please

Former Member
0 Likes
479

i ahve a doubt regarding the following line of code....please anyone explain me the same.

"""do 10 times varying it1-f1 from alpha0 next alpha1""".

when i am using this statement in program...what function actually it does.

4 REPLIES 4
Read only

Former Member
0 Likes
462

Hi,

In the Do loop in will fetch the all fields data one after the other starting from first field to Last field by incrementing one field.

Generally in FI data fetching and in HR wage Types data fetching we use this type of commands.

regards,

Anji

Read only

Former Member
0 Likes
462

Hi Arnab,

here, in the DO loop we are fetching 10 records starting from f1 and varying it by one record as per the stmt. :

<b>varying it1-f1 from alpha0 next alpha1</b>

So here, 10 records one by one are fetched into the internal table <b>IT1</b>.

Hope this resolves your query.

Reward all the helpful answers.

Regards

Read only

Former Member
0 Likes
462

Hi!

......VARYING dobj FROM dobj1 NEXT dobj2.

The addition VARYING assigns a new value at every loop pass to a variable dobj. This addition can be used several times in a DO-statement.

dobj1 and dobj2 are the first two in a sequence of data objects, which have the same distance from each other in the memory. The data type of the data objects dobj, dobj1 and dobj2 has to be flat.

In the first loop pass, the content of dobj1 is assigned to data object dobj, whereas in the second loop pass, the content of data object dobj2 is assigned to dobj. In the following loop passes, dobj gets the content of the data object, which has the same distance in the memory to the prior data object, like dobj2 to dobj1. There is no type conversion during this process.

Reward if useful.

Regards,

Neha Bansal

Read only

Former Member
0 Likes
462

HI...

Check this example..

DATA: BEGIN OF text,

word1(4) TYPE c VALUE 'This',

word2(4) TYPE c VALUE 'is',

word3(4) TYPE c VALUE 'a',

word4(4) TYPE c VALUE 'loop',

END OF text.

DATA: string1(4) TYPE c, string2(4) TYPE c.

DO 4 TIMES VARYING string1 FROM text-word1 NEXT text-word2.

WRITE string1.

IF string1 = 'is'.

string1 = 'was'.

ENDIF.

ENDDO.

Thanks