Scenario :
We may come across different inconsistencies in the data base tables due to incorrect request deletions happened in the Infoproviders, Infopackages etc.. At times, we are forced to delete those unwanted requests from the database tables by getting into the Debug mode(/h). This document will help us to delete the unwanted requests from different tables by using a ABAP program.
We should not delete any table entry just like that. A very well experienced guy can take up this activity. He should know what he is deleting. Please be careful. It is just a workaround. Please always take a backup of entries which you are trying to delete. If you want to restore, you can create these entries again.
Step 1: Goto SE38 and create a executable program called Z_DELETE_FROM_TABLE

Step 2: Copy & Paste the below code in Source Code
*&---------------------------------------------------------------------*
*& Report Z_DELETE_FROM_TABLE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT z_delete_from_table .
DATA: lv_tabname TYPE string,
lv_temp TYPE rsodsactreq-datapakid.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: r1 RADIOBUTTON GROUP rad1 USER-COMMAND rad1 DEFAULT 'X', "RSODSACTREQ
r2 RADIOBUTTON GROUP rad1, "RSSELDONE
r3 RADIOBUTTON GROUP rad1, "RSICCONT
r4 RADIOBUTTON GROUP rad1, "RSSDLINIT
r5 RADIOBUTTON GROUP rad1, "RSREQICODS
r6 RADIOBUTTON GROUP rad1, "RSREQDONE
r7 RADIOBUTTON GROUP rad1. "RSSDLINITSEL
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK rad1 WITH FRAME TITLE text-001.
PARAMETERS: p_ods TYPE rsodsactreq-odsobject MODIF ID one,
p_req TYPE rsodsactreq-request MODIF ID one,
p_pid TYPE char6 MODIF ID one. "rsodsactreq-datapakid MODIF ID one.
SELECTION-SCREEN END OF BLOCK rad1.
SELECTION-SCREEN BEGIN OF BLOCK rad2 WITH FRAME TITLE text-002.
PARAMETERS: p_rnr TYPE rsseldone-rnr MODIF ID two.
SELECTION-SCREEN END OF BLOCK rad2.
SELECTION-SCREEN BEGIN OF BLOCK rad3 WITH FRAME TITLE text-002.
PARAMETERS: p_rnr1 TYPE rsseldone-rnr MODIF ID b3,
p_lrnr TYPE rssdlinit-last_delta_rnr MODIF ID b3.
SELECTION-SCREEN END OF BLOCK rad3.
AT SELECTION-SCREEN OUTPUT.
PERFORM select_scrn.
START-OF-SELECTION.
PERFORM req_check.
IF r1 IS NOT INITIAL.
DELETE FROM rsodsactreq WHERE odsobject = p_ods
AND request = p_req
AND datapakid = lv_temp. "p_pid.
ELSEIF r4 IS NOT INITIAL.
DELETE FROM rssdlinit WHERE rnr = p_rnr1
AND last_delta_rnr = p_lrnr.
ELSE.
PERFORM get_tabname.
DELETE FROM (lv_tabname) WHERE rnr = p_rnr.
ENDIF.
IF sy-subrc <> 0.
WRITE: 'no record found.'.
ELSE.
WRITE: 'record deleted from table.'.
ENDIF.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form REQ_CHECK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM req_check .
lv_temp = p_pid.
IF r1 IS NOT INITIAL.
IF p_ods IS INITIAL OR p_req IS INITIAL OR p_pid IS INITIAL. "OR lv_temp is INITIAL.
MESSAGE 'Please enter ODS,Request number and Data Packet ID' TYPE 'I'.
STOP.
ENDIF.
ELSEIF r4 IS NOT INITIAL.
IF p_rnr1 IS INITIAL OR p_lrnr IS INITIAL. "OR lv_temp is INITIAL.
MESSAGE 'Please enter RNR and Last Delta RNR' TYPE 'I'.
STOP.
ENDIF.
ELSE.
IF p_rnr IS INITIAL.
MESSAGE 'Please enter RNR number' TYPE 'I'.
STOP.
ENDIF.
ENDIF.
ENDFORM. " REQ_CHECK
*&---------------------------------------------------------------------*
*& Form SELECT_SCRN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM select_scrn .
IF r1 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'TWO' OR screen-group1 = 'B3'.
screen-required = 0.
screen-input = 0.
screen-invisible = 1.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF r4 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'ONE' OR screen-group1 = 'TWO'.
screen-required = 0.
screen-input = 0.
screen-invisible = 1.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-group1 = 'ONE' OR screen-group1 = 'B3'.
screen-required = 0.
screen-input = 0.
screen-invisible = 1.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " SELECT_SCRN
*&---------------------------------------------------------------------*
*& Form GET_TABNAME
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_tabname .
IF r2 IS NOT INITIAL.
lv_tabname = 'RSSELDONE'.
ELSEIF r3 IS NOT INITIAL.
lv_tabname = 'RSICCONT'.
* ELSEIF r4 IS NOT INITIAL.
* lv_tabname = 'RSSDLINIT'.
ELSEIF r5 IS NOT INITIAL.
lv_tabname = 'RSREQICODS'.
ELSEIF r6 IS NOT INITIAL.
lv_tabname = 'RSREQDONE'.
ELSEIF r7 IS NOT INITIAL.
lv_tabname = 'RSSDLINITSEL'.
ENDIF.
ENDFORM. " GET_TABNAME
Step 3 : Click on Execute and you will be asked to enter the Request(Lenghty Tehcnical Name etc..)

Hence the table entry will be deleted.
I have considered 7 tables in the program. You can configure any other tables also by enhancing the above code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 30 | |
| 21 | |
| 19 | |
| 16 | |
| 15 | |
| 13 | |
| 13 | |
| 13 | |
| 11 | |
| 10 |