05-19-2006 11:21 AM
Hello experts,
I need to get records from table anlc that is not deactivated so I joined it with table anla because that is where the field deakt is located. I need to get records where its deakt is initial but how can I declare it to my select statement since the word INITIAL cannot be included in a select statement. So here's what I did:
So, is the word NULL the same as initial?
SELECT SINGLE abukrs aanln1 agjahr aafabe a~knafa
akansw aanswl akaafa anafal
aaafav aaafag
nafap aafap nafav nafag
FROM anlc as a
inner join anla as b
on aanln1 = banln1
INTO (it_anlc-bukrs, it_anlc-anln1, it_anlc-gjahr,
it_anlc-afabe, it_anlc-knafa, it_anlc-kansw,
it_anlc-answl, it_anlc-kaafa, it_anlc-nafal,
it_anlc-aafav, it_anlc-aafag, it_anlc-nafap,
it_anlc-aafap, it_anlc-nafav, it_anlc-nafag)
WHERE a~anln1 EQ it_finaltab-asset
AND a~bukrs IN r_iwerk
AND a~gjahr EQ gv_year
AND a~afabe EQ '01'
and b~deakt is null.
05-19-2006 11:54 AM
Hi,
Use b~deakt EQ lv_deakt.
data type of lv_deakt should besame has b~deakt.
whenever u declare the variable of any type.
ABAP automatically gives its initial value to the field.
eg:-
when
lv_date type dats,
lv_time type tims.
LV_date----->'00000000'
lv_time----->'000000'.
Dont worry it works.
Regards
05-19-2006 11:24 AM
Use this
<b>b~deakt EQ space.</b>
<b>
Reward points and close the thread.</b>
05-19-2006 11:25 AM
Hi,
I noticed that its initial value is 00/00/0000. will space work?
05-19-2006 11:25 AM
05-19-2006 11:25 AM
HI Viray,
Use <b>b~deakt <> '00000000'</b> as in your select statement.
Thanks,
Vinay
05-19-2006 11:27 AM
I would rather suggest you to :
SELECT SINGLE abukrs aanln1 agjahr aafabe a~knafa
akansw aanswl akaafa anafal
aaafav aaafag
nafap aafap nafav nafag
FROM anlc as a
inner join anla as b
on aanln1 = banln1
INTO (it_anlc-bukrs, it_anlc-anln1, it_anlc-gjahr,
it_anlc-afabe, it_anlc-knafa, it_anlc-kansw,
it_anlc-answl, it_anlc-kaafa, it_anlc-nafal,
it_anlc-aafav, it_anlc-aafag, it_anlc-nafap,
it_anlc-aafap, it_anlc-nafav, it_anlc-nafag)
WHERE a~anln1 EQ it_finaltab-asset
AND a~bukrs IN r_iwerk
AND a~gjahr EQ gv_year
AND a~afabe EQ '01'.
delete it_anlc where deakt is initial.
IS NULL, IS NOT NULL is going to cost a lot in terms of database usage. Better to delete the entries from internal table after the select is done.
05-19-2006 11:54 AM
Hi,
Use b~deakt EQ lv_deakt.
data type of lv_deakt should besame has b~deakt.
whenever u declare the variable of any type.
ABAP automatically gives its initial value to the field.
eg:-
when
lv_date type dats,
lv_time type tims.
LV_date----->'00000000'
lv_time----->'000000'.
Dont worry it works.
Regards
05-19-2006 11:57 AM
Hi viraylab,
u can try this way:
select anln1 from anla into table it_anln1
where deakt = '00000000'.
select bukrs anln1 gjahr afabe knafa kansw answl kaafa nafal aafav aafag nafap aafap nafav nafag from anlc into table it_anlc for all entries in it_anln1 where anln1 = it_anla-anln1.
And also for all entries is better performance wise than innerjoins.
Award points if helpful.
regards,
keerthi.