cancel
Showing results for 
Search instead for 
Did you mean: 

SmartForm: Table or loop index (counter)

Former Member
0 Kudos

I need to know what the system field is for the counter inside a loop or table. I tried sy-tabix but that isn't recognized in SmartForms.

Regards,

Davis

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

How it is possible .....becuase when u pass your value into internal table of table or loop it maintain that data in workarea so how it is possible to maintain sy-tabix for that. Make one program lines and create one temp varible and process it as per your need.

i think that might be helpful ...Rewards points

Former Member
0 Kudos

Hi,

The solution given by Deb will resolve your problem. i.e. use variable & increase its value on each loop pass.

count = count + 1.

Ashvender

Former Member
0 Kudos

Dear Davis,

Smartforms does not recognize sy-tabix. The way out is to declare a variable say ,count of type int in the global declaration. in the loop after every iteration put a program line code where count = count + 1.By that way you can keep track of the item line number in a loop or table.

Regards,

Mallick

Former Member
0 Kudos

I was doing that but it wasn't solving my problem. Here is the situation:

I have a table node that pulls from two different internal tables. How can I loop through each table at the same time? I was going to loop through the main table in the table node then use the index (now a counter) as the loop criteria for the second internal table (in a loop node). I am not sure how to do that because there is no index that I can jump to inside the loop node. Is there a better way to do this?

Yes I know I could alter the structure of the internal table and combine the two but I want a quick and easy way to solve it in the smartform.

Regards,

Davis

Former Member
0 Kudos

Dear Davis,

I think the best way out is to declare a program lines node and join two tables.Make a single table and then loop it under main table. For that, we have to declare types in global declaration containing the fields of both the tables. Declare the table in global declaration. I think this is the easiest way out. Making it shorter than this might make things more complex. Otherwise you might pass the count variable in loop node and equate the serial number of this loop(sy-tabix) to the count variable in the where clause. See whether this works out or not.

Regards,

mallick

Former Member
0 Kudos

Debopriyo,

Thanks for that tip; I am not sure if that will work though. There aren't any like fields to join the two tables, only the table index. I think the best thing to do will be to create a new structure and combine the tables in the print program.

Davis