2013 Feb 27 7:59 PM
Hi Gurus ,
I am having a problem with this select query , when the select options is initial it is not returning any data into the internal table .
I could not find out where the problem is .
Please help.
select matnr HERKL into corresponding fields of table lt_marc from marc
where matnr in S_matnr
and Beskz = p_beskz
and ekgrp = P_ekgrp
and lgpro in s_lgpro
and dispo in S_dispo
and werks = P_werks.
I am providing only input in S_matnr .
S_ : select options
P_ : are parameters.
Please help,
Bharathi
2013 Feb 27 10:11 PM
problem was with input parameters not select options . I was assuming that the problem was with select-options .
I used if clause to verify parameters are initial and added it to where clause and not everything is fine.
2013 Mar 04 6:25 AM
Hi Bharathi,
Please check your values in parameter option if parameter is initial than ur select query will fail & wont fill your internal table. U can also cross check it by commenting parameter where conditions 'Beskz = p_beskz, ekgrp = P_ekgrp & werks = P_werks' . I hope it will solve your problem.
Reward points once solution work.
Regards,
Amol Patil
2013 Mar 18 3:58 PM
Dear Bharathi,
It seems that the problem is with your mentioned Parameters as whenever you declare the Parameters you should make sure that you are passing the values from the selection screen else it will treat the value of that parameter as space .
As your telling you are just providing the S_MATNR value as input so in this case select query will look the data from table where 'Beskz = space and ekgrp = space and werks = space' and in almost all cases this combination will not give you the data .
Thanks
Mallikarjun
2013 Mar 20 10:14 AM
Hi Bharathi,
SELECT matnr " key field
werks " key field
herkl " your required field
into corresponding fields of table lt_marc from marc
where matnr in S_matnr[]
and werks = P_werks.
IF sy-subrc <> 0.
*Show Message
LEAVE LIST-PROCESSING.
ELSE.
*Deleting extra value which is not matched .
DELETE lt_marc WHERE NOT (
Beskz = p_beskz
and ekgrp = P_ekgrp
and lgpro in s_lgpro[]
and dispo in S_dispo).
IF lt_marc[] IS NOT INITIAL.
SORT lt_marc[] BY matnr werks.
ELSE.
*Show Message
endif.
endif.
Try this,I think you will get the result.
Thanks,
Pravanjan
2013 Mar 20 10:38 AM
Hi,
Don't use your parameters as initial, due that only the select query was not fetching the data. parameters are mandatory field mostly,
if you want to pass the empty parameter create a Range and pass your parameter value to the Range low value and give condition using IN key word.