2008 May 31 8:59 AM
Hi All,
We have used the following code in our report.
I would like to know what is the logic behind using this type of where condition.....????
SELECT PERNR
KST01
BEGDA
ENDDA FROM PA0027 INTO CORRESPONDING FIELDS OF TABLE IT_PA0027
FOR ALL ENTRIES IN IT_KOSTL
WHERE KST01 = IT_KOSTL-KOSTL
AND ( ( BEGDA <= P_DATE1 AND ENDDA >= P_DATE2 )
OR ( BEGDA >= P_DATE1 AND BEGDA <= P_DATE2 )
OR ( ENDDA >= P_DATE1 AND ENDDA <= P_DATE2 ) ) .
In our selection screen, we have Two dates called Start Date and End Date (Both have no range...they are parameters).
From Date: P_DATE1
To Date: P_DATE2
Can anyone explain me, whats the meaning of above where condition...???
Regards
Pavan
2008 May 31 9:29 AM
hi,
( BEGDA <= P_DATE1 AND ENDDA >= P_DATE2 )
-- it checks if begin date falls earlier or on the same day of p_date1 and p_date2 is on or after end date
( BEGDA >= P_DATE1 AND BEGDA <= P_DATE2 )
-- if begin date is between p_date1 and p_date2
( ENDDA >= P_DATE1 AND ENDDA <= P_DATE2 ) )
-- end date is between p_date1 and p_date2
either one condition is satisfied a record is picked.
regards,
madhu
Hi All,
We have used the following code in our report.
I would like to know what is the logic behind using this type of where condition.....????
SELECT PERNR
KST01
BEGDA
ENDDA FROM PA0027 INTO CORRESPONDING FIELDS OF TABLE IT_PA0027
FOR ALL ENTRIES IN IT_KOSTL
WHERE KST01 = IT_KOSTL-KOSTL
AND ( ( BEGDA <= P_DATE1 AND ENDDA >= P_DATE2 )
OR ( BEGDA >= P_DATE1 AND BEGDA <= P_DATE2 )
OR ( ENDDA >= P_DATE1 AND ENDDA <= P_DATE2 ) ) .
In our selection screen, we have Two dates called Start Date and End Date (Both have no range...they are parameters).
From Date: P_DATE1
To Date: P_DATE2
Can anyone explain me, whats the meaning of above where condition...???
Regards
Pavan
2008 May 31 9:29 AM
hi,
( BEGDA <= P_DATE1 AND ENDDA >= P_DATE2 )
-- it checks if begin date falls earlier or on the same day of p_date1 and p_date2 is on or after end date
( BEGDA >= P_DATE1 AND BEGDA <= P_DATE2 )
-- if begin date is between p_date1 and p_date2
( ENDDA >= P_DATE1 AND ENDDA <= P_DATE2 ) )
-- end date is between p_date1 and p_date2
either one condition is satisfied a record is picked.
regards,
madhu
2008 May 31 9:34 AM
hi here the condition is using the three set of values..for the start date and the end date for the records fetching..
1. if the start date is equal to less than the p_date1 and the end date is greate than or equla to the p_date2 means ...this means the select fetches all the records which includes the time interval...from p_date1 to p_date2 .
regards,
venkat
2008 May 31 11:26 AM
Make sure parameter field is manatory if no input is given in the parameter field no record will be selected.
Regards
Bikas
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |