cancel
Showing results for 
Search instead for 
Did you mean: 

Doubt in smartform

Former Member
0 Kudos

Hi Experts,

I am creating table in my smart form. The table contains seven columns in the first column I need to populate number value from 1 to 30 (30 is the max that is fixed) and remaining columns I need to show in blank. Already I have defined the table with seven fields for example

Number code weight ……………………………………………..

In the first column I need to display the numbers from 1 to 30 for example

1

2

3

4

5

.

.

.

.

30

So please tell me where I need to provide loop exactly and what variables or internal tables I can use for this. If possible please send me the sample logic. And one more doubt is after each row I need to draw one horizontal line I mean just like table model. Please help me it is very urgent. I will give the points.

Thanks a lot.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

By the way, if you use latest version of SmartForm (maybe from ECC5), there is a tab named Calculations in Table node. This tab allows you to number rows automatically, without coding. Here is instruction

<b>Operation:</b> Number

<b>Target Field Name:</b> a_variable_type_i_defined_in_Global_Definitions

<b>Event:</b> Before Loop

<b>Initialization: </b>checked

(text in bold is name of column)

Former Member
0 Kudos

If you have already have the internal table like you said.

In smartforms you just create a table element

then set the internal table and his structure to table element's DATA atrribution

then in TABLE atrribution ,set his box

it will automatically loop.

Former Member
0 Kudos

Hi,

Just write a program line in the table where you declare a variable and increase the count.

Display this variable in first cell. As we loop the table it will increment and

print the values.

If you want lines after each row you need to select the patterns provided

in the Table node

Reward if useful......

amit_khare
Active Contributor
0 Kudos

Are you going to Use TABLE/TEMPLATE for display.

If tables looping will handle by it then otherwise for TEMPLATE you need to add LOOP node.

As for numbers in first row.

You need to add a Program Lines node before calling Loop/TABLE Node.

there write this code .

loop at itab.

v_count = v_count + 1.

itab-fld1 = v_count.

modify itab index sy-index transporting fld1.

endloop.

Assuming itab already contain the required data in other fields.

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

Hi Amit,

Thanks a lot for your reply but in my case I don’t have internal table with data. So how can I loop and modify internal table?

Thanks.

Former Member
0 Kudos

if you have not internal table you can not use loop function in smartform,so you can create an internal table in Global SettingGlobal Definitionsinitialization

according to amit's source code