Para crear
una SELECT dinámica hacemos lo siguiente:
DATA : w_field(10),
i_field LIKE TABLE OF w_field,
aux TYPE wogxxx.
i_field LIKE TABLE OF w_field,
aux TYPE wogxxx.
CLEAR w_field.
REFRESH i_field.
REFRESH i_field.
CONCATENATE c_wog0 mes INTO w_field.
APPEND w_field TO i_field.
APPEND w_field TO i_field.
* Coste teorico
CLEAR: aux,
p_teorico.
SELECT (i_field)
INTO aux
FROM cosp
WHERE objnr = p_objnr AND
versn = c_versn AND
wrttp = c_wrttp_05 AND
hrkft = p_hrkft.
p_teorico = p_teorico + aux.
ENDSELECT.
CLEAR: aux,
p_teorico.
SELECT (i_field)
INTO aux
FROM cosp
WHERE objnr = p_objnr AND
versn = c_versn AND
wrttp = c_wrttp_05 AND
hrkft = p_hrkft.
p_teorico = p_teorico + aux.
ENDSELECT.
DATA: cond(72) TYPE c,
itab LIKE TABLE OF cond.
DATA wa TYPE spfli-cityfrom.
PARAMETERS: city1(10) TYPE c,
city2(10) TYPE c.
CONCATENATE 'CITYFROM = ''' city1 '''' INTO cond.
APPEND cond TO itab.
CONCATENATE 'OR CITYFROM = ''' city2 '''' INTO cond.
APPEND cond TO itab.
CONCATENATE 'OR CITYFROM = ''' 'BERLIN' '''' INTO cond.
APPEND cond TO itab.
SELECT cityfrom
INTO wa
FROM spfli
WHERE (itab).
ENDSELECT.
No hay comentarios:
Publicar un comentario