‎2005 Nov 21 2:12 PM
Hi,
PARAMETERS: P_MAKTX TYPE MAKT-MAKTX.
Lets say the user inputs "Pump". I want the program to search the text "pump" in all makt-maktx and display the result.
Could someone tell me how to write the select statement.
SELECT * from MAKT into table IT_MAKT where MAKTX ??? P_MAKTX.
Please advise.
Regards,
Shobhit
‎2005 Nov 21 2:16 PM
Hi Shobit,
use the like addition,
PARAMETERS srch_str(20) TYPE c.
CONCATENATE '%' srch_str '%' INTO srch_str.
DATA text_tab TYPE TABLE OF doktl.
SELECT *
FROM doktl
INTO TABLE text_tab
WHERE doktext LIKE srch_str.
In your case it would be
CONCATENATE '%' P_MAKTX '%' INTO P_MAKTX.
SELECT * from MAKT into table IT_MAKT where MAKTX like P_MAKTX.
regards,
Ravi
Message was edited by: Ravi Kanth Talagana
Message was edited by: Ravi Kanth Talagana
‎2005 Nov 21 2:20 PM
Try this....
This is an example for using the parameter. You could use a select-option instead.
report zrich_0001
no standard page heading.
data: imakt type table of makt with header line.
parameters: p_maktx type makt-maktx.
ranges: r_maktx for imakt-maktx.
r_maktx-sign = 'I'.
r_maktx-option = 'CP'.
concatenate '*' p_maktx '*' into r_maktx-low.
condense r_maktx-low.
append r_maktx.
select * into corresponding fields of table imakt
from makt
where maktx in r_maktx
and spras = sy-langu.
loop at imakt.
write:/ imakt-matnr, imakt-maktx.
endloop.
Regards,
Rich Heilman
‎2005 Nov 21 2:20 PM
‎2005 Nov 21 7:09 PM
Just remember that this is case sensitive, so instead, use the MAKTG field which has the uppercase equivalent description. You can change your user input also into uppercase and use the code that others mentioned here.
Srinivas
‎2005 Nov 21 7:11 PM