11-29-2007 4:43 PM
Hi SAP Gurus,
I have a requirement as below :
Parameters : DENSITY(3) TYPE C.
Actually this DENSITY field is 4th , 5th and 6th characters of the 10 digit material number .
Say if the material number is A123456789 then the DENSITY would be 456.
Now if the user enters this DENSITY in his selection screen, he has to get all the materials having this DENISTY from the table MARA.
I tried with the following code:
select matnr from mara into itab where matnr like %DENSITY%.
But it can give me materials with this DENSITY starting at the first character or 2nd character or anywhere.Hope u got my doubt.
Could any one help me out .It's very helpful to me.
Regards,
Vishnu.
11-29-2007 4:48 PM
Try with the code like this:
select matnr from mara into itab where matnr like '+++DENSITY%'.
Regards,
Naimesh Patel
11-29-2007 4:48 PM
Try with the code like this:
select matnr from mara into itab where matnr like '+++DENSITY%'.
Regards,
Naimesh Patel
11-29-2007 6:20 PM
Hi Naimesh,
I have tried your code.It's working perfectly.Thanks a lot.
Vishnu.
11-29-2007 6:30 PM
It worked? I think you have to use underscores in a SELECT statement.
Rob
11-29-2007 6:38 PM
Hi Rob,
It worked even with + character.Please let me know in case of any issues.
Vishnu.
11-30-2007 3:40 AM
I tried it and it didn't work and the documentation says to use underscores. Maybe they've changed it in higher releases. Which release are you on?
Rob
11-29-2007 4:48 PM
it is not good idea because of performance.
why dont you select all and then delete from internal table by comparing with your input values.
loop at itab into wa_tab.
if wa_tab+4(3)<> density.
delete from itab.
endif.
endloop.
11-29-2007 5:11 PM
Hi
I think selecting all Materials from Mara also will be a performance issue.
Experts should share there thoughts.
Thanks,
chaithanya.
11-29-2007 5:25 PM
You won't be able to use the index anyway.
But you can do this:
TABLES mara.
parameters p_den(3).
DATA: f1(10).
CONCATENATE '___' p_den '%' INTO f1.
SELECT * FROM mara
into table itab
WHERE matnr LIKE f1.
I removed a period from 'into itab'.
Rob
Message was edited by:
Rob Burbank