cancel
Showing results for 
Search instead for 
Did you mean: 

Printing into multiples columns on several pages

Former Member
0 Kudos

Hi,

I am looking for a way to print a list in TWO columns using SAPscript.

Here is the SAPScript :

/E POS_ITEMS

L

L &itemno1& &itemno2&

a list that looks like this :

apricot

banana

chick peas

dill pickle

egg

french fries

grapes

would be processed to look like this with lines per page = 4 :

apricot__________egg

banana_________ french fries

chick peas______grapes

dill pickle

and would be processed to look like this, with lines per page = 2 :

apricot_________chick peas

banana_________dill pickle

egg____________grapes

french fries

Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Maybe not pretty, but it works.

It's an example with four columns.

nb_col = 4.

nb_rangees = 6.

DESCRIBE TABLE it_table LINES nb_lignes.

nb_tableaux = ( nb_lignes DIV ( nb_rangees * nb_col ) ) + 1.

IF nb_lignes < nb_rangees.

nb_rangees = nb_lignes.

ENDIF.

pos = 1.

DO nb_tableaux TIMES.

DO nb_rangees TIMES.

 

  • 1re colonne

index_col = pos.

PERFORM lire_valeur USING index_col CHANGING chaine.

WRITE:/ chaine.

 

  • 2e colonne

index_col = pos + ( nb_rangees ).

PERFORM lire_valeur USING index_col CHANGING chaine.

WRITE: chaine.

 

  • 3e colonne

index_col = pos + ( 2 * nb_rangees ).

PERFORM lire_valeur USING index_col CHANGING chaine.

WRITE: chaine.

 

  • 4e colonne

index_col = pos + ( 3 * nb_rangees ).

PERFORM lire_valeur USING index_col CHANGING chaine.

WRITE: chaine.

pos = pos + 1.

ENDDO.

pos = pos + ( ( nb_col - 1 ) * nb_rangees ).

ENDDO.

WRITE:/ 'FIN'.

 *----


*

 

  • FORM lire_valeur *

 *----


*

FORM lire_valeur USING p_index

CHANGING p_valeur.

CLEAR p_valeur.

IF p_index <= nb_lignes.

READ TABLE it_table INDEX p_index.

p_valeur = it_table-nom.

ENDIF.