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

Delete Statement

Former Member
0 Likes
1,330

i have a code like below

DELETE lt_cddetails WHERE tabname EQ 'KONDAT' AND

                                  ( f_old EQ '00.00.000'  OR chngind EQ 'I' )


  If this internal table contains f_old as 00/00/0000 it is not deleting that entry. Is there any way to delete this for all null values ? ( other than adding all possible formats in OR condition ?


Regards,

Praveen

8 REPLIES 8
Read only

Former Member
0 Likes
1,138

hi,

date store internally different format so try this

DELETE lt_cddetails WHERE tabname EQ 'KONDAT' AND

                                  ( f_old eq '00000000' OR chngind EQ 'I' )


thanks

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,138

You can use delete itab wher f_old is initial. did you search before posting?

Read only

0 Likes
1,138

Check Below code

TYPES:

   BEGIN OF t_date,
     date TYPE sy-datum,
    END OF t_date.
DATA:
       i_date TYPE TABLE OF t_date,
       i_date_line TYPE t_date.

i_date_line-date = sy-datum.
APPEND i_date_line TO i_date.
CLEAR i_date_line.
APPEND i_date_line TO i_date.

DELETE i_date WHERE date IS INITIAL.


Thanks

Read only

Former Member
0 Likes
1,138

Here f_old is String type not of type sy-datum.

Regards,

Praveen

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,138

If the string data is not provided with a fixed format, you could expect a null value to contain only space, '0', '.', '-' and '/',  So you could use a test like


WHERE f_old CO ' 0.,-/'.

(ref - log_exp - Comparison Operators for Character-Like Data Types)

Regards,

Raymond

Read only

Former Member
0 Likes
1,138

try like this

DELETE lt_cddetails WHERE tabname EQ 'KONDAT' AND

                                  ( f_old is intial OR chngind EQ 'I' )


Read only

0 Likes
1,138

F_old is string field we can't use initial here.Here CO '0./- ' is working for me.

Regards,

Praveen

Read only

0 Likes
1,138

delete FROM tabnam WHERE date <= '01.01.0001' and field = 'xxx'.


I think it gives u the answer u required.


regards,

N.SUDHAKAR