2008 Nov 12 5:42 AM
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 /
2008 Nov 12 5:49 AM
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.
2008 Nov 12 5:51 AM
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
2008 Nov 12 5:53 AM
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
2008 Nov 12 6:11 AM
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
2008 Nov 12 7:34 AM
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
2008 Nov 12 10:42 AM
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.
2008 Nov 12 10:51 AM
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
2008 Nov 12 10:18 AM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |