on 04-03-2008 5:52 PM
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!
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.