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

IF condition

Former Member
0 Likes
748

Hi,

please check below code...

loop at tab_ep.

if tab_ep-mwskz = '0' .

delete tab_ep index sy-tabix.

ENDIF.

ENDLOOP.

my requirement is whenever in tab_ep-mwskz contains 0 in any position, line should be deleted but this IF condition is not working....

is there any other way to fulfill my requirement....

Thanks..

Amit.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
730

hi,

do this way

loop at tab_ep.

if tab_ep-mwskz cp '0' .

delete tab_ep index sy-tabix.

ENDIF.

ENDLOOP.

7 REPLIES 7
Read only

Former Member
0 Likes
731

hi,

do this way

loop at tab_ep.

if tab_ep-mwskz cp '0' .

delete tab_ep index sy-tabix.

ENDIF.

ENDLOOP.

Read only

Former Member
0 Likes
730

hello Jonny-

i dont think if condition is necessary for your requirement.

Find the logic below....

loop at tab_ep.

delete table tab_ep where mwskz = '0'.

ENDLOOP

Read only

Former Member
0 Likes
730

Hi,

I can sugesst an alternative.

data : v_mwskz(10) type c.

loop at tab_ep.

move tab_ep-mwskz to v_mwskz.

search v_mwskz for 0.( Please check the syntax)

if sy-subrc = 0.

delete tab_ep index sy-tabix.

ENDIF.

ENDLOOP.

Reward if helpful.

Regards

Sourabh Verma

Read only

Former Member
0 Likes
730

Hi Jony.

code like this -


loop at tab_ep where mwskz CP '0'.

delete tab_ep

endloop.

regards,

pankaj

Read only

Former Member
0 Likes
730

Hi,

loop at tab_ep.

if tab_ep-mwskz = '0' .

delete tab_ep index sy-tabix.

ENDIF.

ENDLOOP.

Or

loop at tab_ep.

if tab_ep-mwskz ca '0' .

delete tab_ep index sy-tabix.

ENDIF.

ENDLOOP.

Reward if helpful.

Regards,

Kumar

Read only

former_member282823
Active Participant
0 Likes
730

hi,

try like this

loop at tab_ep.

if tab_ep-mwskz CS ' 0'.

delete tab_ep index sy-tabix.

ENDIF.

ENDLOOP.

Read only

Former Member
0 Likes
730

Hey.

This will do it:

delete tab_ep where mwskz cs '0'.

You don't have to write anything else.

Please reward if helpfull.

Rebeka