‎2009 May 05 12:38 PM
Hi Guys,
I have used Ranges and used a select statement for selecting those ranges but I am facing a problem.
RANGES: r_doctyp for EDIDC-DOCTYP.
r_doctyp-sign = 'I'.
r_doctyp-option = 'EQ'.
r_doctyp-low = 'DEBMAS'.
append r_doctyp.
r_doctyp-sign = 'I'.
r_doctyp-option = 'EQ'.
r_doctyp-low = 'MATMAS'.
append r_doctyp.
r_doctyp-sign = 'I'.
r_doctyp-option = 'EQ'.
r_doctyp-low = 'PRICAT'.
append r_doctyp.
r_doctyp-sign = 'I'.
r_doctyp-option = 'EQ'.
r_doctyp-low = 'ORDERS'.
append r_doctyp.
r_doctyp-sign = 'I'.
r_doctyp-option = 'EQ'.
r_doctyp-low = 'INVOIC'.
append r_doctyp.
Select DOCNUM " IDoc number
DOCTYP " IDoc Type
from EDIDC into table IT_ZEDIDC
where CREDAT EQ s_credat-low
and DOCTYP EQ r_doctyp " IDOC Types
and DIRECT EQ '1'.
Here my select statement is only taking INVOIC.
But my statement should take any document type.
Thanks,
Prasad.
‎2009 May 05 12:39 PM
‎2009 May 05 1:11 PM
‎2009 May 05 1:15 PM
Hi,
Firstly check if the entries does exist in the database table for the conditions you have given....
if so,,
did you try with the select query I had written because even for select-options you have to use IN like I had given you in my post....
if that also does not work,
then provide us the select query you have changed and also try to debug what exactly the values are retrieved from the table...
Regards
Siddarth
‎2009 May 05 1:16 PM
HI Try this:
Select DOCNUM " IDoc number
DOCTYP " IDoc Type
from EDIDC into table IT_ZEDIDC
where CREDAT IN s_credat
and DOCTYP IN r_doctyp " IDOC Types
and DIRECT EQ '1'.
Kiran
‎2009 May 05 1:18 PM
‎2009 May 05 1:20 PM
did you try with the select query I had given earlier...
I had given the same one as Kiran has given in his recent post....
Regards,
Siddarth
Edited by: Siddharth Chordia on May 5, 2009 2:21 PM
‎2009 May 05 1:24 PM
Hi...,
Your following select statement is correct.
Select DOCNUM " IDoc number
DOCTYP " IDoc Type
from EDIDC into table IT_ZEDIDC
where CREDAT IN s_credat
and DOCTYP IN r_doctyp " IDOC Types
and DIRECT EQ '1'.Why you are not getting result..
1. structure of the IT_ZEDIDC is having two fields DOCNUM , DOCTYP with same data lengths. If not it should be...
2. Order in the database table is must be similer to the order you maintained in the select statement.
3. As you are hard coding the input ranges make sure about every letter.
4. take a look at other where condition fields too.
5. check the table of the ranges in debugging mode.
6. why can't you declare separate work area and table for ranges...?
like .... data: r_tab type range of <field>
data: wa_tab like line of r_tab.
7. Use clear work area statement after the append statment.
--Naveen Inuganti.
‎2009 May 05 1:28 PM
Hello Dheeru,
Can you just change your SELECT stmt to
Select DOCNUM " IDoc number
DOCTYP " IDoc Type
from EDIDC into table IT_ZEDIDC
where CREDAT EQ s_credat-low
" and DOCTYP EQ r_doctyp
AND IDOCTP IN r_doctyp "--> use this clause
and DIRECT EQ '1'.You can give this a try. I can see in my system DOCTYP is not populated. You can check EDIDC in your system for an existing Idoc & validate:-))
BR,
Suhas
Edited by: Suhas Saha on May 5, 2009 2:28 PM
‎2009 May 05 12:39 PM
Select DOCNUM " IDoc number
DOCTYP " IDoc Type
from EDIDC into table IT_ZEDIDC
where CREDAT EQ s_credat-low
and DOCTYP IN r_doctyp " IDOC Types
and DIRECT EQ '1'.
Kiran
‎2009 May 05 12:40 PM
Hi,
change the select statement as given below...
Select DOCNUM " IDoc number
DOCTYP " IDoc Type
from EDIDC into table IT_ZEDIDC
where CREDAT IN s_credat
and DOCTYP IN r_doctyp " IDOC Types
and DIRECT EQ '1'.Regards,
Siddarth
‎2009 May 05 12:42 PM
Hi There,
Your "WHERE" clause is saying "EQ" to r_doctype so is matching to the last value you appended to your range table.
Range tables work like select-options
- you need the syntax to be "WHERE doctype IN r-doctype"
Hope that helps!
Robin
‎2009 May 05 2:12 PM
Instead of EQ you must use IN in your select statement.
remember this when we are using select-options ,in select statement use "IN" only.
for parameters , you have to use "EQ".
Hope it will help you