Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Free text from 1 to n pages in SAP-Script ?

Former Member
0 Kudos

Hi,

I have started working on SAPScript (kind of newbie).

On the form on which I am working there are two different free text1 and free text2.

The rough layout of the form is as below.

-


Some fields which will get populated with some data

-


Free text1

-


Some fields here which will get populated with data

-


Free text2

-


Some fields which will get populated with data

-


Now both of these free texts can go from 1 to 10 pages.

My question is:

Free text1 is say 3 pages, and Free text2 is one line.

I want this:

In this scenario I want the Free text1 to get printed on first page with first one line, Free text2 which has just one line should also get printed on first page and the remaining free text1 lines (3 pages data) should continue on pages after 1.

This is what I think will happen:

Since Text1 and Text2 both are dynamic if I define them both in MAIN window then text1 will get printed until the size it is allocated on page 1 and then it will jump to page 2 and so on. After Page1 gets printed completely on remaining pages Free text2 one line will print. But this is not what I want, I want the free text2 with one line to also get printed on first page...

Answers will be surely awarded.

Can I do the way I want it ?

Tushar

1 ACCEPTED SOLUTION

Former Member
0 Kudos

How is the text being printed, ie. is it an include or is it from an internal table? If it is an internal table, move the first line of the table to a different table, then print that in text1. Then print text2, then on print the rest of text1 but call it text3 . . . get my drift?

You may also want to check, in the ABAP code when you call to print text1, if it is indeed on the first page, if it is, do what I mentioned above, if it is not, proceed as normal.

I realize what I said may be a little cryptic. If it is, reply to this with as much info a possible so I can help more.

Andrew

7 REPLIES 7

Former Member
0 Kudos

How is the text being printed, ie. is it an include or is it from an internal table? If it is an internal table, move the first line of the table to a different table, then print that in text1. Then print text2, then on print the rest of text1 but call it text3 . . . get my drift?

You may also want to check, in the ABAP code when you call to print text1, if it is indeed on the first page, if it is, do what I mentioned above, if it is not, proceed as normal.

I realize what I said may be a little cryptic. If it is, reply to this with as much info a possible so I can help more.

Andrew

0 Kudos

Hi,

It is actually a long text and its an include. I go to STXH table for getting LN, ID and name for getting that long text. Unfortunately its not an internal table.

0 Kudos

Hmm, well that's a different story.

That is the problem with includes like that . . . I don't think it can be done, cleanly, at least. Well, in the ABAP code you could always bring the text into an internal table. Not pretty, but it will work. You just have to do a select on the table with the text in it.

Do you know how to find what table the text is in? Then, once you have it you can do what I suggested before.

Someone else may come up with another way of doing it, but this is quite a simple and easy way of doing it.

Andrew

0 Kudos

Hi,

Thanks for your reply.

I think I am gonna do it the way you are telling.

I guess I have to use a function module read_text to get the text in internal table, right ?

I just want to state following to make sure whatever I understood is correct.

So finally I will use FM READ_TEXT FM to bring the long text in the internal table and then print few lines say 2 or 3 lines whatever I want , after that I will again bring the long text 2 in other internal table again using FM READ_TEXT. After line of long text2 is printed I will give command like new-page for remaining lines of long text1 to start from new page ?

Is this what u want to say ?

Tushar.

0 Kudos

Yes, that is what I was aiming at, but since you don't care about the length of text2, you may just be able to leave it the way it is and just play with text1.

Good luck!

Andrew

0 Kudos

Hi,

What if I use following technique.

I just came to know that in SAP SAcript we can use 0-99 Main windows.

So can I just define two main windows on first page.

In the first main window I will put command line "NEW-Page two"

And leave Main Window 2 on page 1 as it is, so as soon as the long text in main window 1 will gets filled it will jump to next page two.

1) Will this work ?

2)If due to "new-page two" command the remaining data goes on second page then on what main window it wil go if I have two main windows on second page also ?

0 Kudos

Unfortunately, I do not know the answer to that. I saw your other thread asking about that and I didn't reply because it is something that you must test.

I say, give it a try, see if it works. So much of SAPScript is learned through trial and error, perhaps this is another one of those cases. There is no real good documentation to support SAPScript so all I have ever done is played with it until it works.

I am skeptical about your multiple main window approach, but as I said, try it and let us know if it works. The only problem I can think of is, this may be a lot of work for something that will most likely not work as you had hoped.

Good luck!

Andrew