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

problem with read statement

Former Member
0 Likes
595

Hi Friends,

I have one internal table gt_ekpo in which fields such as ebeln, ebelp, mblnr, mjahr and budat are present.

I want to to delete all the records which have values present in budat(date) so i have tried following statement:-

LOOP AT gt_ekpo INTO ls_ekpo.

READ TABLE gt_ekpo INTO ls_ekpo WITH TABLE KEY budat = ls_ekpo-budat TRANSPORTING ebeln budat.

ENDLOOP.

  • READ TABLE gt_ekpo into ls_ekpo WITH TABLE KEY budat = ls_ekpo-budat transporting ebeln budat."ebeln = ls_ekpo-ebeln ebelp = ls_ekpo-ebelp mblnr = ls_ekpo-mblnr mjahr = ls_ekpo-mjahr

IF sy-subrc = 0.

DELETE gt_ekpo INDEX sy-tabix.

ENDIF.

it is giving me syntax error as declaration of ebeln key field is missing.........

one more thing if we use loop at for read then it will read multipple lines...rught?

Thanx

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
560

Hi,

Try like this


LOOP AT gt_ekpo.
if gt_ekpo-budat is not initial.
DELETE gt_ekpo INDEX sy-tabix.
endif.
ENDLOOP.

You wont require the read statement here.

Regards,

Vik

Edited by: vikred on Aug 19, 2009 5:08 PM

4 REPLIES 4
Read only

Former Member
0 Likes
561

Hi,

Try like this


LOOP AT gt_ekpo.
if gt_ekpo-budat is not initial.
DELETE gt_ekpo INDEX sy-tabix.
endif.
ENDLOOP.

You wont require the read statement here.

Regards,

Vik

Edited by: vikred on Aug 19, 2009 5:08 PM

Read only

former_member188827
Active Contributor
0 Likes
560

delete gt_ekpo where budat is not initial.

Read only

Former Member
0 Likes
560

Hai

You can Use Like this:

Just use after Fetching data:

Delete GT_EKPO where budat is not initial.

Read only

Former Member
0 Likes
560

I would say do the way Vikred said:

LOOP AT gt_ekpo.

if gt_ekpo-budat is not initial.

DELETE gt_ekpo INDEX sy-tabix.

endif.

ENDLOOP.