2014 Feb 10 6:28 AM
Hi All,
The below query should ideally not work when range table : s_blart_final is empty .But somehow its still working and fetching data.
How can I rectify this??
SELECT rprctr
rbukrs
kunnr
ryear
poper
budat
racct
docnr
docln
blart
refdocnr
ksl
rtcur
usnam
matnr
rassc
vkbur
spart
werks
msl
hsl
tsl
fkart
bwtar
refdocln
drcrk
FROM glpca
UP TO 2501 ROWS
INTO TABLE gt_glpca_2k
FOR ALL ENTRIES IN gt_bukrs_hkont
WHERE rbukrs EQ gt_bukrs_hkont-bukrs
AND racct EQ gt_bukrs_hkont-hkont
AND rhoart = gc_rhoart
AND kokrs = gc_kokrs
AND ryear IN s_ryear
AND activ = gc_activ
AND poper IN s_poper
AND rldnr = gc_rldnr
AND rrcty = gc_rrcty
AND rvers = gc_rvers
AND blart IN s_blart_final
AND werks IN s_werks
AND matnr IN s_matnr
AND vkbur IN s_vkbur
AND kunnr IN s_kunnr.
Regards,
Faiz
2014 Feb 10 6:32 AM
Why it should not work a blank range is as good as this field is not considered for filtering out the selection.. you are expecting it to pick on values where document type is initial?
Nabheet
Why it should not work a blank range is as good as this field is not considered for filtering out the selection.. you are expecting it to pick on values where document type is initial?
Nabheet
2014 Feb 10 6:32 AM
Why it should not work a blank range is as good as this field is not considered for filtering out the selection.. you are expecting it to pick on values where document type is initial?
Nabheet
2014 Feb 10 6:40 AM
Hi nabheet,
my requirement is that if this range field :s-blart_final is empty, then the query should fail.
How do I achieve this???
2014 Feb 10 6:45 AM
Then simple put a check before the query if S_BLART[] is not initial
2014 Feb 10 6:34 AM
Hi Faiz,
If s_blart_final is empty, it will fetch all the values from table glpca corresponding to blart.
If s_blart_final is having any values, it will fetch the corresponding blart from table glpca.
Arivazhagan S
2014 Feb 10 6:45 AM
Hi Rahman,
yeah sivasamy correctly said if s_blart_final is empty it will select the all the possible values.
if had any value mean it will select the condition with respect to s_blart_final values.
Regards,
Thangam.P
2014 Feb 10 6:49 AM
Your are using s_blart_final as a range table, so this condition work as an optional check, if value exist in s_blart_final then it will check for the condition otherwise it will skip this condition.
If u want to make s_blart_final mandatory then you have to check it it initial or not before select query..
if s_blart_final[ ] is not initial.
<SELECT QUERY>
endif.
And you are also using FOR ALL ENTRIES so make sure that gt_bukrs_hkont is not empty.
2014 Feb 10 6:59 AM
Hi Faizur,
just write before fetching data to check
IF s_blart_final is not initial.
SELECT ......
ENDIF.
You don't have to worried about it too much.
2014 Feb 10 7:02 AM
2014 Feb 10 7:05 AM
Hi,
Before writing select query u check s_blart_final table is empty or not,
If s_blart_final[] is not initial then proceed other wise exit..
Regards
Abhay Manna.
2014 Feb 10 7:50 AM
Hi Rahman,
If s_blart_final is empty then query will fetch the record from database, If you're requirement is that the query should not get executed when s_blart_final is initial then perform a check
IF s_blart_final[ ] is not initial.
Select Query * . . .
ENDIF.
Regards,
Nooruddin
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |