cancel
Showing results for 
Search instead for 
Did you mean: 

Include text in SAPScript

Former Member
0 Kudos

Hi All,

I am including text in SAP Script as folows:-

IF LFD_SRNUM IS NOT INITIAL.

INCLUDE TEXT_SRNUM OBJECT TEXT ID ST LANGUAGE &SY-LANGU& PARAGRAPH S1

ENDIF.

Now, the data from variable LFD_SRNUM is being printed.

This variable contains about 120 characters. But, only first 80 characters are being printed (Rest are truncated).

What code should I write so that data is continued from next line (like Wordwrap of NOTEPAD) ?

Regards,

Ashish

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ashish W ,

IF LFD_SRNUM IS NOT INITIAL.

INCLUDE TEXT_SRNUM OBJECT TEXT ID ST LANGUAGE &SY-LANGU& PARAGRAPH S1

ENDIF.

Now, the data from variable LFD_SRNUM is being printed.

Firstly why LFD_SRNUM is being Printed.

This variable contains about 120 characters. But, only first 80 characters are being printed (Rest are truncated).

What is this variable are you speaking abt LFD_SRNUM

Regards,

Suneel G

Former Member
0 Kudos

Hi Suneel,

- LFD_SRNUM is being printed because the text element TEXT_SRNUM that I have created in SO10 has following code written in it:-

&LFD_SRNUM&

- the variable LFD_SRNUM contains about 120 characters, but only first 80 are printed(rest are truncated)

Regards,

Ashish

Former Member
0 Kudos

Hi Ashish,

First, I don't understand why you had to do a standard text in order to print a variable which is already visible in your script.

I suggest that you write something like:

 
S1    &lfd_srnum(70)&
S1    &lfd_srnum+70&

This will solve the overflow issue. If you really want to be geeky with this, you can create a procedure which splits this text into multiple rows and call it from the SAPscript. In there, you can also split the text when a word finishes ( so that it looks nicer).

Regards,

George

Former Member
0 Kudos

Hi George,

That is exactly what I was looking for:-

- But, as per your suggestion,

S1 &lfd_srnum(70)&

S1 &lfd_srnum+70&

would take care only of two rows

(whereas in my case data can be of any length - 120 characters is what I am getting currently)

- Also, for the second solution, it would be really great if you could explain it with an example

(Since I dont understand how I would achieve it technically)

Regards,

Ashish

Former Member
0 Kudos

Well, first of all, this is how you are calling a procedure in an ABAP program from a SAPscript:


/:   PERFORM PROC_NAME IN PROGRAM Z_YOUR_REPORT 
/:   USING &var1& 
/:   USING &var2& 
/:   CHANGING &var3& 
/:   CHANGING &var4& 
/:   CHANGING &var5& 
/:   ENDPERFORM 

There are numerous links even if you search on a general search engine, so I would not explain this any further.

Next, there are two issues that we need to take care of:

- unknown text size

- splitting each row when a word ends(at space I think it's sufficiently well)

Let's take care of the unknown text size first.

If this is really completely unknown and it can take from 100 to 10 000 chars, then there might be another approach that I will explain below. However, if you can reduce the size let's say to 500 chars ( around 8 rows), then you can specify 8 CHANGING parameters and have each row assigned a value in your procedure which splits the text.

If the text size is bigger, I suggest that inside the procedure, you split the text and save the result in a table of type TLINE. Then, you call the function SAVE_TEXT, giving it a name. Then you include this text in the SAPscript. And finally you delete the text with another PERFORM.

Next, splitting each row, here you have to create a small algorithm, basically saying split when you see the closest space to position X(70,140, whatever). I've written something like this last year. I don't have access to the system to get it for you, but as soon as I will, I'll post it.

Regards,

George

Former Member
0 Kudos

OR

If you don't care about separating the rows when a word ends and you just want to have this done NOW, you can just write in your standard text something like this:



S1 &lfd_srnum(70)&
S1 &lfd_srnum+70(70)&
S1 &ld_srnum+140(70)&
S1 &ld_srnum+210(70)&
.....
......

And you go on until you think you have reached a certain limit that is improbable to be reached.

Pretty hardcoded solution, but it does the job.

Regards,

George

P.S. : By the way, you can check in the paragraph format S1 the option No Blank Lines, so that you would not have to deal with 10+ blank lines when the text is only one line long.

former_member188831
Contributor
0 Kudos

I cannot split the text into more fields like text_1 text_2 since i am already using around 20 values for each text - each of them can go up like long text value.

so i cannot split one text_1 to multiple .. that will be more tough.

is there any other way to do it ? to get full 255 chars of text.

I did not get the idea of save_text and delete it .. how i am going to print it ?

Thanks,

Mahesh

former_member188831
Contributor
0 Kudos

I figured it out.

I am using the INCLUDE statement in script and pass all the td_name td_object td_id langauge to it.

just like below

my v_text2 will come from driver program i.e TDNAME = <Keyid>

INCLUDE &V_TEXT2& OBJECT &LV_TDOBJECT& ID &LV_TDID& LANGUAGE &LV_TDLANG& PARAGRAPH K1.

Thanks,

Mahesh

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Check the window size. Try increase the window size and test it,

Former Member
0 Kudos

Hi Avinash,

Increasing the Window size wouldnt be a solution, since the text can be of any length.

What I want is, once the text reaches the window border, it should continue from the next line.

(Presently it is being truncated at the window border - it doesnt continue from next line)

Regards,

Ashish