‎2010 Nov 17 12:41 PM
SELECT SINGLE * into corresponding fields of LS_JOB from DTAB
where
JOB_REPORT = JOBNAME and
JOBCOUNT = JOBCOUNT and
SCHED_START_DATE = today or SCHED_START_DATE = tomorrow .In the select the requirement is that after the where condition select should be evaluated in the following way
(JOB_REPORT = JOBNAME and JOBCOUNT = JOBCOUNT and {SCHED_START_DATE = today or SCHED_START_DATE = tomorrow })
OR takes precedence over and and the statement is not evaluated as above. I thought of writing like code like this to achive my purpose
SELECT SINGLE * into corresponding fields of LS_JOB from DTAB
where
JOB_REPORT = JOBNAME and
JOBCOUNT = JOBCOUNT and
SCHED_START_DATE = today .
IF SY-SUBRC NE 0.
SELECT SINGLE * into corresponding fields of LS_JOB from DTAB
where
JOB_REPORT = JOBNAME and
JOBCOUNT = JOBCOUNT and
SCHED_START_DATE = tomorrow.
ENDIF.Is there a way to do this with a single select statement.
Thanks
‎2010 Nov 17 12:58 PM
Hi,
Write the coding as :
SELECT SINGLE * into corresponding fields of LS_JOB from DTAB
where
JOB_REPORT = JOBNAME and
JOBCOUNT = JOBCOUNT and
( SCHED_START_DATE = today or
SCHED_START_DATE = tomorrow ) .
Regards,
Srini.
‎2010 Nov 17 12:50 PM
Why dont you use the BETWEEN operator?
SELECT SINGLE * into corresponding fields of LS_JOB from DTAB
where
JOB_REPORT = JOBNAME and
JOBCOUNT = JOBCOUNT and
SCHED_START_DATE BETWEEN today AND tomorrow.
Vikranth
‎2010 Nov 17 12:51 PM
same effect is achieved with:
and SCHED_START_DATE in (today, tomorrow).
‎2010 Nov 17 12:52 PM
SELECT SINGLE * into corresponding fields of LS_JOB from DTAB
where
JOB_REPORT = JOBNAME and
JOBCOUNT = JOBCOUNT and
( SCHED_START_DATE = today or SCHED_START_DATE = tomorrow ).
This should work with paranthesis as written above.
Regards
Munish Garg
‎2010 Nov 17 12:58 PM
Hi,
Write the coding as :
SELECT SINGLE * into corresponding fields of LS_JOB from DTAB
where
JOB_REPORT = JOBNAME and
JOBCOUNT = JOBCOUNT and
( SCHED_START_DATE = today or
SCHED_START_DATE = tomorrow ) .
Regards,
Srini.
‎2010 Nov 17 1:15 PM
It's fairly standard programming practice that when you have a logical expression, that you use brackets to override the default operator precendence.
Have you been programming long?
‎2010 Nov 17 2:29 PM
Started in ABAP in recently.
I would not use my C or C++ background....
If I do that I will never get past the ABAP compiler....I am trying to not compare them
Edited by: Vighneswaran CE on Nov 17, 2010 3:30 PM