‎2008 Jul 07 11:06 AM
Hi All,
I have a requirement where I need to select all the records where the data field (AUFK- IDAT2) is INITIAL.
I have given the query:
SELECT
A~AUFNR
A~AUFPL
INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON AAUFNR = UAUFNR
WHERE
U~AUART = 'ZCPM' AND
U~IDAT2 = '00000000' AND
U~WERKS BETWEEN PLANT-LOW AND PLANT-HIGH AND
A~GSTRP BETWEEN CREATEDT-LOW AND CREATEDT-HIGH.
however, it gives an error on this line: U~IDAT2 = '00000000' .
Please reply urgently.
Thanks....
‎2008 Jul 07 11:11 AM
Hi Vishal,
There should not be any problem. But still u can replace ur select like this.
I think last two conditions causing problem. Try commenting those and check. U may have to place proper brackets for those conditions.
DATA: l_initial TYPE aufk-idat2 VALUE IS INITIAL.
SELECT
A~AUFNR
A~AUFPL
INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON AAUFNR = UAUFNR
WHERE
U~AUART = 'ZCPM' AND
U~IDAT2 = l_initial AND
U~WERKS BETWEEN PLANT-LOW AND PLANT-HIGH AND
A~GSTRP BETWEEN CREATEDT-LOW AND CREATEDT-HIGH.
Edited by: Vinod Reddy Vemuru on Jul 7, 2008 3:44 PM
‎2008 Jul 07 11:11 AM
Hi Vishal,
There should not be any problem. But still u can replace ur select like this.
I think last two conditions causing problem. Try commenting those and check. U may have to place proper brackets for those conditions.
DATA: l_initial TYPE aufk-idat2 VALUE IS INITIAL.
SELECT
A~AUFNR
A~AUFPL
INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON AAUFNR = UAUFNR
WHERE
U~AUART = 'ZCPM' AND
U~IDAT2 = l_initial AND
U~WERKS BETWEEN PLANT-LOW AND PLANT-HIGH AND
A~GSTRP BETWEEN CREATEDT-LOW AND CREATEDT-HIGH.
Edited by: Vinod Reddy Vemuru on Jul 7, 2008 3:44 PM
‎2008 Jul 07 11:12 AM
Use like this:
SELECT
A~AUFNR
A~AUFPL
INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON AAUFNR = UAUFNR
WHERE
U~AUART = 'ZCPM' AND
U~IDAT2 = ' ' AND
U~WERKS BETWEEN PLANT-LOW AND PLANT-HIGH AND
A~GSTRP BETWEEN CREATEDT-LOW AND CREATEDT-HIGH.
Amit.
‎2008 Jul 07 11:14 AM
hi,
You cannot check the IS INITIAL condition in a SELECT statement so, you can assign the initial value to any other variable of that type and Assign INITIAL value to that. In the SELECT statement sue the VAriable instead of '00000000' value.
Hope this will help.
regards
Sumit Agarwal
‎2008 Jul 07 11:16 AM
U can do this as shown below:
data: l_date like sy-datum.
clear l_date.
SELECT
A~AUFNR
A~AUFPL
INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON AAUFNR = UAUFNR
WHERE
U~AUART = 'ZCPM' AND
U~IDAT2 = l_date AND
U~WERKS BETWEEN PLANT-LOW AND PLANT-HIGH AND
A~GSTRP BETWEEN CREATEDT-LOW AND CREATEDT-HIGH.
Regards,
Joy.
‎2008 Jul 07 11:17 AM
Hi Vishal,
According to ur query I have written the code as this :
tables :
afko,
aufk.
select-options:
plant for aufk-werks,
CREATEDT for afko-gstrp.
data :
begin of it_itab occurs 0,
aufnr like afko-aufnr,
aufpl like afko-aufpl,
auart like aufk-auart,
IDAT2 like aufk-idat2,
WERKS like aufk-werks,
GSTRP like afko-gstrp,
end of it_itab.
SELECT
A~AUFNR
A~AUFPL
INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON A~AUFNR = U~AUFNR
WHERE
U~AUART = 'ZCPM' AND
U~IDAT2 = '00000000' AND
U~WERKS BETWEEN PLANT-LOW AND PLANT-HIGH AND
A~GSTRP BETWEEN CREATEDT-LOW AND CREATEDT-HIGH.It was not giving me any error.
But just change and try with the following select query.
SELECT
A~AUFNR
A~AUFPL
INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON A~AUFNR = U~AUFNR
WHERE
U~AUART = 'ZCPM' AND
U~IDAT2 is null AND
U~WERKS BETWEEN PLANT-LOW AND PLANT-HIGH AND
A~GSTRP BETWEEN CREATEDT-LOW AND CREATEDT-HIGH.Regards,
Swapna.
‎2008 Jul 07 11:21 AM
Hi,
i have tried it in this way and don't get any problems.
TABLES: AFKO, AUFK.
*
SELECT-OPTIONS: PLANT FOR AUFK-WERKS.
SELECT-OPTIONS: CREATEDT FOR AFKO-GSTRP.
TYPES: BEGIN OF TY_ITAB,
AUFNR LIKE AUFK-AUFNR,
AUFPL LIKE AFKO-AUFPL,
END OF TY_ITAB.
*
DATA: IT_ITAB TYPE TABLE OF TY_ITAB.
*
SELECT AAUFNR AAUFPL INTO TABLE IT_ITAB
FROM AFKO AS A INNER JOIN AUFK AS U
ON AAUFNR = UAUFNR
WHERE U~AUART = 'PP01' AND "You use ZCPM
U~IDAT2 = '00000000' AND
U~WERKS IN PLANT AND
A~GSTRP IN CREATEDT.
*
Try my example or show a little bit more of your Report.
Regards, Dieter
‎2014 Feb 21 12:56 PM
types : begin of y_anla,
bukrs type anla-bukrs,
anln1 type anla-anln1,
end of y_anla.
data : t_anla type standard table of y_anla,
i_initial type anla-abgdt value is initial,
select-options : s_bukrs for anla-bukrs.
select bukrs anln1
from anla
into table t_anla
where bukrs in s_bukrs
and abgdt = i_initial.