cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform - table

0 Kudos

Hi ABAP Gurus,

I am new in ABAP, and I am creating a Smartform.

I want to create a Smartform with a table with a fixed number of rows 20, and my internal table will have a random number of rows but it does not exceeds 20 rows.

The thing is if I use a table the Smartform automatically sets the number of rows, so this don't work. How can I solve this issue?

I now it can be done on Sapscript, but I am not realy into it.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member303542
Participant
0 Kudos

Hello ,

as per my understanding of your requirement ,U say that your internal table would have more than 20 rows ,However u want to print only 20 rows per page.

Confirm me this is the requirement or are you looking out for something else.

Thanks,

M.Naveen Kumar.

0 Kudos

Lets say it like this. My Internal table will never have more than 20 rows.

Example, my internal table has 6 row. I also want a box to appear with 20 rows.

In that box only the first 6 rows will be filled (with data from my internal table) and the remaining will be left empty.

former_member303542
Participant
0 Kudos

Hello ,

You can achieve the solution though coding .

As you say your internal table at any cost would not have more than

20 rows , code the programming logic before passing the internal table for display in table as below:-

1.Describe the internal table to fetch how many data records are there in the internal table as of now.

2.Once you get the count take the difference with 20 then you get the number of rows which are remaining.

3.loop the main internal table and then inside the loop ,perform a do loop number of times which is the difference of 20 .

and append empty records to the main internal table .

In this way you get 20 record internal table,

The code could be something like below:-

if difference is stored in n and n has a value of 12 .

then append 12 empty records to the same table.

Loop at itab into wa_itab.

do n times

clear wa_itab.

append wa_itab to itab

enddo.

if sy-subrc is success then exit.

endloop.

Thanks ,

M.Naveen Kumar

0 Kudos

Thank you, it worked just fine.

Answers (1)

Answers (1)

Former Member
0 Kudos

This message was moderated.

0 Kudos

But if I do so, template with a loop, what will happen is that 20 templates will be printed.

Unfortunately it does not solve my problem.