Skip to Content
0
Nov 30, 2006 at 09:56 PM

Dynamic Select

41 Views

Hi All,,

I have an interntal like this:-->

data : begin of i_ytab,

matnr like mara-matnr,

pstat like mara-pstat,

mtart like mara-mtart,

matkl like mara-matkl,

bstme like mara-bstme.

data : end of o+ytab.

The internal table i_ytab have the following values

MATNR PSTAT MTART MATKL BSTME

1 P1 1A M23 M34

2 P2 2A M34

Using this i need to create dynamic select statement like the following

WHERE MATNR EQ '1' AND

PSTAT EQ 'P1' AND

MTART EQ '1A' AND

MATKL EQ 'M23' AND

BSTME EQ 'M34'.

and 2 record it should like this

WHERE MATNR EQ '2' AND

PSTAT EQ 'P2' AND

MTART EQ '2A' AND

MATKL EQ 'M34 ' AND

BSTME EQ ' '.

I like to know is there any function module to create dynamic select statments from

internal table values or from workarea values?

Thanks

aRs