cancel
Showing results for 
Search instead for 
Did you mean: 

How can I have dynamic count of lines in smartforms table field?

Former Member
0 Kudos

Hello,

I'm very new in developing smartforms, so please excuse if it's a silly question.

I created a table form in smartforms listing all entries of an article database as an internal table.

(Loop operand t_table into ls_table.)

Inside of one table field I want to list the article name and that's my problem the article description.

The problem is that there could exist unlimited description lines, but also no one.

Of course I only want to list the existing ones one per line.

I get the descriptions calling the function READ_TEXT and the information is stored in ls_txttab from type LTY_TXTTAB.

I tried to list the information by using the following code snippet.

LOOP AT ls_txttab INTO lf_text_zz.

concatenate lf_text_gz

CL_ABAP_CHAR_UTILITIES=>NEWLINE

lf_text_zz

into lf_text_gz.

ENDLOOP.

But smartforms ignores the newline char and just displays a '#' instead.

Do you have any idea how I can solve this?

I'd greatly appreciate your help.

Knud

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Knud,

If Smartform is not accepting the new-line character, then you can just concatenate space with your dynamic text.

say for e.g. if your description field space on smartform can accomodate maximum say 80 characters and your dynamic text holds 40 characters, then you need to concatenate remaining 40 characters as space to your dynamic text, so that, first charcter of new text will print on next line.

also , I found one thread similar to your issue, pls have a look. It might be helpful,

Former Member
0 Kudos

Hey, this would be a great idea, but unfortunately, this only works for proportional fonts and I can't use this type of font.

Do you have any other idea?

I tried to use the include-text method but didn't get any results (just empty lines).

nabheetscn
Active Contributor
0 Kudos

As you are already using table in main window inside you cell just put a loop and print the lines it will accomodate. The space automAtically...i hope i got your requirements correctly if not can you please quote it again

Former Member
0 Kudos

Hi Knud,

In that case, you can simply display within loop only.

In ur code,

LOOP AT ls_txttab INTO lf_text_zz.

concatenate lf_text_gz

CL_ABAP_CHAR_UTILITIES=>NEWLINE

lf_text_zz

into lf_text_gz.

ENDLOOP.

Here, instead of concatenating and then printing it separately, u can print d current text, (lf_text_zz) within loop under a table line.

Here, u have to take care of table line design, as to under which cell u want to print it.