2016 Sep 01 4:42 AM
hi,
im working on a scenario like below:
i have a function module-RFC which has a table type parameter containing fields, values and type i.e. parameter or selection option
ex: S, s_matnr, matnr, I, EQ, (LOW), (HIGH)--- selectoptions
P, p_date, data (VALUE) --- parameter
i have to build a select query like below
select * from (MARA) into table (<dyn_table>) where matnr in s_matnr and date = p_date.
the parameters that i pass to the FM will differ.
it may have only 2 parameters as above or 5 or 7 or n.
how can i build where condition?
i am able to build range of tables using below code:
TYPES:BEGIN OF ty_dyntab,
name TYPE string, "Int. table name
data TYPE REF TO data, "Int. table data
END OF ty_dyntab.
do lv_lines times.
write sy-index to lv_index no-ZERO.
CONCATENATE 'lt_table' lv_index into gs_dyntab-name.
read table i_selopt into wa_selopt index sy-index.
create DATA gs_dyntab-data type STANDARD TABLE OF (wa_selopt-field).
append gs_dyntab to gt_dyntab.
enddo.
2016 Sep 01 11:02 AM
You can put everything in variables :
SELECT (fields) FROM (table) ... WHERE (cond)
2016 Sep 01 11:11 AM