cancel
Showing results for 
Search instead for 
Did you mean: 

SapScript clipping text instead of wrapping

Former Member
0 Kudos

Hi all,

I need to print a watermark on a check wich will be composed of the recipient and the amount. I want this to print continuously in a window. Because of the automatic wrapping function of the Sapscript's window, the text is cut between space and doesn't give me the effect I want. Is there a way to turn off that wrapping and make the window clip the extra text?

OR I tried to make a BIG string in a ABAP routine and put back the string on one line in the window, that works except that the strings pass to a ABAP routine is maximum 255 characters, so my string is cut and I don't get the full text in the window. So if there's no way to turn off wrapping, is there a way to pass longer string between a sapscript and a ABAP routine??

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Nop you can only pass strings of that size, try to do it with several static strings, that is the onlu way to do it, or try to do it in a structure but i dont think it would work.

Cheers,

Gabriel P.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

You try to place a new window, having the same size, in the same position of the main, i.e. the MAIN should overwrite this new window.

In this window place your watermark.

Max

Former Member
0 Kudos

Thats what I've done, I don't have problems printing the watermark, I have problems with the contents of it. If the check recipient is Mike B and the amount is 10.99 I want the watermark to be like that:

_______________________

MIKEB10.99MIKEB10.99M

IKEB10.99MIKEB10.99MIK

EB10.99MIKEB10.99MIKE

-


|

What I get is something like that:

________________________

MIKEB10.99MIKEB10.99

MIKEB10.99MIKEB10.99

MIKEB10.99MIKEB10.99

-


|

Even if in the sapscript I put my variables in the same line like that:

&waterm&&waterm&&waterm&&waterm&&waterm&

Former Member
0 Kudos

Hi

U can manage it write the text in an internal table and then transfering the data from this table to the window:

WINDOW

/: &LINE1&

/: &LINE2&

/: &LINE3&

................

/: &LINEN&

The program:

DATA: OFFSET   TYPE I,
           OFFSET1 TYPE I,
           LEN         TYPE I,
           LEN1       TYPE I,
           LEN_LINE TYPE I.
          
DATA: MAX TYPE I VALUE 72.

DATA: N TYPE I,
           MAX_LINE TYPE I VALUE " Max Number of lines can be printed

LEN = STRLEN( WATERM ).

DO.
  LEN_LINE = OFFSET + LEN.
  IF LEN_LINE < MAX.
    LEN1 = LEN.
  ELSE.
    LEN1 = MAX - LEN.
  ENDIF.
  
  WRITE WATERM(LEN1) TO LINE+OFFSET.
  OFFSET = OFFSET + LEN1.
  IF OFFSET = MAX.
     APPEND LINE TO T_LINE.
     N = N + 1.
     IF N = MAX_LINE.
       EXIT.
     ENDIF.
  ENDIF.
* New line
  IF LEN1 < LEN.
    CLEAR LINE.
    WRITE WATERM+LEN1 TO LINE.
  ENDIF.
ENDDO.

FIELD-SYMBOLS: <LINE> TYPE ANY,
                            FIELDNAME(20) VALUE 'LINE'.
DATA: COUNT(2) TYPE N.

LOOP AT T_LINE.
  COUNT = COUNT + 1.
  CONCATENATE 'LINE' COUNT INTO FIELDNAME.
  ASSIGN T_LINE TO (FIELDNAME).
* Call the window
ENDLOOP.

Max

Former Member
0 Kudos

I'm not sure what you mean by "Call the window".

The way I know it, I do a PERFORM in my sapscript calling a program, manupulate data in the program and pass the result to the sapscript with the out_tab table, then I print the result from the program. Is there another way I don't know??

Former Member
0 Kudos

it means call fm WRITE_FORM: can you change the main program?

Max

Former Member
0 Kudos

No, I call my own Z program, I don't want to change the SAP program.

Former Member
0 Kudos

So

U can try to insert a code as mine in a form called by sapscript and transfer the line to the changing parameter (out_tab table).

The only problem can be the number of parameters can be used in this form, I believe it can't be greater than certain number (but I don't remember which one).

Max

Former Member
0 Kudos

The problem with handling the text myself as in your code, is the proportional font, I can't calculate the number of characters in the a line because of that.

I need a very bold and big font to make the watermark readable. So I use HELVE font.

Former Member
0 Kudos

U should know the size of the window and font so you can calculate how many chararcter can be printed.

U can use an empiricist way: print a big line and check how many char aren't printed (or are pinted), so you can know how many char you can use.

Max

Former Member
0 Kudos

It's never the same number of characters since the font is proportional. Depending of what is in the string, the number of characters change.

For example if I have a 80 characters line consisting of 80 "i", it will fit on the window but 80 'w' won't, since the W take's more space than i and that's why I can't calculate the number of characters.

Former Member
0 Kudos

I found a workaround, I've created a window for each line and put "_" instead of space. Now the text is clipped at the end of the window. I just repeated the same string in each line with a different offset.