2006 Mar 17 7:40 AM
Hi all ,
i have a database table but0id and field IDNUMBER
and i have four input parameters say input1,input2,input3,input4.
input1 corresponds to first two characters of database field IDNUMBER.
and Input2 corresponds to but0id-IDNUMBER+2(5)
and input3 = but0id-IDNUMBER+8(3)
and input3 = but0id-IDNUMBER+11(2)
out of these four input parameters only first one is mandatory and all the others are optional.
i need to write a select statement
which will compare like input one with first two characters of Idnumber and so on
please help me
Thanks in Advance
2006 Mar 17 8:08 AM
Hi,
Try this and kindly reward points by clicking the star on the left of reply,if it helps.
data itab type standard table of but0id.
select * from but0id into table itab
where idnumber like 'input1%'
and idnumber like '%input2%'
and idnumber like '%input3%'
and idnumber like '%input4'.
But here % refers to set of characters.
Hi all ,
i have a database table but0id and field IDNUMBER
and i have four input parameters say input1,input2,input3,input4.
input1 corresponds to first two characters of database field IDNUMBER.
and Input2 corresponds to but0id-IDNUMBER+2(5)
and input3 = but0id-IDNUMBER+8(3)
and input3 = but0id-IDNUMBER+11(2)
out of these four input parameters only first one is mandatory and all the others are optional.
i need to write a select statement
which will compare like input one with first two characters of Idnumber and so on
please help me
Thanks in Advance
2006 Mar 17 7:50 AM
select wont allow u to take the offeset on the db field.
Instead of that select data from DBtable and put it into internal table.
then loop and check with the offsets for all input values and try to delete the unwanted values.
Thanks
eswar
2006 Mar 17 7:56 AM
Dear Sai ram,
You want to write an SQL statement to retreive data from table based on your parameters isn't it. But values corresponding to sub-string values. Hope I got your problem correct.
You could solve in this way.
Code Starts
DATA : wa_but0id TYPE BUT0ID.
CONCATENATE input1 '*' INTO x.
SELECT SINGLE *
INTO CORRESPONDING FIELDS OF wa_but0id
FROM BUT0ID
WHERE IDNUMBER CP x.
Hope it helps.
Regards,
Deva.
2006 Mar 17 8:08 AM
Hi,
Try this and kindly reward points by clicking the star on the left of reply,if it helps.
data itab type standard table of but0id.
select * from but0id into table itab
where idnumber like 'input1%'
and idnumber like '%input2%'
and idnumber like '%input3%'
and idnumber like '%input4'.
But here % refers to set of characters.
2006 Mar 17 8:21 AM
Can try this...
tables: E3EDK25,TRAUTHREC,mara,PPFSRMTYP.
data: fld like mara-matnr.
data: begin of tab occurs 0.
include structure mara.
data: end of tab.
parameters: inp like E3EDK25-qualf,
inp2 like PPFSRMTYP-option,
inp3 like E3EDK25-qualf,
inp4 like TRAUTHREC-object.
if inp = ' '.
inp = '*'.
endif.
if inp2 = ' '.
inp2 = '*'.
endif.
if inp3 = ' '.
inp3 = '*'.
endif.
if inp4 = ' '.
inp4 = '*'.
endif.
concatenate inp inp2 inp3 inp4 into fld.
replace all occurrences of '*' in fld with '%'.
select * from mara into table tab where matnr like fld.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |