[bw] sample code of delete select data from realtime ods
method IF_RSPLFA_SRVTYPE_IMP_EXEC~EXECUTE.
DATA: l_r_param_elem TYPE REF TO if_rsplfa_param_elem,
l_r_param_keyf_sel TYPE REF TO if_rsplfa_param_keyf_sel,
l_t_keyfnm TYPE rsplf_t_keyfnm,
l_r_param_value TYPE CHAR10,
l_kyf TYPE rsiobjnm.
*BPS STRUCTURE
TYPES: BEGIN OF LS_DATA,
ZPLNVER TYPE /BIC/OIZPLNVER,
ZPQ_NO TYPE /BIC/OIZPQ_NO,
ZQUOT_TYP TYPE /BIC/OIZQUOT_TYP,
ZSCH_END TYPE /BIC/OIZSCH_END,
ZSCH_STR TYPE /BIC/OIZSCH_STR,
ZPHASE TYPE /BIC/OIZPHASE,
ZCOSIND TYPE /BIC/OIZCOSIND,
ZCST_CAT TYPE /BIC/OIZCST_CAT,
ZTY_CURVE TYPE /BIC/OIZTY_CURVE,
CALMONTH TYPE /BI0/OICALMONTH,
ZQUOT_AMT TYPE /BIC/OIZQUOT_AMT,
ZQUOT_OVR TYPE /BIC/OIZQUOT_OVR,
END OF LS_DATA.
* EXPORT STRUCTURE
types: BEGIN OF LT_DATA,
/BIC/ZYYYY_REV TYPE /BIC/OIZYYYY_REV,
/BIC/ZE_GRADE TYPE /BIC/OIZE_GRADE,
/BIC/ZE_PQ_NO TYPE /BIC/OIZE_PQ_NO,
/BIC/ZSCOPE TYPE /BIC/OIZSCOPE,
/BIC/ZCC_TYPE TYPE /BIC/OIZCC_TYPE,
/BIC/ZCC_TYPED TYPE /BIC/OIZCC_TYPED,
/BIC/ZSS_TYPE TYPE /BIC/OIZSS_TYPE,
/BIC/ZSS_TYPED TYPE /BIC/OIZSS_TYPED,
/BIC/ZYYYYMM TYPE /BIC/OIZYYYYMM,
/BIC/ZAMOUNT TYPE /BIC/OIZAMOUNT,
RECORDMODE TYPE RODMUPDMOD,
END OF LT_DATA.
DATA: RECORDS TYPE I,
LS_DATA_W TYPE LS_DATA,
LT_DATA_W TYPE LT_DATA,
LT_DATA_I TYPE TABLE OF LT_DATA WITH DEFAULT KEY .
data LT_EXT_SEL TYPE STANDARD TABLE OF BAPI6116SLIO.
DATA LS_EXT_SEL TYPE BAPI6116SLIO.
* data: i_d like sy-index.
* do.
* if i_d = 2.
* exit.
* else.
* endif.
* enddo.
FIELD-SYMBOLS:
l_r_param_elem = i_r_param_set->get_param_elem( 'PLNVER' ).
l_r_param_elem->get_value( IMPORTING E_VALUE = l_r_param_value ).
LOOP AT c_th_data ASSIGNING
move-corresponding
assign component '0CALMONTH' of structure
IF LS_DATA_W-ZCST_CAT = '000041'
OR LS_DATA_W-ZCST_CAT = '000042'
OR LS_DATA_W-ZCST_CAT = '000045'.
LT_DATA_W-/BIC/ZYYYY_REV = LS_DATA_W-ZPLNVER.
LT_DATA_W-/BIC/ZE_GRADE = LS_DATA_W-ZQUOT_TYP.
LT_DATA_W-/BIC/ZE_PQ_NO = LS_DATA_W-ZPQ_NO.
LT_DATA_W-/BIC/ZSCOPE = LS_DATA_W-ZPHASE.
CASE LS_DATA_W-ZCST_CAT.
WHEN '000041'.
LT_DATA_W-/BIC/ZSS_TYPE = 'd_ab43'.
LT_DATA_W-/BIC/ZSS_TYPED = '一般費用'.
WHEN '000042'.
LT_DATA_W-/BIC/ZSS_TYPE = 'd_ab41'.
LT_DATA_W-/BIC/ZSS_TYPED = '交際費'.
WHEN '000045'.
LT_DATA_W-/BIC/ZSS_TYPE = 'd_ab42'.
LT_DATA_W-/BIC/ZSS_TYPED = '差旅費'.
ENDCASE.
LT_DATA_W-/BIC/ZYYYYMM =
*----國內
LT_DATA_W-/BIC/ZAMOUNT = LS_DATA_W-ZQUOT_AMT.
LT_DATA_W-/BIC/ZCC_TYPE = 'I'.
LT_DATA_W-/BIC/ZCC_TYPED = '國內'.
COLLECT LT_DATA_W INTO LT_DATA_I.
*----國外
LT_DATA_W-/BIC/ZAMOUNT = LS_DATA_W-ZQUOT_OVR.
LT_DATA_W-/BIC/ZCC_TYPE = 'O'.
LT_DATA_W-/BIC/ZCC_TYPED = '國外'.
COLLECT LT_DATA_W INTO LT_DATA_I.
ENDIF.
ENDLOOP.
*DELETE DATA FIRST
LS_EXT_SEL-IOBJNM = 'ZYYYY_REV'.
LS_EXT_SEL-SIGN = 'I'.
LS_EXT_SEL-OPT = 'EQ'.
LS_EXT_SEL-LOW = LS_DATA_W-ZPLNVER.
APPEND LS_EXT_SEL TO LT_EXT_SEL.
CALL FUNCTION 'RSDRI_ODSO_DELETE_RFC'
EXPORTING
I_ODSOBJECT = 'ZOPPL40'
I_DELETE_ALL = 'X'.
CALL FUNCTION 'RSDRI_ODSO_MODIFY'
EXPORTING
I_ODSOBJECT = 'ZOPPL40'
I_T_MODIFY = LT_DATA_I
IMPORTING
E_RECORDS = RECORDS.
endmethod.
<< Home