Skip to Content
avatar image
Former Member

how to use the FOR/NEXT loop and its parameters

hi all,

Can anyone tell me how to use the for loop condition in cbta and how to give the parameters values to repeat the steps for 'n' number of times usng the loop.

Regards,

Eswari

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Nov 30, 2015 at 08:55 PM

    Hi Eswari,

    the following keywords are the ones used to define loops and iterations.

    • DO 
    • LOOP 
    • EXIT_DO

    If you want to have {n}-times execution, please use :

    "DO"

    ...

    "EXITDO"

    ...

    "LOOP" in your CBTA script.

    DO defines a counterparameter : "MYCOUNTER" and starts the structure.

    EXITDO has a 3 parameters for defining a condition:

    <LEFTVALUE> <OPERAND> <RIGHTVALUE>:

    e.g.:

    %MYCOUNTER% > 5 (n - times)


    LOOP is the ending command for the structure.


    Kind regards,

    Christoph


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 04, 2015 at 10:16 AM

    hi Venkata,

    thanks for the reply. Now I tried with the FOR LOOP and it looks like we are able to do the for loop and the looping is working in the same row, but we want that loop to work for the next n number of lines also.

    For eg: In the above screenshot, we are have used the for loop to iterate for 2 times but its iterating at the same row as shown below (this is the VA01 tcodes) and we want to repeat the materiel  for the 2 I

    times or say as create 3 materials on the whole in the single Sales order . Please let me know to make it create the material for 3 times in 1 ssales order.

    Reagrds,

    Eswari

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Eswari,

      I hope you are able to use for loop but now the issue is that it is iterating for the same row.

      So there will be a default component which is specifying values in row.In URI of that component (CBTA_GUI_SETTEXT) you will see row number related field, you need to specify the variable of current row instead of that fixed row number.

      So every time row number will be different based on your current row.

      If "CBTA_GUI_SETTEXT" does not have row number in URI, you need you different default components like "SetCellData" which has row number as input inside FOR loop.

      Hope this works for you!