Be a simple man
分类: 项目管理
2011-04-01 14:19:29
In DLC Report, I use this method to process DTP dynamic
GET the DTP technical name:
CALL METHOD p_r_request->get_dtptext
RECEIVING
r_dtptext = i_dtptext.
Example:
Transformation: ODSO ZDC_TO68 -> ODSO ZDC_TO68
**local data declarations
DATA: ls_load_date TYPE /bi0/oiload_date.
DATA: lt_zdc_to61 TYPE STANDARD TABLE OF /bic/azdc_to6100.
FIELD-SYMBOLS:
FIELD-SYMBOLS:
DATA: i_dtptext TYPE rsbkdtptext.
*get the DTP technical name
********************************************************************
CALL METHOD p_r_request->get_dtptext
RECEIVING
r_dtptext = i_dtptext.
*DTP to restate employee attributes
IF i_dtptext = 'ZDC_TO68 -> ZDC_TO68 Restatement'.
"Emp Experience Attr
********************************************************************
*get the last date when data was loaded to DSO ZDC_TO68
SELECT SINGLE load_date
INTO ls_load_date
FROM /bic/pzdata_tgt WHERE /bic/zdata_tgt = 'ZDC_TO68'
AND objvers = 'A'.
IF sy-subrc = 0.
*get all employee experience changes since the last load date
SELECT *
FROM /bic/azdc_to6100
INTO TABLE lt_zdc_to61[]
WHERE load_date GE ls_load_date.
ENDIF.
*Overwrite the transaction records with the latest employee
*experience attributes
IF NOT lt_zdc_to61[] IS INITIAL.
LOOP AT SOURCE_PACKAGE ASSIGNING
LOOP AT lt_zdc_to61 ASSIGNING
WHERE /bic/zdcr_nti2 =
AND validfrom LE
AND validto GE
ENDLOOP.
ENDLOOP.
ENDIF.
*end of restatement of employee attributes
************************************************************************************
*DTP to credit PL transactions for a corresponding RA transaction
ELSEIF i_dtptext = 'ZDC_TO68 -> ZDC_TO68 RA-PL'. "RA-PL
************************************************************************************
*begin of RA-PL processing
DATA :lt_pl TYPE STANDARD TABLE OF /bic/azdc_to5200.
DATA :wa_ra TYPE _ty_s_sc_1.
DATA :wa_pl TYPE /bic/azdc_to5200.
*Source Package has all RL records from the last load date - 1.
*Get the corresponding PL's for the RA's in Source Package from
*source dso ZDC_TO52
SELECT * FROM /bic/azdc_to5200
INTO TABLE lt_pl
FOR ALL ENTRIES IN SOURCE_PACKAGE
WHERE material = SOURCE_PACKAGE-material
AND /bic/zbatch = SOURCE_PACKAGE-/bic/zbatch
AND /bic/zcdmin_ds = SOURCE_PACKAGE-calday
AND /bic/ztrn_type = 'PL'.
IF sy-subrc EQ 0.
SORT lt_pl BY doc_number material /bic/zbatch
/bic/zcdmin_ds /bic/zctmin_ds ASCENDING.
*Delete adjacent duplicates in internal table IT_PL
DELETE ADJACENT DUPLICATES FROM lt_pl
COMPARING doc_number material /bic/zbatch /bic/zcdmin_ds.
SORT lt_pl BY material /bic/zbatch /bic/zcdmin_ds.
*append PL records to source-package if
*the PL occured after RA and the users are different
LOOP AT SOURCE_PACKAGE INTO wa_ra
WHERE /bic/ztrn_type = 'RA'.
READ TABLE lt_pl INTO wa_pl
WITH KEY material = wa_ra-material
/bic/zbatch = wa_ra-/bic/zbatch
/bic/zcdmin_ds = wa_ra-calday
BINARY SEARCH.
IF sy-subrc = 0.
IF wa_pl-/bic/zctmin_ds > wa_ra-/bic/zctmin_ds
AND wa_pl-/bic/zuser_min <> wa_ra-createdby.
wa_ra-doc_number = wa_pl-doc_number.
wa_ra-/bic/zrapl_cnt = '1'.
wa_ra-/bic/ztrn_type = 'PL'.
wa_ra-/bic/zctmin_ds = wa_pl-/bic/zctmin_ds.
wa_ra-createdby = wa_pl-/bic/zuser_min.
wa_ra-calday = wa_pl-/bic/zcdmin_ds.
APPEND wa_ra TO SOURCE_PACKAGE.
CLEAR wa_ra.
CLEAR wa_pl.
ENDIF.
ENDIF.
ENDLOOP.