2008 May 30 5:54 AM
Hi Forum,
I have a field in which i have values starting with letter
L, T, and S.
I have another field containing amount for the corresponding L, T, and S.
My requirement is like this.. i need to do subtotal for individual values..
FIELD1 FIELD2
L0001 1000
L0002 1000
Sub total 2000
T0001 0500
T0002 0200
0700
Kindly help me out
Regards
Mallika
2008 May 30 6:02 AM
Hi,
Sort u r table based on ( I have a field in which i have values starting with letter L, T, and S ) that field.
Use control loop events.
At end of field.
sum.
endat.
Narasimha
Hi,
Sort u r table based on ( I have a field in which i have values starting with letter L, T, and S ) that field.
Use control loop events.
At end of field.
sum.
endat.
Narasimha
2008 May 30 6:02 AM
Hi,
Sort u r table based on ( I have a field in which i have values starting with letter L, T, and S ) that field.
Use control loop events.
At end of field.
sum.
endat.
Narasimha
2008 May 30 6:15 AM
Hi,
Check the below code :
types : begin of tp_input,
field1 type string,
field2 type i,
end of tp_input.
data : ig_input type standard table of tp_input,
wg_input type tp_input.
data : subtotal1(4) type n,
subtotal2(4) type n,
subtotal3(4) type n.
wg_input-field1 = 'L0001'.
wg_input-field2 = '1000'.
append wg_input to ig_input.
wg_input-field1 = 'L0002'.
wg_input-field2 = '1000'.
append wg_input to ig_input.
wg_input-field1 = 'T0001'.
wg_input-field2 = '0500'.
append wg_input to ig_input.
wg_input-field1 = 'T0002'.
wg_input-field2 = '0200'.
append wg_input to ig_input.
loop at ig_input into wg_input.
if wg_input-field1 ca 'L'.
subtotal1 = subtotal1 + wg_input-field2.
elseif wg_input-field1 ca 'T'.
subtotal2 = subtotal2 + wg_input-field2.
elseif wg_input-field1 ca 'S'.
subtotal3 = subtotal3 + wg_input-field2.
endif.
endloop.
Write : subtotal1, / , subtotal2, / , subtotal3.Regards,
Raghu
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |