‎2005 May 26 7:04 PM
lets say I was collecting this:
employee name deduction contribution
john doe 500 0
john doe 0 500
for some reason my program appends this instead of collecting it, any ideas.
thanks
‎2005 May 26 7:52 PM
Ok, I don't see anything wrong with your table structure. I did a little program and it is working fine.
types:
begin of data_struc_totals,
group(12) type c, "group
curr like t5ud3-curre,
pen_num type i, "number of pensioners
reg_num type i, "number of regulars
pen_rem type p decimals 2, "remittance pensioners
reg_rem type p decimals 2, "remittance regulars
pen_cov type p decimals 2, "coverage pensioners
reg_cov type p decimals 2, "coverage regulars
rem_tot type p decimals 2,"Grand Total
cov_tot type p decimals 2,
grand_tot type p decimals 2,
end of data_struc_totals.
data: itab type table of data_struc_totals with header line.
start-of-selection.
clear itab.
itab-group = 'A'.
itab-curr = 'USD'.
itab-pen_num = '3'.
itab-reg_num = '2'.
itab-pen_rem = '5.00'.
collect itab.
clear itab.
itab-group = 'A'.
itab-curr = 'USD'.
itab-pen_num = '1'.
itab-reg_num = '3'.
itab-pen_rem = '10.00'.
collect itab.
check sy-subrc = 0.
This code writes one line in the table
A,USD,4,5,15
Can you post some more of your code showing exactly where you problem is.
Regards,
Rich Heilman
‎2005 May 26 7:10 PM
‎2005 May 26 7:17 PM
Hi Jamie,
For a collect to work, your fields that need to be added should be of numeric type(P,I or F). They cannot be C or N.
Srinivas
‎2005 May 26 7:33 PM
types:
begin of data_struc_totals,
group(12) type c, "group
curr like t5ud3-curre,
pen_num type i, "number of pensioners
reg_num type i, "number of regulars
pen_rem type p decimals 2, "remittance pensioners
reg_rem type p decimals 2, "remittance regulars
pen_cov type p decimals 2, "coverage pensioners
reg_cov type p decimals 2, "coverage regulars
rem_tot type p decimals 2,"Grand Total
cov_tot type p decimals 2,
grand_tot type p decimals 2,
end of data_struc_totals.
here is the data structure,
‎2005 May 26 7:52 PM
Ok, I don't see anything wrong with your table structure. I did a little program and it is working fine.
types:
begin of data_struc_totals,
group(12) type c, "group
curr like t5ud3-curre,
pen_num type i, "number of pensioners
reg_num type i, "number of regulars
pen_rem type p decimals 2, "remittance pensioners
reg_rem type p decimals 2, "remittance regulars
pen_cov type p decimals 2, "coverage pensioners
reg_cov type p decimals 2, "coverage regulars
rem_tot type p decimals 2,"Grand Total
cov_tot type p decimals 2,
grand_tot type p decimals 2,
end of data_struc_totals.
data: itab type table of data_struc_totals with header line.
start-of-selection.
clear itab.
itab-group = 'A'.
itab-curr = 'USD'.
itab-pen_num = '3'.
itab-reg_num = '2'.
itab-pen_rem = '5.00'.
collect itab.
clear itab.
itab-group = 'A'.
itab-curr = 'USD'.
itab-pen_num = '1'.
itab-reg_num = '3'.
itab-pen_rem = '10.00'.
collect itab.
check sy-subrc = 0.
This code writes one line in the table
A,USD,4,5,15
Can you post some more of your code showing exactly where you problem is.
Regards,
Rich Heilman
‎2005 May 26 8:03 PM
your just putting collect itab,
I'm putting collect itab into (results table).
‎2005 May 26 8:10 PM
k, what does your results table look like, and how are you moving the data from one table to the other. Please post some relevant code.
types:
begin of data_struc_totals,
group(12) type c, "group
curr like t5ud3-curre,
pen_num type i, "number of pensioners
reg_num type i, "number of regulars
pen_rem type p decimals 2, "remittance pensioners
reg_rem type p decimals 2, "remittance regulars
pen_cov type p decimals 2, "coverage pensioners
reg_cov type p decimals 2, "coverage regulars
rem_tot type p decimals 2,"Grand Total
cov_tot type p decimals 2,
grand_tot type p decimals 2,
end of data_struc_totals.
data: itab type table of data_struc_totals with header line.
data: itab2 type table of data_struc_totals with header line.
start-of-selection.
clear itab.
itab-group = 'A'.
itab-curr = 'USD'.
itab-pen_num = '3'.
itab-reg_num = '2'.
itab-pen_rem = '5.00'.
append itab.
clear itab.
itab-group = 'A'.
itab-curr = 'USD'.
itab-pen_num = '1'.
itab-reg_num = '3'.
itab-pen_rem = '10.00'.
append itab.
check sy-subrc = 0.
loop at itab.
move-corresponding itab to itab2.
collect itab into itab2.
endloop.
check sy-subrc = 0.
Regards,
Rich Heilman
‎2005 May 26 8:28 PM
data: i_results_totals type table of data_struc_totals with header line.
data: wa_results_totals type data_struc_totals. "Work area
collect wa_results_totals into i_results_totals.
here is the output
OP 40-44 0 0.00 0.00 111 1,561.81 0.00 1,561.81 0.00 0.00
OP 45-49 0 0.00 0.00 127 3,303.88 60,000.00 3,303.88 60,000.00 0.00
OP 50-54 0 0.00 0.00 119 4,992.77 60,000.00 4,992.77 60,000.00 0.00
OP 50-54 40 3,752.47 42,760,000.00 0 0.00 0.00 3,752.47 42,760,000.00 0.00
OP 55-59 0 0.00 0.00 79 5,690.44 60,000.00 5,690.44 60,000.00 0.00
OP 55-59 167 22,895.74 160,000,000.00 0 0.00 0.00 22,895.74 160,000,000.00 0.00
you see how it is not collecting the 55-59 group or the 50-54 group all the time. It does it for a while then appends another line and uses that one for collecting.
‎2005 May 26 8:32 PM
Just a hunch!
Check to see if the currencies (CURR) are the same for all the lines. Seems like that is the problem.
Rishi
‎2005 May 26 8:47 PM
‎2005 May 26 8:51 PM