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

using loops & varying condition...

sudhir_uppalapati
Participant
0 Likes
710

Using Loops and varying condition try and get this output. Output: -


Sales Order Number----

6 REPLIES 6
Read only

Former Member
0 Likes
684

Can you please let me know the question ...

Read only

0 Likes
684

Using Loops and varying condition try and get this output. Output: -


Sales Order Number----

Read only

0 Likes
684

pls explain what you want. We are dummies.

Read only

0 Likes
684

jus using LOOPS and VARYING condition i want the output as -


sales order document-----

Read only

0 Likes
684

Hi,

Why do you want to use LOOP for outputting -


sales order document----- ?

you could also use WRITE '---sales order document--- '.

Regards,

Hakim

Mark all useful answers....

Read only

0 Likes
684

OK, get serious: Possibly you are into a do loop. A quick search of this forum (only real experts know how to do) gave this example (courtesy vasanth M)

... VARYING f FROM f1 NEXT f2

Effect

This addition is useful if you have a series of fields of the same type and the same distance from each other.

f is a variable which you define in a DATA statement. On each loop pass, f contains a new value. The field f1 after "FROM" specifies the first value of the variable f, while the field f2 after "NEXT" specifies the value to be assigned to the variable f in the second pass. For each subsequent pass, the variable f contains the next value in the sequence determined by the distance between the fields f, f1 and f2 in memory.

The fields f1 and f2 should be type-compatible and convertible to f.

If the value of f changes during the loop pass, the new value is then placed in the appropriate field fn assigned to f (transfer type: pass by value and result). If the loop pass terminates because of a dialog message, the new value is not passed back if f changes.

The addition ... VARYING f FROM f1 NEXT f2 can be used several times in a DO statement.

Example

DATA: BEGIN OF WORD,

ONE VALUE 'E',

TWO VALUE 'x',

THREE VALUE 'a',

FOUR VALUE 'm',

FIVE VALUE 'p',

SIX VALUE 'l',

SEVEN VALUE 'e',

EIGHT VALUE '!',

END OF WORD,

LETTER1, LETTER2.

DO VARYING LETTER1 FROM WORD-ONE NEXT WORD-THREE

VARYING LETTER2 FROM WORD-TWO NEXT WORD-FOUR.

WRITE: LETTER1, LETTER2.

IF LETTER2 = '!'.

EXIT.

ENDIF.

ENDDO.

The resulting output is the character string

"E x a m p l e !".

Regards,

Clemsn