08-22-2008 12:10 PM
Hello all,
I have a requirement that in an internal table field i want to select data from a standard sap table that is difference of two fields of that table.
""Difference qty has to be calculated as the difference between the booked qty and Posted Qty(ISEG/MSEG u2013 ISEG/BUCHM)""
How do I write the SELECT statement that my this requirement is fulfilled?
Thanks in advance.
08-22-2008 12:20 PM
hi,
try to code like this:
itab1 with field qty1 and qty2.
define itab2 with qty1 , qty2 and qty_diff (type of qty1 or qty2).
fire select query.
selcect qty1 qty2 from 'sap table' into itab1 where 'Your condition'.
loop at itab1 into wa_itab1.
wa_itab2-qty1 = itab1-qty1.
wa_itab2-qty2 = itab1-qty2.
wa_itab2-qty_diff = ( itab2-qty1 - itab2-qty2 ).
append wa_itab2 to itab2.
clear wa_itab2.
endloop.
Now u will get your required result in itab2. Pass itab2 to alv, will get the data and difference.
08-22-2008 12:16 PM
You will have to select first and do calculations afterwards by looping through the result set.
Thomas
08-22-2008 12:20 PM
hi,
try to code like this:
itab1 with field qty1 and qty2.
define itab2 with qty1 , qty2 and qty_diff (type of qty1 or qty2).
fire select query.
selcect qty1 qty2 from 'sap table' into itab1 where 'Your condition'.
loop at itab1 into wa_itab1.
wa_itab2-qty1 = itab1-qty1.
wa_itab2-qty2 = itab1-qty2.
wa_itab2-qty_diff = ( itab2-qty1 - itab2-qty2 ).
append wa_itab2 to itab2.
clear wa_itab2.
endloop.
Now u will get your required result in itab2. Pass itab2 to alv, will get the data and difference.
08-22-2008 12:23 PM
hi yogesh
first select the data from database table ISEG into internal table (eg Itab) by using corresponding fields of keyword
then loop at internal table itab
loop at Itab
diff = Itab-MSEG u2013 Itab-BUCHM.
modify itab transporting diff.
endloop.
Here Diff is field in our internal table to hold the difference
Hope it will help you
Regards
deva