2012 Aug 01 2:26 PM
Need to use the check condition to check only the second digit .
Eg. SELECT MATNR
INTO WL_MATNR
FROM MARA UP TO 1 ROWS
WHERE MATNR = PI_MATNR
AND MTART IN PI_MTART(Range Table but value can also be assigned as an constant)
ENDSELECT.
Here MTART should check only the second character of PI_MTART.
2012 Aug 02 7:44 AM
Hi,
I'm not very sure if I understand your question correctly but let me propose something.
You could use the "+" character.
In range PI_MTART, if you enter "+1++" it will select only materials that have "1" in the second digit of the material type. "+" stands for any one character .
To be more clear : "*1*" will select all the materials that have "1" in the type ( 0101,0001,0010 etc).
"+1++" will select all the materials that have "1" in the second place of the material type ( 0100,0110,0199 etc).
Regards.
Need to use the check condition to check only the second digit .
Eg. SELECT MATNR
INTO WL_MATNR
FROM MARA UP TO 1 ROWS
WHERE MATNR = PI_MATNR
AND MTART IN PI_MTART(Range Table but value can also be assigned as an constant)
ENDSELECT.
Here MTART should check only the second character of PI_MTART.
2012 Aug 01 9:01 PM
You can use the LIKE keyword in the where condition, and use wildcards '_' and '%'. The F1 help for the LIKE keyword will give you more information. For example, if you only want to select records where the second letter of the material type is 'R':
SELECT matnr INTO TABLE gi_mara
FROM mara
WHERE mtart LIKE '_R%'.
2012 Aug 02 5:00 AM
Alex my Exact requirement is for example if mtart in table contains values like 01,02,03 and in our internal table ie PI_MTART there are values like 11,12,13 .
Here it should check only the second value(Not a constant pattern of values) and so SY-SUBRC should be 0 in the above case when checked in where condition.
2012 Aug 02 5:22 AM
Hi Krishna,
If you loop through the range and then do the select for each individually you can specify the value of the search. Not efficient program but it will get the job done.
loop at yourrange.
SELECT MATNR INTO yourwork_area FROM MARA UP TO 1 ROWS
WHERE MATNR = PI_MATNR
AND MTART = PI_MTART+5 (2) .
APPEND work_area TO youritab.
ENDSELECT.
Regards,
sifter
2012 Aug 02 5:48 AM
Hi ,
first create Work area type PI_MTART.(i.e fs_mtart1, fs_mtart2 ) and range table (i.e PI_mtart)
loop at PI_MTART into fs_mtart.
fs_mtart2-field = fs_mtart1-field+1(1).( if field length is 2 ).
append to fs_mtart2 to pi_mtart1.
endloop.
after that use the PI_MTART1 instead of PI_MTART.
Regards.
Venkat.
2012 Aug 02 7:36 AM
@ Jasd & Thandalam : Appreciate your efforts. But here the main key is that the
Where mtart in PI_mtart here mtart will contain values from table mara so we should check the
second digit of mtart ie (MARA-MTART for eg 01,02,03) we should consider *1,*2,*3 from mtart and should check with our PI_MTART second digit.
2012 Aug 02 7:44 AM
Hi,
I'm not very sure if I understand your question correctly but let me propose something.
You could use the "+" character.
In range PI_MTART, if you enter "+1++" it will select only materials that have "1" in the second digit of the material type. "+" stands for any one character .
To be more clear : "*1*" will select all the materials that have "1" in the type ( 0101,0001,0010 etc).
"+1++" will select all the materials that have "1" in the second place of the material type ( 0100,0110,0199 etc).
Regards.
2012 Aug 02 7:55 AM
Just to extend what Former Member has mentioned your RANGE table should look like:
| SIGN | OPTION | LOW | HIGH |
|---|---|---|---|
| I | CP | +1* | |
| I | CP | +2* |
This will look for Material types having '1' and '2' in the second position
BR,
Suhas
PS: If you read the online documentation you could have found the answer yourself
2012 Aug 02 7:56 AM
Hi Laurent,
I value your effort. The actual requirement is " if you enter "+1++" " here the second digit can be have four values.
For eg. 01,02,03,04 but what you proposed will only consider 01 .
Where mtart in PI_mtar
eg. In mara table if mtart contains 01,02,03,04 and in our case we are taking four constant values for PI_mtart range table (11,22,33,44) so the output should be that in SELECT query it should consider only the second digit of mtart(MARA table) & PI_mtart range table.
2012 Aug 02 8:04 AM
So create 4 lines in the range table :
+1++
+2++
+3++
+4++
All with sign I and option CP.
Am I understanding your problem correctly ?
Regards.
2012 Aug 02 8:18 AM
2012 Aug 02 8:19 AM