2005 Jul 19 7:57 PM
hi folks,
I have the question. Here is the code..
types: begin of balfw,
kunnr type bseg-kunnr,
zuonr type bseg-zuonr,
wrbtr type bseg-wrbtr,
types: end of balfw.
data: balfwitab type standard table of balfw
with header line.
zbalanceamount type bseg-wrbtr.
select kunnr zuonr wrbtr into table balfwitab
where bseg-kunnr = p_custid.
if bseg-kunnr = bseg-zuonr.
loop balfwitab into bwa
move bwa-wrbtr into zbalanceamount.
....
I will have to read the data from the field 'wrbtr' -amount field(currency data type) from the itab
and need to add each value as I loop each time and store it in a separate variable .
Then I need to save that data into a separate variable of char type because I need to insert this data into another itable where this field is of character data type.
How can I do this?
Thanks in advance
Santhosh
2005 Jul 19 8:04 PM
clear zbalanceamount.
loop balfwitab into bwa.
add bwa-wrbtr to zbalanceamount.
endloop.
* zbalanceamount now has the total and can be added
* to your new internal table.
Regards,
Rich Heilman
2005 Jul 19 8:04 PM
loop balfwitab into bwa
zbalanceamount = zbalanceamount + bwa-wrbtr .
endloop .
data: charamount(20) type c .
write zbalanceamount to charamount .
Regards
Raja
2005 Jul 19 8:04 PM
2005 Jul 19 8:14 PM
Bear in mind that bseg-wrbtr is unsigned. You have to check the debit/credit indicator bseg-shkzg.
if bseg-shkzg = 'H'.
* process credit
else.
* process debit
endif.
Add or subtract depending on how you show debits/credits.
Rob
And you shouldn't select BSEG on anything but the key fields. For customers, use BSID and BSAD instead, depending on whether you want open and/or closed items.
Message was edited by: Rob Burbank
2005 Jul 19 9:57 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |