12-18-2006 2:01 PM
Hello,
I want to split 2 lines like that :
Date, aa,bb, cc, dd ,ee, ff, etc..
12/10/06, 12, 11, 34, 45, 56, 44, etc....
in one table with two fields like liste-tmp and liste-tmp2,
where variables of first line go to liste-tmp,
and those of second line go to liste-tmp2.
12-18-2006 2:11 PM
say ur table has only 2 lines which needs to be splitted..then....
read table itab index 1.
move values to liste-tmp.
read table itab index 2.
move values to liste-tmp2....
*********************************************
Now, there are more than 2...then.....
read table itab index 1.
move values to liste-tmp.
loop at itab.
move values to liste-tmp2....
append liste-tmp2.
endloop.
12-18-2006 2:35 PM
Thx but I have a CSV format like :
Date, USD, JPY, CYP, CZK, etc...
15 December 2006, 1.3106, 155.04, 0.5781, 27.755, etc....
in entry so I create an internal table and I have :
tab_input_tmp-lines = Date, USD, JPY, CYP, CZK, (at index 1)
and tab_input_tmp-lines = 15 December 2006, 1.3106, 155.04, 0.5781, ... ( at index 2)
and I want to split that to have
(index 1)liste-tmp = USD
liste-tmp2 = 1.3106
(index 2)liste-tmp = JPY
liste-tmp2 = 155.04
....
12-18-2006 4:10 PM
data: ind type i.
loop at itab.
read table itab index ind.
if ind mod 2 <> 0.
move values to var1.
else.
move values to var2.
endif.
ind = ind + 1.
endloop.
Cheers.
12-18-2006 4:13 PM
Answer :
on va d'abord récupérer les devise dans la table liste en faisant une boucle recursive sur le champ tmp ( où est récupérer le reste de la ligne des devise)
Tant que cette ligne n'est pas vide ça veux dire qu'il reste encore des devises.
read table tab_input_tmp index 1.
SPLIT tab_input_tmp-line AT ',' INTO liste-WAERS
liste-tmp.
insert liste into table liste1.
while liste-tmp is not initial.
SPLIT liste-tmp AT ',' INTO liste-WAERS
liste-tmp.
if liste-WAERS = 'date'.
else.
insert liste into table liste1.
endif.
endwhile.
*on va ensuite récupérer les valeurs des devise dans la table liste en faisant une boucle recursive sur le champ tmp ( où est récupérer le reste de la ligne des valeurs desdevise)
Tant que cette ligne n'est pas vide ça veux dire qu'il reste encore des valeurs de devises.
clear liste.
read table tab_input_tmp index 2.
loop at liste1 into liste.
SPLIT tab_input_tmp-line AT ',' INTO liste-WRBTR
tab_input_tmp-line.
modify table liste1 from liste.
endloop.