‎2007 Sep 06 10:35 AM
Dear Gurus,
I have one field s_budat in selection screen and i am passing the date 01.02.2007 and all records coming as per selection parameters.
But i need -1 day from date which i m passing in the selection field.
For this i m using following.
s_budat-low = s_budat-low - 1.
select budat
hkont
shkzg
dmbtr
into table result
from bsis
where bsis~hkont in s_gl
and budat in s_budat
and gsber = p_gsber.
but when i m selecting data it is not coming from 31.01.2007.
Please give me solution.
Thanks in Advance.
Regards
Maqsood
‎2007 Sep 06 10:40 AM
S_BUDAT is essentially a table, but your code here is only updating the header. You need to loop through S_BUDAT and update the row of the table.
Something like;
LOOP AT S_BUDAT ASSIGNING <FS_DATE>.
<FS_budat>-low = <fs_budat>-low - 1.
endloop.
Regards,
Nick
‎2007 Sep 06 10:40 AM
Hi maqsood,
1. Minor mistake.
2. Just do like this.
s_budat-low = s_budat-low - 1.
<b>MODIFY S_BUDAT INDEX 1.</b>
Then it will come.
3. This happens bcos s_budat
is internally an internal table, and we have to modify
the 1st record, and not just the header line.
regards,
amit m.
‎2007 Sep 06 10:40 AM
S_BUDAT is essentially a table, but your code here is only updating the header. You need to loop through S_BUDAT and update the row of the table.
Something like;
LOOP AT S_BUDAT ASSIGNING <FS_DATE>.
<FS_budat>-low = <fs_budat>-low - 1.
endloop.
Regards,
Nick
‎2007 Sep 06 10:40 AM
a select-option is a range table. You need to do this.
read table s_budat index 1.
s_budat-low = s_budat-low - 1.
modify s_budat.
‎2007 Sep 06 10:40 AM
the date format it yyyymmdd
now when you -1 from this 01.02.2007 it is 20070200
you cannot do this by simply putting a minus sign.
you have to know what is happening inside.
try some fm to get the previous date ...
then pass the date
and then the date what the fm returns...pass it to the select command where condition.
reward if helpful
thanks
vivekanand
‎2007 Sep 06 10:43 AM
Hi...
Note : SELECT-OPTION creates an internal table ..
This is the Solution..
SELECT-OPTIONS: s_budat-low FOR sy-datum.
INITIALIZATION.
S_BUDAT-LOW = SY-DATUM - 1.
APPEND S_BUDAT.
START-OF-SELECTION.
select budat
hkont
shkzg
dmbtr
into table result
from bsis
where bsis~hkont in s_gl
and budat in s_budat
and gsber = p_gsber.
Reward if Helpful..
‎2007 Sep 06 10:58 AM
Hi Maqsood,
You job will complete with the following fm
RP_CALC_DATE_IN_INTERVAL
DATE --- the date you get from sel screen
DAYS --- the number of days you want to reduce.
it will return you the what you are expecting.
<u><i><b>Dont forget reward points which boost us to help others</b></i></u>
Regards
Sreenivasa sharma