cancel
Showing results for 
Search instead for 
Did you mean: 

How to protect a text from line break in smartforms

former_member224444
Participant
0 Kudos

Hi Gurus,

How to protect line break in a text element of smartforms. Text in that line is printing exactly 70 characters. I want the text to be printed fully till the size of the window. How to stop this automatic line break.

Regards,

Rithika.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

What I have done may be helpful, so here are the details:

I had a table of text values, so I converted this to a string with concatenate, then string to a long character field, then used RKD_WORD_WRAP to put into table of 132 characters. Then I constructed a table of type tline by looping at my RKD_WORD_WRAP output, and utilized SAVE_TEXT to temporarily store a TEXT entry, like you would save with SO10, saving my desired paragraph format into TDFORMAT field and inserting any necessary character format commands into the text.

In my SmartForm, I then have dynamic text processing pointing to the internal table fieldnames containing tdname, tdid, tdobject, tdspras of what I saved. This allows SmartForms to utilize the full width of the window and optimize text output, based on window width, font, scale, paragraph format, character format, etc. These text identifier values are passed as part of my internal table via the SmartForms interface.

At the end of SmartForms processing, I loop at my internal table and utilize DELETE_TEXT to remove the temporary texts that I created for this set of output.

To avoid page breaks in my text, I put my output for a "block" of data into a folder (see the SmartForms folder feature). I have page protection on the folder...that way, SmartForms examines the length of the folder content and decides whether a page break should occur before any output for my block of data begins. My block of data contains a few data elements over 5 rows of output followed by two separate dynamic texts of various lengths. If the entire block won't fit on the remaining part of a page, page-break occurs first.

Former Member
0 Kudos

Hi,

Include your text between protect and endprotect.

Best regards.

Aswath

former_member224444
Participant
0 Kudos

Hi ,

I have given Protect-Endprotect in command line of text editor and i have given my text between this. Still only 70 characters are printing in a line.

Regards

Rithika

bruno_esperanca
Contributor
0 Kudos

Hi all,

PROTECT/ENDPROTECT stops the text from being printed in separate pages.

From what I understand the OP wants the text to be printed in only one line and if it exceeds the space just be truncated. Is this correct?

I have done something like this but in a very "unorthodox" way... Basically I checked if the text that was going to be printed was longer than a certain number of characters, and if it was I would change it to something like 'ABCDE...'

Hope this helps.

Bruno

former_member206394
Active Participant
0 Kudos

This message was moderated.

former_member224444
Participant
0 Kudos

Hi,

Protect-Endprotect is used in case of page break rite. My case is am printing the header text content from PO. Am looping the internal table which contains this text and printing each line of header text using work area. But it is only printing 70 characters per line. I want to print the text more than that, because of this issue lot of empty space is coming.

Regards

Rithika

bruno_esperanca
Contributor
0 Kudos

Hi again,

So you want more characters per line? Smaller font size is not an option?

former_member224444
Participant
0 Kudos

No we should not reduce the font size. Actually there is lot space in that line but still its printing only 70 characters in that line.

I don't know why its applying line break after 70 characters. I should not get empty space in that line it should be printed till the border of the window. I also checked the length of the workarea field its 132 char lenght. what will be the problem.

former_member206394
Active Participant
0 Kudos

To my knowledge, it can be protected from page break but not rather from line break.. To protect the line break, adjust the width of the window within the page width limits so that the count of the characters would be increased. PROTECTION can be made within the page breaks.

former_member205763
Active Contributor
0 Kudos

after 70 characters does you text move to next line? or doesnt print at all?

well a silly question but does your variable have appropriate datatype to accomodate more than 70 chars?

Former Member
0 Kudos

I don't use a variable to contain the text...I use variables to point to where I have the text stored..... I have an element type as "INCLUDE TEXT" and my values contain &GT_DATA-TDNAME&, &GT_DATA-TDID& etc. SmartForms then figures out how to lay down the rows of text that are retrieved based on the TDNAME, TDID, TDOBJECT, TDSPRAS, etc.

It sounds like you're trying to manage text output via a variable, rather than letting SmartForms handle the text as it was designed to do?

Always let SmartForms (or SAPScript) manage text output, where possible. I would use a variable containing text only when I had one specific value of a certain length, e.g., I want only one row of output containing up to x number of characters, essentially just another table-fieldname in the output.

Former Member
0 Kudos

Hi Rithika,

In the general attributes of the Text element where you are printing PO text, select append directly option for the field start.

It will print your text in same line till size of the window.

Regards,

Karuna N

Former Member
0 Kudos

Hi friend,

I think already other friends have given a lot of information

Let me add a few of my opinion to it.

Just check whether there is space after the 70 character of the text.

Or see whether the window size can hold only up to 70 characters of text.

Try to increase the size of variable into which you are getting or declare it as string and process it.

I think this will solve your problem. If you face issues please revert back to us we will help you.

Thanks,

Sri Hari

Former Member
0 Kudos

Hi,

According to my knoledge you are trying to display text that has stored in s010 using dynmaic text screen......because you are using loop to write text header it is not comming properly....try to use READ_TEXT function module,pass the TEXT ID ,TEXT NAME to FM before calling smartform in print program might will give correct output.....

Thank you....