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

alv display

Former Member
0 Likes
976

Hi gurus,

I hav to diplay certain record (say 10 records) using alv grid display.

But my challege is when i click on any record it should get deleted (mean now one should have only 99 records only instead of 100) and i dont have to make use of alv grid again.

hope i might have able to explain my problem.

thanks in advance.

Anuj /

Hi gurus,

I hav to diplay certain record (say 10 records) using alv grid display.

But my challege is when i click on any record it should get deleted (mean now one should have only 99 records only instead of 100) and i dont have to make use of alv grid again.

hope i might have able to explain my problem.

thanks in advance.

Anuj /

8 REPLIES 8
Read only

GauthamV
Active Contributor
0 Likes
953

hi,

first write a simple program to display your records and then create a checkbox to select particular record and create a push button on app tool bar and write logic such that whenever you select checkbox and click that button your record should be deleted.

so now you can start your program and revert back if any issues.

also you have so many programs in SDN for grid display with check boxes.

Search and manke use of them.

Read only

Former Member
0 Likes
953

Hi Anuj ,

what u can do it ....

1. have a rs_selfield TYPE slis_selfield

2. make this itab hold a Primary key field of ur itab ...

3. have a pop up for deletion confirmation ...

4. on 'Y' delete the records from the itab and call ur ALV display again ...with the new updated itab as input ..

Regards

Renu

Read only

Former Member
0 Likes
953

try capturing the sy-tabix when u want to delete a row.

delete the row from the internal table.

display the table again which is similar to the interactive list .

each time you do this also reset the list index.

Regards,

SAPient

Read only

Former Member
0 Likes
953

Hi anuj

here is the demo code. it will delete the data fromthe table. u need to program it correctly if you are getting data from multiple database tables, in such case deletion might be needed from various tables.

complie the below code and test:

REPORT zvishal_alv.

TYPE-POOLS: slis.

DATA: itab TYPE TABLE OF sflight,

wa TYPE sflight,

it_evt TYPE slis_t_event,

wa_evt LIKE LINE OF it_evt.

wa_evt-form = 'USER_COMMAND'.

wa_evt-name = 'USER_COMMAND'.

APPEND wa_evt TO it_evt.

SELECT * FROM SFLIGHT

INTO TABLE ITAB

WHERE CARRID = 'AA'

and connid = '0017'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_user_command = 'USER_COMMAND'

I_STRUCTURE_NAME = 'SFLIGHT'

it_events = it_evt

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

FORM user_command USING v_ucomm LIKE sy-ucomm

wa_selrow TYPE slis_selfield.

CASE v_ucomm.

WHEN '&IC1'.

READ TABLE itab INTO wa INDEX wa_selrow-tabindex.

if sy-subrc is initial.

delete sflight FROM wa.

message 'selected record delered from database' TYPE 'S'.

else.

message 'record does not exist' type 'E'.

endif.

ENDCASE.

ENDFORM.

thanks

vishal kapoor

Read only

0 Likes
953

hello All,

Thanks for your early reply.

But i dont have to deleted the data form data base table i just have to move it out from the

display list thats all.

Thanks.

Waiting for you help.

Anuj

Read only

0 Likes
953

Hi,

One thing you can do is...for each line item on ALV Display ; add one more column of check box.

Using GUI Status add button on tool bar for delete.

Write the code for deletion when user press the button delete.

Thanks.

Read only

0 Likes
953

Oh boy who's asking you to delete data from the database table.

get them into an internal table and delete from that.

Regards,

SAPient

Read only

Former Member
0 Likes
953

Hi Anuj,

If your requirement is not to delete the rows from database then check the following programs

BCALV_EDIT_01,

BCALV_EDIT_03

BCALV_EDIT_04.

hope you find them useful.

Thanks and Regards,

Ravi