‎2005 Sep 29 2:01 PM
Hi,
COuld you just check this:
This is the current code:
SELECT SINGLE * FROM v_anlhz
WHERE bukrs = '3166'
AND anlkl = 'GB060'
AND aktiv = sy-datum
AND erdat = sy-datum
AND txt50 = bdc_inrec-txt50
AND kostl = v_kostl.
Sometimes the value for anlkl can be XXX, so is the following code okay?
SELECT SINGLE * FROM v_anlhz
WHERE bukrs = '3166'
AND anlkl = 'GB060'
OR anlkl = 'GB060'
AND aktiv = sy-datum
AND erdat = sy-datum
AND txt50 = bdc_inrec-txt50
AND kostl = v_kostl.
Many Thanks!
‎2005 Sep 29 2:04 PM
hi,
both the select statments into statement are missing
you change like that
data temp like v_anlhz
SELECT SINGLE * FROM v_anlhz into temp
WHERE bukrs = '3166'
AND anlkl = 'GB060'
AND aktiv = sy-datum
AND erdat = sy-datum
AND txt50 = bdc_inrec-txt50
AND kostl = v_kostl.
Sometimes the value for anlkl can be XXX, so is the following code okay?
SELECT SINGLE * FROM v_anlhz into temp
WHERE bukrs = '3166'
AND anlkl = 'GB060'
OR anlkl = 'GB060'
AND aktiv = sy-datum
AND erdat = sy-datum
AND txt50 = bdc_inrec-txt50
AND kostl = v_kostl.
so the result will be available in temp.
cheers,
sasi
‎2005 Sep 29 2:04 PM
hi,
both the select statments into statement are missing
you change like that
data temp like v_anlhz
SELECT SINGLE * FROM v_anlhz into temp
WHERE bukrs = '3166'
AND anlkl = 'GB060'
AND aktiv = sy-datum
AND erdat = sy-datum
AND txt50 = bdc_inrec-txt50
AND kostl = v_kostl.
Sometimes the value for anlkl can be XXX, so is the following code okay?
SELECT SINGLE * FROM v_anlhz into temp
WHERE bukrs = '3166'
AND anlkl = 'GB060'
OR anlkl = 'GB060'
AND aktiv = sy-datum
AND erdat = sy-datum
AND txt50 = bdc_inrec-txt50
AND kostl = v_kostl.
so the result will be available in temp.
cheers,
sasi
‎2005 Sep 29 2:08 PM
this is just the addition of '(' ')' in sasi's solution -
SELECT SINGLE * FROM v_anlhz into temp
WHERE bukrs = '3166'
AND anlkl = 'GB060'
AND aktiv = sy-datum
AND erdat = sy-datum
AND txt50 = bdc_inrec-txt50
AND kostl = v_kostl.
Sometimes the value for anlkl can be XXX, so is the following code okay?
SELECT SINGLE * FROM v_anlhz into temp
WHERE bukrs = '3166'
AND ( anlkl = 'GB060'
OR anlkl = 'GB060' ) "<<< change
AND aktiv = sy-datum
AND erdat = sy-datum
AND txt50 = bdc_inrec-txt50
AND kostl = v_kostl.
‎2005 Sep 29 2:14 PM
Hai!
try to mention what are the fields name u want, thats give good performances.
Alex
‎2005 Sep 29 2:21 PM
Hi,
I think into clause is not mandatory in case you are selecting all the fields. If you are selection particular no of fields then you need to specify the into clause. also when you have two/more possible values for one field in the data base table then put the brackets before and last of the values.
Best way is you can assign that value to any variable and use that variable to that select condition.
Hope this will solve your problem.
Regards,
Amit
‎2005 Sep 29 11:50 PM
Robert,
If you have a list of Asset Classes, you can also use a RANGE.
eg.
RANGES: ra_anlkl for anla-anlkl.
perform add_anlkl using 'GB060'.
perform add_anlkl using 'GB070'.
form add_anlkl using pa_anlkl.
clear ra_anlkl.
ra_anlkl-sign = 'EQ'.
ra_anlkl-option = 'I'.
ra_anlkl-low = pa_anlkl.
append ra_anlkl.
endform.
SELECT SINGLE * FROM v_anlhz
WHERE bukrs = '3166' AND
anlkl IN ra_anlkl AND
aktiv = sy-datum AND
erdat = sy-datum AND
txt50 = bdc_inrec-txt50 AND
kostl = v_kostl.
This makes your SELECT statement neater and easier to read if you want to select for multiple Asset Classes.
Hope this helps.
Cheers,
Pat.
‎2005 Sep 30 12:03 AM
Robert,
Insert INTO or INTO CORRESPONDING FIELDS in the select statement.
If you have multiplea entries for ANLKL, then it is always better to build a range will all the possible values and use that in the WHERE condition of the SELECT statement using IN operator like
anlkl IN r_anlkl
Thanks,