on 11-23-2015 11:38 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eswari,
Following is the example for parameter setting:
It defines the end of the loop and must be used together with the DO keyword which defines where the loop starts.
The following scripts was created for transaction VA02 (Change Sales Order) to add shipping information for each line item of an existing sales order.
With DO Keyword the loop starts and the counter is set to ‘1’.
To be able address the row number starting at ‘0’ we take the counter number minus ‘1’ using the CBTA_A_SETINEXECUTIONCTXT component.
Then the scripts reads the value of the first row in the first column to check if an entry exists.
If the value is empty we exit the loop with the EXIT_DO keyword.
Otherwise the scripts performs the required actions for the current row
With the LOOP keyword the script goes back to the DO keyword while increasing the counter and processing further line items of that sales order.
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!
Hi Eswari,
the following keywords are the ones used to define loops and iterations.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eswari,
The following keywords are the ones used to iterate when the number of iterations is known in advance.
you can access the documentation in SAP-SCN:
Kind regards,
Christoph
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.