Posted: Wed Oct 31, 2012 10:04 am Post subject: Mass delete reports
Code:
* This abap reports mass delete is useful if you have lots of unwanted
* program to clean up.
*
* Create a Menu Status 'STANDARD' with the fields
* BACK and DELE
*
* You have to protect this program either by authorization or hardcoded
* user name checks.
*
report zmass_delete_reports.
tables: trdir, trdirt.
type-pools: slis.
data: gt_fieldcat type slis_t_fieldcat_alv with header line,
gs_layout type slis_layout_alv,
g_repid like sy-repid.
types: begin of st_output,
marca(1),
name like trdir-name,
subc like trdir-subc,
cnam like trdir-cnam,
cdat like trdir-cdat,
text like trdirt-text,
end of st_output.
data: gt_output type standard table of st_output with header line.
data: alv_events type slis_t_event.
selection-screen begin of line.
selection-screen comment (35) comment1.
select-options s_name for trdir-name OBLIGATORY.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment (35) comment2.
select-options s_subc for trdir-subc.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment (35) comment3.
select-options s_cnam for trdir-cnam.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment (35) comment4.
select-options s_cdat for trdir-cdat.
selection-screen end of line.
select * from trdir
into corresponding fields of table gt_output
where name in s_name
and subc in s_subc
and cnam in s_cnam
and cdat in s_cdat.
loop at gt_output.
select single text from trdirt
into gt_output-text
where name = gt_output-name
and sprsl = sy-langu.
modify gt_output.
endloop.
endform.
if sy-subrc ne 0.
message id sy-msgid type sy-msgty number sy-msgno with
sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " LISTADO
form build_comment using p_heading type slis_t_listheader.
data: hline type slis_listheader,
text(60) type c,
sep(20) type c.
clear: hline, text.
hline-typ = 'H'.
write: 'List of Pending Deliveries' to text+05.
hline-info = text.
append hline to p_heading.
clear text.
write: 'User: ' to text,
sy-uname to text+9,
'Date: ' to text+30,
sy-datum to text+37,
'Page: ' to text+50,
sy-pagno to text+56.
hline-info = text.
append hline to p_heading.
endform. " BUILD_COMMENT
form alv_build_eventtab using p_events type slis_t_event.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_events.
read table p_events with key name = slis_ev_top_of_page
into ls_event.
if sy-subrc = 0.
move slis_ev_top_of_page to ls_event-form.
modify p_events from ls_event index sy-tabix.
endif.
read table p_events with key name = slis_ev_pf_status_set
into ls_event.
if sy-subrc = 0.
move slis_ev_pf_status_set to ls_event-form.
modify p_events from ls_event index sy-tabix.
endif.
read table p_events with key name = slis_ev_user_command
into ls_event.
if sy-subrc = 0.
move slis_ev_user_command to ls_event-form.
modify p_events from ls_event index sy-tabix.
endif.
endform. " BUILD_EVENTTAB
form pf_status_set
using pu_tab_excl_okcode type slis_t_extab.
set pf-status 'STANDARD' excluding pu_tab_excl_okcode.
endform.
form user_command
using pu_okcode type syucomm
pu_selfield type slis_selfield.
case pu_okcode.
when 'DELE'.
loop at gt_output where marca = 'X'.
delete report gt_output-name.
write:/ 'Report deleted ', gt_output-name.
endloop.
when 'DISP'.
read table gt_output index pu_selfield-tabindex.
if sy-subrc = 0.
endif.
endcase.
endform.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.