Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how can i write the bellow code using field symbols

Former Member
0 Likes
669

data : it_mara type table of mara.

select * from mara

into it_mara.

delete it_mara where matnr = '100-100'

and meins = 'KG'.

if i do the same by using field symbols

i am getting data into <it_mara>

but

delete <it_mara> where matnr = '100-100'

and meins = 'KG'.

is showing syntax error

how to correct the error ?

data : it_mara type table of mara.

select * from mara

into it_mara.

delete it_mara where matnr = '100-100'

and meins = 'KG'.

if i do the same by using field symbols

i am getting data into <it_mara>

but

delete <it_mara> where matnr = '100-100'

and meins = 'KG'.

is showing syntax error

how to correct the error ?

3 REPLIES 3
Read only

Former Member
0 Likes
640

you can do this...

data : it_mara type table of mara.
types: t_mara type standard table of mara.
field-symbols: <it_mara> type t_mara.

select * from mara
into table it_mara.

assign it_mara to <it_mara>.

 
delete <it_mara> where matnr = '100-100'
and meins = 'KG'.

Read only

Former Member
0 Likes
640

I think, DELETE does not allows to dynamically define the logical expression for the WHERE clausule.

Have you tried by filtering data in SELECT statement??

Something like:


if dataBase = 'MARA'.
append 'MATNR <> '100-100'' to Itab_Where[].
append 'AND MEINS <> 'KG'' to Itab_Where[].
endIf.
...
select * from (dataBase) where (Itab_Where) into table <my_table>.

this is possible, but I don't know if this fits your requirements.

Read only

Former Member
0 Likes
640

its solved