09-25-2008 8:44 AM
Hi,
I have a doubt in using the relational operator 'OR'.
Consider the below case:
To fetch data where FLTYP is equal to A or B or G.
1) SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR AND SPRAS = 'E' AND
( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' ).
It is not working if i give it like this
2) WHERE TPLNR = T_ILOA-TPLNR AND
( FLTYP = 'B' ) OR ( FLTYP = 'A' ) OR ( FLTYP = 'G' ) AND SPRAS = 'E' .
If i give it as above , its not fetching data where FLTYP = B, but its fetching for 'A' and 'G'.
3) WHERE ( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' ) AND
( SPRAS = 'E' AND TPLNR = T_ILOA-TPLNR ).
This is also not working.
How do i check this condition with 'OR' operator.
Help me on this issue.
Regards,
P.S.Chitra
09-25-2008 8:57 AM
Hi
Here is some analysis.
1) SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR AND SPRAS = 'E' AND
( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' ).
- In this case first it will check TPLNR value and then language 'E' if both the conditions satisfied then only it will check for FLTYP is B or A or G.
2) WHERE TPLNR = T_ILOA-TPLNR AND
( FLTYP = 'B' ) OR ( FLTYP = 'A' ) OR ( FLTYP = 'G' ) AND SPRAS = 'E' .
Here analyzing is difficult. it will check TPLNR value and fltyp value B. if the combination is wrong then only it will check fltyp = A. i mean here even though TPLNR value is not in list it will fetch data based on fltyp = A or G. as you specified AND for language at the end .. it will work like this
case 1: TPLNR value satisfied and fltyp = B - record will fetch
case 2: case 1 not satisfied. fltyp = A and language = E - record will fetch
case 3: case 1 and 2 not satisfied. fltyp = G and language = E - fetches the record
all other conditions dont fetch record.
3) WHERE ( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' ) AND
( SPRAS = 'E' AND TPLNR = T_ILOA-TPLNR ).
here fltyp should be one among B/A/G and language shld be E and TPLNR should match.. then only record will come.
basically OR will work as any of the value is true then it will fetch record. here i think your prob is with AND.
if you want records with FLTYP = B/A/G and language = E give like this
where ( FLTYP = 'B' or FLTYP = 'A' or FLTYP = 'G' ) AND SPRAS = 'E'.
not in the abouve records you want only records whose TPLNR is in your list.. then give another AND
where ( FLTYP = 'B' or FLTYP = 'A' or FLTYP = 'G' ) AND SPRAS = 'E' AND TPLNR = T_ILOA-TPLNR.
my suggestion is first give only ( FLTYP = 'B' or FLTYP = 'A' or FLTYP = 'G' in WHERE check the result next add SPRAS .. check output next add TPLNR condition..
it will work.
09-25-2008 8:57 AM
Hi
Here is some analysis.
1) SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR AND SPRAS = 'E' AND
( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' ).
- In this case first it will check TPLNR value and then language 'E' if both the conditions satisfied then only it will check for FLTYP is B or A or G.
2) WHERE TPLNR = T_ILOA-TPLNR AND
( FLTYP = 'B' ) OR ( FLTYP = 'A' ) OR ( FLTYP = 'G' ) AND SPRAS = 'E' .
Here analyzing is difficult. it will check TPLNR value and fltyp value B. if the combination is wrong then only it will check fltyp = A. i mean here even though TPLNR value is not in list it will fetch data based on fltyp = A or G. as you specified AND for language at the end .. it will work like this
case 1: TPLNR value satisfied and fltyp = B - record will fetch
case 2: case 1 not satisfied. fltyp = A and language = E - record will fetch
case 3: case 1 and 2 not satisfied. fltyp = G and language = E - fetches the record
all other conditions dont fetch record.
3) WHERE ( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' ) AND
( SPRAS = 'E' AND TPLNR = T_ILOA-TPLNR ).
here fltyp should be one among B/A/G and language shld be E and TPLNR should match.. then only record will come.
basically OR will work as any of the value is true then it will fetch record. here i think your prob is with AND.
if you want records with FLTYP = B/A/G and language = E give like this
where ( FLTYP = 'B' or FLTYP = 'A' or FLTYP = 'G' ) AND SPRAS = 'E'.
not in the abouve records you want only records whose TPLNR is in your list.. then give another AND
where ( FLTYP = 'B' or FLTYP = 'A' or FLTYP = 'G' ) AND SPRAS = 'E' AND TPLNR = T_ILOA-TPLNR.
my suggestion is first give only ( FLTYP = 'B' or FLTYP = 'A' or FLTYP = 'G' in WHERE check the result next add SPRAS .. check output next add TPLNR condition..
it will work.
09-25-2008 10:35 AM
Hi,
Thanks for your help and effort taken to explain but none of it is working.
Can you suggest any other method?
Regards,
P.S.Chitra
09-25-2008 8:59 AM
Hi,
SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR
AND SPRAS = 'E'
AND ( FLTYP = 'B'
OR FLTYP = 'A'
OR FLTYP = 'G' ).
this should work.
it is better create a range table for FLTYP and fill that range table and use .
data:
t_range type range of FLTYP.
t_range-low = 'A'.
t_range-sigh = 'I'.
t_range-option = 'EQ'.
append t_range.
t_range-low = 'B'.
t_range-sigh = 'I'.
t_range-option = 'EQ'.
append t_range.
t_range-low = 'G.
t_range-sigh = 'I'.
t_range-option = 'EQ'.
append t_range.
and write select as .
SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR
AND SPRAS = 'E'
AND FLTYP in t_range.
or u can write select as.
SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR
AND SPRAS = 'E'
AND FLTYP in ( 'A' 'B' 'G').
please check syntax for this.
09-25-2008 10:36 AM
Hi,
Thanks for your help but none of it is working.
Can you suggest any other method?
Regards,
P.S.Chitra
09-25-2008 8:59 AM
Hi,
You might want to try this:
SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR AND SPRAS = 'E' AND
FLTYP IN ('B','A','G').
09-25-2008 9:01 AM
09-25-2008 10:43 AM
Hi,
Thanks Rainer Hübenthal . Its not working.
Anyother option?
Regards,
P.S.Chitra
09-25-2008 10:50 AM
hi,
c1: TPLNR = T_ILOA-TPLNR
c2: SPRAS = 'E'
c3: FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G'
FLTYP should be one of the B,A,G, so you must put bracket for this set of condition.you can consider like above.you can change the order of above. but condition(c3) must be in brackets.so your first code is right.The below all coding are correct. it will give same result, but order is changed.
1.
TPLNR = T_ILOA-TPLNR AND SPRAS = 'E' AND
( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' )
2.
TPLNR = T_ILOA-TPLNR AND ( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' ) AND SPRAS = 'E'
3.
SPRAS = 'E' AND
( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' ) AND TPLNR = T_ILOA-TPLNR
09-25-2008 10:55 AM
I think there could be two reasons:
1. Really no record matches with the selection criteria ==> this could be easily checked in SE16
2. There is a conversion exit on TPLNR, so the question is how t_iloa is filled with values?
09-25-2008 11:01 AM
Hi,
I have done the conversion as given below,hope am correct ,the problem is with the OR operate used in the where condition.
The converted TPLNR from ILOA exists in IFLO table in SE16.
SELECT ILOAN
TPLNR
FROM ILOA INTO TABLE T_ILOA
FOR ALL ENTRIES IN T_EQUZ
WHERE ILOAN = T_EQUZ-ILOAN.
*To convert the format of TPLNR from ILOA table
LOOP AT T_ILOA INTO W_ILOA.
CALL FUNCTION 'CONVERSION_EXIT_TPLNR_OUTPUT'
EXPORTING
INPUT = W_ILOA-TPLNR
IMPORTING
OUTPUT = W_ILOA-TPLNR.
MODIFY T_ILOA FROM W_ILOA.
ENDLOOP.
*To fetch the TPLNR and FLTYP by passing the ILOA-TPLNR with the condition FLTYP = A/B/G
IF T_ILOA[] IS NOT INITIAL.
SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR AND ( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' ).
.
*To convert the format of TPLNR from IFLO table
LOOP AT T_IFLO INTO W_IFLO.
CALL FUNCTION 'CONVERSION_EXIT_TPLNR_OUTPUT'
EXPORTING
INPUT = W_IFLO-TPLNR
IMPORTING
OUTPUT = W_IFLO-TPLNR.
MODIFY T_IFLO FROM W_IFLO.
ENDLOOP.
Can you suggest any conclusion for this issue?
Regards,
P.S.Chitra
09-25-2008 11:04 AM
remove (or comment) this part:
*To convert the format of TPLNR from ILOA table
LOOP AT T_ILOA INTO W_ILOA.
CALL FUNCTION 'CONVERSION_EXIT_TPLNR_OUTPUT'
EXPORTING
INPUT = W_ILOA-TPLNR
IMPORTING
OUTPUT = W_ILOA-TPLNR.
MODIFY T_ILOA FROM W_ILOA.
ENDLOOP.
this is the case when you DON'T need the conversion exit, because the data is directly from the DB in unconverted format and that is the format you'll need by DB selection as well.
09-25-2008 11:16 AM
Hi,
Thanks for your response Eric Cartman.
As per your suggestion i removed that conversion part but still its not working.
When i use it as below its working,but that is not the correct way.
SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR OR ( FLTYP = 'B' OR FLTYP = 'A' OR FLTYP = 'G' ).
No other way is working.
I tried all the replies pertaining to this thread but its ineffective.
What else can be done?
Regards,
P.S.Chitra
09-25-2008 12:05 PM
as I told the other problem could be that the record really does not exist (with the given conditions) - this can easily be checked in SE16. Could you please check if it is maintaned in English? and the FLTYP is A or B or G...
09-25-2008 12:25 PM
Hi,
I checked in SE16 the record for my input exists in both ILOA and IFLO.Tried passing i/p data in DB level with SPRAS = 'E' and without passing the lang(SPRAS) ,it gives me the result.
Lang SPRAS = 'E' is correct.It exists for the given input in SE16.Hope this is not the problem.
I removed the condition SPRAS = 'E' in my where condt but still its not working.
Can you give me anyother suggestion?
Regards,
P.S.Chitra
09-25-2008 12:35 PM
Hi,
My i/p is in such a way that ITS FLTYP is either A/B/G and has lang="E' and IFLO-FLTYP amtches with ILOA-FLTYP.
Regards,
P.S.Chitra
09-25-2008 12:45 PM
Hi chitra,
Instead of INTO TABLE T_IFLO you can try using INTO CORRESPONDING FIELDS OF TABLE T_IFLO as you are selecting only two fields.
Try and revert back.
Regards
Karthik D
09-25-2008 12:58 PM
Hi Karthik,
Good attempt but its not working.
Anyother suggestions?
Regards,
P.S.Chitra
09-25-2008 11:24 AM
Hello,
Please use conversion routine 'CONVERSION_EXIT_TPLNR_INPUT while selecting data from IFLO view.
Regards,
Rajat
09-25-2008 11:35 AM
Hi,
The FM 'CONVERSION_EXIT_TPLNR_INPUT' does nothing.
Anyother suggestion?
Regards,
P.S.Chitra
09-25-2008 1:02 PM
Hello,
Use the IN operator.
SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR
AND SPRAS = 'E'
AND FLTYP IN ( 'B', 'A' ,'G' ).
This will work like OR.
Best regards,
Advait.
09-25-2008 1:05 PM
09-25-2008 1:07 PM
>
>...
> AND FLTYP IN ('B', 'A' ,'G' ).
>...
>
> Advait.
Remove the spaces before the first, and after the last option in brackets.
09-25-2008 1:07 PM
09-25-2008 1:09 PM
09-25-2008 1:12 PM
Hi,
Yeah , i did syntax check and corrected as FLTYP IN ('B', 'A' ,'G' ).
Still not working..............
Regards,
P.S.Chitra
09-25-2008 1:22 PM
Hi chitra,
I Guess this is because you need to use Conversion exit for TPLNR.
CONVERSION_EXIT_TPLNR_INPUT
You can check giving a single TPLNR number after passing it to the conversion exit.
Try and let me know.
Regards
Karthik D
09-25-2008 1:29 PM
Hi,
No its not working.
The FM CONVERSION_EXIT_TPLNR_INPUT does nothing.
I have used 'CONVERSION_EXIT_TPLNR_OUTPUT' which converts the format.
The problem is with the us of operator in the 'WHERE' condition.
Tell me anyother way to check all the conditions given in my 'WHERE' condition.
Regards,
P.S.Chitra
09-25-2008 1:38 PM
Hi Chitra,
If you find entries in SE16, then you should find them in your query as well.
Check one thing if you can , the FLTYP data element has a check table T370F, check in that table if B, A and G are maintained.
regards,
Advait.
09-25-2008 2:00 PM
Hi,
The last thing what you can try is to select the entries with a wider selection criteria and filter them in a loop.
SELECT TPLNR
FLTYP
FROM IFLO INTO TABLE T_IFLO
FOR ALL ENTRIES IN T_ILOA
WHERE TPLNR = T_ILOA-TPLNR AND SPRAS = 'E'.
loop at t_iflo.
IF t_ilfo-fltyp = 'B'
or t_ilfo-fltyp = 'A'
or t_ilfo-fltyp = 'G' .
* entry is valid.
endif.
endloop
This will definitely work
regards,
Advait