Hi all,
i have 7 parameters on my selection screen, my requirement is i need to fetch the records based on only fields for which the values are provided,only 2 are mandatory fields out of 7.
I have wrieen following code but it is giving a dump ' SAPSQL_WHERE_PARENTHESES' .
DATA : wa_options TYPE rfc_db_opt, it_options TYPE STANDARD TABLE OF rfc_db_opt, lv_weight(20) type c. CONSTANTS :c_and(3) type c value 'AND', c_eq(2) type c value 'EQ', c_sy(2) type c value '<='. CLEAR : wa_options. FREE : it_options. CONCATENATE 'FROM_POSTAL_CODE' c_sy p_shipto into wa_options-text SEPARATED BY space. APPEND wa_options to it_options. clear wa_options. CONCATENATE 'TO_POSTAL_CODE >=' p_shipto into wa_options-text SEPARATED BY space. APPEND wa_options to it_options. clear wa_options. lv_weight = p_weight. CONDENSE lv_weight. CONCATENATE 'WEIGHT_LIMIT >=' lv_weight into wa_options-text SEPARATED BY space. APPEND wa_options to it_options. clear wa_options. if p_plant is not INITIAL. CONCATENATE 'PLANT' c_eq p_plant c_and into wa_options-text SEPARATED BY space. APPEND wa_options to it_options. clear wa_options. endif. if p_shipc is not INITIAL. CONCATENATE 'SHIPING_COND' c_eq p_shipc c_and into wa_options-text SEPARATED BY space. APPEND wa_options to it_options. clear wa_options. endif. if p_carri is not INITIAL. CONCATENATE 'CARRIER_CODE' c_eq p_carri c_and into wa_options-text SEPARATED BY space. APPEND wa_options to it_options. clear wa_options. endif. if p_samed is not INITIAL. CONCATENATE 'SAME_DAY_FLAG' c_eq 'N' into wa_options-text SEPARATED BY space. APPEND wa_options to it_options. clear wa_options. endif. select * from ZOTC_FREIGHT_AUS into table i_final where (it_options).
Thanks & Regards,
Anjana Rao
Edited by: Matt on Jul 8, 2010 1:52 PM - Added tags for formatting