17 Sept 2008

Selective Deletion in Process Chain

The standard procedure :
Use Program RSDRD_DELETE_FACTS
1. Create a variant which is stored in the table RSDRBATCHPARA for the selection to be deleted from a data target.
2. Execute the generated program.

Observations:

The generated program executes will delete the data from data target based on the given selections. The program also removes the variant created for this selective deletion in the RSDRBATCHPARA table. So this generated program wont delete on the second execution.

If we want to use this program for scheduling in the process chain we can comment the step where the program remove the deletion of the generated variant.

Eg:
REPORT ZSEL_DELETE_QM_C10 .
TYPE-POOLS: RSDRD, RSDQ, RSSG.
DATA:
L_UID TYPE RSSG_UNI_IDC25,
L_T_MSG TYPE RS_T_MSG,
L_THX_SEL TYPE RSDRD_THX_SEL.
L_UID = 'D2OP7A6385IJRCKQCQP6W4CCW'.
IMPORT I_THX_SEL TO L_THX_SEL
FROM DATABASE RSDRBATCHPARA(DE) ID L_UID.
* DELETE FROM DATABASE RSDRBATCHPARA(DE) ID L_UID.
CALL FUNCTION 'RSDRD_SEL_DELETION'
EXPORTING
I_DATATARGET = '0QM_C10'
I_THX_SEL = L_THX_SEL
I_AUTHORITY_CHECK = 'X'
I_THRESHOLD = '1.0000E-01'
I_MODE = 'C'
I_NO_LOGGING = ''
I_PARALLEL_DEGREE = 1
I_NO_COMMIT = ''
I_WORK_ON_PARTITIONS = ''
I_REBUILD_BIA = ''
I_WRITE_APPLICATION_LOG = 'X'
CHANGING
C_T_MSG = L_T_MSG.
export l_t_msg to memory id sy-repid.
UPDATE RSDRBATCHREP
SET DELETEABLE = 'X'
WHERE REPID = 'ZSEL_DELETE_QM_C10'.

The variants are to be created for each data target and based in the set of selection on requirements.

If we wish to create separate program which explains the data to be deleted explicitly, we can hardcode the selection for deletion in the program.

Eg:
REPORT ZSEL_DELETE_ZCSAL_1_A00 .
TYPE-POOLS: RSDRD, RSDQ, RSSG.
DATA:
L_UID TYPE RSSG_UNI_IDC25,
L_T_MSG TYPE RS_T_MSG,
L_THX_SEL TYPE RSDRD_SX_SEL,
LT_THX_SEL TYPE RSDRD_THX_SEL.

DATA LT_TAB TYPE RSDRD_T_RANGE.
DATA WA_TAB TYPE RSDRD_S_RANGE.

**Entry for 0CO_AREA = S999**
CLEAR LT_TAB.
WA_TAB-SIGN = 'I'.
WA_TAB-OPTION = 'EQ'.
WA_TAB-LOW = 'S999'.
WA_TAB-KEYFL = 'X'.
APPEND WA_TAB TO LT_TAB.
L_THX_SEL-IOBJNM = '0CO_AREA'.
L_THX_SEL-T_RANGE[] = LT_TAB[].
INSERT L_THX_SEL INTO TABLE LT_THX_SEL.

**Entry for 0VERSION = A00**
CLEAR LT_TAB.
WA_TAB-SIGN = 'I'.
WA_TAB-OPTION = 'EQ'.
WA_TAB-LOW = 'A00'.
WA_TAB-KEYFL = 'X'.
APPEND WA_TAB TO LT_TAB.
L_THX_SEL-IOBJNM = '0VERSION'.
L_THX_SEL-T_RANGE[] = LT_TAB[].
INSERT L_THX_SEL INTO TABLE LT_THX_SEL.

**Entry for 0CALMONTH BT Current Month till year end
CLEAR LT_TAB.
WA_TAB-SIGN = 'I'.
WA_TAB-OPTION = 'BT'.
WA_TAB-LOW = SY-DATUM+0(6).
CONCATENATE SY-DATUM+0(4) '12' INTO WA_TAB-HIGH.
WA_TAB-KEYFL = 'X'.
APPEND WA_TAB TO LT_TAB.
L_THX_SEL-IOBJNM = '0CALMONTH'.
L_THX_SEL-T_RANGE[] = LT_TAB[].
INSERT L_THX_SEL INTO TABLE LT_THX_SEL.


CALL FUNCTION 'RSDRD_SEL_DELETION'
EXPORTING
I_DATATARGET = 'ZCSAL_1'
I_THX_SEL = LT_THX_SEL
I_AUTHORITY_CHECK = 'X'
I_THRESHOLD = '1.0000E-01'
I_MODE = 'C'
I_NO_LOGGING = ''
I_PARALLEL_DEGREE = 1
I_NO_COMMIT = ''
I_WORK_ON_PARTITIONS = ''
I_REBUILD_BIA = ''
I_WRITE_APPLICATION_LOG = 'X'
CHANGING
C_T_MSG = L_T_MSG.
export l_t_msg to memory id sy-repid.
*UPDATE RSDRBATCHREP
* SET DELETEABLE = 'X'
* WHERE REPID = 'ZSEL_DELETE_QM_C10'.

No comments: