08-12-2011 8:15 AM
hi
my requirement is to show the power consumption of each generator we have 4 .
and also the difference.
a | b | b-a |
ex : 1.07.2011 is starting reading of that month (.this is a) .
for 2.07.2011 it should subtract with 1.07.2011 (this is b)
for 3.07.2011 it should subtract with 1.07.2011 like this(b-a) here my problem is, this initial date have to change based on month (i.e for every month 1st is the initial reading all days of that month should sub with that day only).
i had written select query and filtered the only power consumption readings only ...
for me not getting how to write condition for this ....
it is regarding to pm i had used table equi ,imrg,imptt
Thanks a lott
Moderator message : Spec dumping not allowed, show the work you have already done. Thread locked.
Edited by: Vinod Kumar on Aug 12, 2011 1:18 PM
08-12-2011 8:49 AM
Hi,
Data : BEGIN OF itab OCCURS 0,
eqno TYPE c LENGTH 10,
date type sy-datum,
reading type i,
END OF itab.
data: wa like LINE OF itab.
data: wa1 like LINE OF itab.
wa-eqno = '1'.
wa-date = '20110801'.
wa-reading = 43567.
APPEND wa to itab.
wa-eqno = '2'.
wa-date = '20110802'.
wa-reading = 43667.
APPEND wa to itab.
wa-eqno = '3'.
wa-date = '20110803'.
wa-reading = 43767.
APPEND wa to itab.
sort itab by date.
READ TABLE itab into wa1 index 1.
BREAK-POINT.
LOOP AT itab into wa.
CHECK sy-tabix ne 1.
wa-reading = wa-reading - wa1-reading.
modify itab from wa.
clear: wa.
ENDLOOP.