on 05-25-2009 1:15 PM
Hi,
It seems to be a simple problem..only that I can't find the answer :).
There is a loop in the smartform which is looping over an internal table.
Say there are 5 rows to be printed.
Now when there is a text i hv to print only if it is the first row of the table. For sub sequent rows, the text will not be printed.
I can do this by using a code element and set a flag the first time.. etc etc. But i want to know if there is any system variable (like sy-tabix) or any such thing which can tell me which iteration of the loop i am in, so that i can just set a condition on the text element and get it done.
My output would be like
row1- text 1 1 2 3 4
row2- ______ 6 7 8 9
row3- ______ 10 11 12 13
'text1' will be printed only on row1.
Thanks in advance.
follow karthiks reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Define a counter variable like (count) in the global definitions and then use that one in the loop by incrementing the variable for every loop pass.
But before using that variable in the loop make sure that u have initialsed that variable (count) to Zero.
And then depending upon the variables value u can write your coding as per your requirement.
Hope this will help you.
Regards,
Venkat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
SY-Tabix works fine within the loop in a smartform.
Do not use as a condition while looping.
But use it as a condition for the text node inside the loop.
Regards,
Ram
Edited by: Ramakrishna Peri on May 26, 2009 8:53 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In smart forms we can use sy-tabix. By considering sy-tabix in Table node you can display that text.
Put in conditions tab of Text node as sy-tabix = 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for your prompt replies. I tried capturing sy-tabix. It is not giving the desired value. I debugged the code and found that before the text element is getting painted, the tabix value goes through a lot of changes within the loop and looses its original value.
I'll try karthik's approach. I wanted to avoid coding :(. Wattodo. Unfortunate, sy-tabix is not working. Atleast there should be an sfsy-tabix don't u think .
>
> I wanted to avoid coding :(. Wattodo. Unfortunate, sy-tabix is not working. Atleast there should be an sfsy-tabix don't u think .
So Shall we append tabix to SFSY structure ? LOL
And writing code in smartform is not that much tougher, just declare a variable count of type int and initialize to 0. Then inside the program lines give count to the import and export parameter list. And write the following line;
Count = Count + 1.
Regards
Karthik D
Hi,
Your problem will be solved by using a counter variable. inside the loop create a program lines node and increment the counter by one at each pass, then give the counter in the condition.,
Regards
Karthik D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In smart forms we can use sy-tabix. By considering sy-tabix in Table node you can display that text.
Put in conditions tab of Text node as sy-tabix = 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
While passing the data to the itab, pass text1 to the field1 with the following--
loop at itab.
if sy-tabix = 1.
itab-field1 = 'text1'.
else.
itab-field2 = field2.
.
.
.
.
endif.
endloop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.