08-07-2006 3:56 PM
Hello All,
I'm facing a strange issue regarding select-options.
Initially I was using like this,
MOVE: 'I' TO r_wildcard-sign,
'EQ' TO r_wildcard-option,
'++++++++++B' TO r_wildcard-low.
APPEND r_wildcard.
SELECT * FROM mara
INTO TABLE gt_mara_b
WHERE mtart = 'YSAB'
AND matnr IN r_wildcard.
This range in the select query fetched many records.
But now the above query is not working and it is giving null records. So I changed the condition in the
select-options as 'CP' instead of 'EQ', now the select query is fetching more records as before.
Could anybody tell me why this behaves like this.
Perfect solution is highly appreciated.
Regards,
Venkat Ramanan N
08-07-2006 4:01 PM
When you use the CP, you must also use the * in your value. For example, lets say that you want all material number that start with "B". Then you would do this.
move: 'I' to r_wildcard-sign,
<b>'CP' to r_wildcard-option,
'B*' to r_wildcard-low.</b>
append r_wildcard.
select * from mara
into table gt_mara_b
where mtart = 'YSAB'
and matnr in r_wildcard.
Regards,
Rich Heilman
08-07-2006 4:03 PM
EQ stands for Equality and when used in select stattements the select checks records in MARA where MATNR is exaclty equal to ++++++++++B
CP stands for Contains Pattern and when used in select stattements the select checks records in MARA where MATNR contains the pattern ++++++++++B
-Kiran
Please reward useful answers
08-07-2006 4:05 PM
Hi Rich,
That is ok. But my question is why there is difference in behaviour in this case. In my case always the last letter will end with B.
I used '++++++++++B'(for EQ condition) before and it was giving lot of records, but now nothing. But when I change 'EQ' to 'CP' it is working.
Is there any SAP notes that we have apply.
Regs,
Venkat Ramanan N
08-07-2006 4:07 PM
Hello Guys,
I would appreciate if anyone could give different solutions.
Please don't explain about what is CP and EQ. This is very basic thing.
Regs,
Venkat Ramanan N
08-07-2006 4:12 PM
Venkat,
Try the below
MOVE: 'I' TO r_wildcard-sign,
'CP' TO r_wildcard-option,
'*B' TO r_wildcard-low.
APPEND r_wildcard.
SELECT * FROM mara
INTO TABLE gt_mara_b
WHERE mtart = 'YSAB'
AND matnr IN r_wildcard.
Regards
Anurag
08-07-2006 4:16 PM
Hello All,
There is lot of difference between using '*B' and '++++++++++B'. I'm concerned only about the pattern
'++++++++++B'.
Regs,
Venkat Ramanan N
08-07-2006 4:25 PM
08-07-2006 4:36 PM
> I don't know why EQ '++++++++++B', would bring you
> anything but a material which is exactly
> '+++++++++B'. I've never seen "" used as a
> wildcard.
>
> Regards,
> Rich Heilman
+ can act as a wildcard for one position within your variable only e.g H+R Would bring back HOR, HIR, HAR but not HEAR etc.
I think that the original poster needs to review why if the last position is always going to be B why he feels that CP and *B is not sufficient for his needs, as it sounds like it should be perfectly correct.
Rgds
Rosie Brent
08-07-2006 4:43 PM
hi Rosie,
if + is as single character then there should be the difference in ++++++++++B' with EQ and CP.as both are different.but he is getting same no of records ?
how this will happen ? of having different conditions in where clause & getting same no of entries ?
regards
srikanth
08-07-2006 4:49 PM
With the options CP and NP, the LOW and HIGH fields must be of type C, and LOW must contain at least one wildcard character. In this context, + represents a single character, while * represents any character string, even if it is blank.
CP and NP are the only options where + and * act like this. Therefore, the line
I BT A* D*
in no way defines a set of records starting with all those which begin with " A" and ending with all those which begin with "D", but rather the set of all records which are greater than or equal to the single values " A" and less than or equal to "D". This set is smaller since, if the character "Z" in the character set is greater than " *" and the value "DZ" starts with "D", it is not part of the defined set.
If you check on the above explaination...it is advisable to use CP when using wild-char either + or *. It is very difficult to explain why the EQ signed fetch records first time round !!
Regards
Anurag
Regards
Anurag
08-07-2006 4:36 PM
Hi Rich,
I also have the same doubt, the program was already developed by someone. Now it is giving a strange problem like this.
So I'm still analysing. Let me see what's the exact problem. I'm debugging simultaneously with different option in select options.
Regs,
Venkat Ramanan N