Hi All,
We arein a process of migrating 3.x Transfer rules and update rules to NW2004s. We are following the standard procedure of migrating the objects such that transfer rules are migrated to a transformations and so do update rules.
In on of the objects while running the loads after migrations the key figures are getting doubled. We were able to debug the standard code and figure out where addition is happening. Strange things is this is a standard SAP code generated in all the migrated objectsbut in this particular case it has generated some extra code which is adding up the key figures. I am pasting code below for your reference and will appreciate if someone can help us to resolve this.
As mentioned above the below Read statement is standard in all the TRCS transformations which are migrated from update rules. This read statement fails with sy-subrc = 4 because <_yth_TG_1>. is empty at this stage but during execution it executes the statement INSERT <_ys_TG_1> INTO TABLE <_yth_TG_1> which populates <_yth_TG_1> and in turn makes the next read statement successful which is extra in this case. There is one more Read statement which is extra in this particular case and is adding up the key figures.
===== PUT groups to target
IF skipseg_all IS INITIAL.
READ TABLE <_yth_TG_1>
WITH TABLE KEY
here it is reading all the different characteristics and key figurs. eliminating this to cut short the lengthof message,
ASSIGNING <_ys_TG_1>.
G1_subrc = sy-subrc.
G1_tabix = sy-tabix.
IF G1_subrc = 0.
aggregation SUM
<_ys_TG_1>-POS_FRE = <_ys_TG_1>-POS_FRE + G1-POS_FRE.
<_ys_TG_1>-POS_OCC = <_ys_TG_1>-POS_OCC + G1-POS_OCC.
<_ys_TG_1>-POS_VAC = <_ys_TG_1>-POS_VAC + G1-POS_VAC.
<_ys_TG_1>-/BIC/ZKMOSALRY = <_ys_TG_1>-/BIC/ZKMOSALRY + G1-/BIC/ZKMOSALRY.
<_ys_TG_1>-/BIC/ZFILFTEFX = <_ys_TG_1>-/BIC/ZFILFTEFX + G1-/BIC/ZFILFTEFX.
<_ys_TG_1>-/BIC/ZWRKFTEPX = <_ys_TG_1>-/BIC/ZWRKFTEPX + G1-/BIC/ZWRKFTEPX.
ls_cross-insegid = 1.
ls_cross-inrecord = l_recno_SC_1.
ls_cross-outsegid = 1.
ls_cross-outrecord = <_ys_TG_1>-record.
CALL METHOD i_r_log->add_cross_tab
EXPORTING
I_S_CROSSTAB = ls_cross.
ELSE.
ASSIGN rdsTG_1->* to <_ys_TG_1>.
CLEAR <_ys_TG_1>.
MOVE-CORRESPONDING G1 TO <_ys_TG_1>.
<_ys_TG_1>-requid = l_requid.
l_recno_TG_1 = l_recno_TG_1 + 1.
ls_cross-insegid = 1.
ls_cross-inrecord = l_recno_SC_1.
ls_cross-outsegid = 1.
ls_cross-outrecord = l_recno_TG_1.
CALL METHOD i_r_log->add_cross_tab
EXPORTING
I_S_CROSSTAB = ls_cross.
Record# in target = sy-tabix - if sorting of table won't be changed
<_ys_TG_1>-record = l_recno_TG_1.
INSERT <_ys_TG_1> INTO TABLE <_yth_TG_1>.
IF sy-subrc <> 0.
CALL METHOD cl_rsbm_log_step=>raise_step_failed_callstack.
ENDIF.
ENDIF. "Read table
*
This read statement is extra in this code and when this executes the sy-subrc becomes zero and then it adds up the key figures.
READ TABLE <_yth_TG_1>
WITH TABLE KEY
**This also contains the characteristics and key figures which are being update as part of the transformations
ASSIGNING <_ys_TG_1>.
G2_subrc = sy-subrc.
G2_tabix = sy-tabix.
IF G2_subrc = 0.
aggregation SUM
<_ys_TG_1>-POS_OCC = <_ys_TG_1>-POS_OCC + G2-POS_OCC.
<_ys_TG_1>-POS_VAC = <_ys_TG_1>-POS_VAC + G2-POS_VAC.
<_ys_TG_1>-POS_COUNT = <_ys_TG_1>-POS_COUNT + G2-POS_COUNT.
aggregation MAX
IF G2-POS_CTSPAN > <_ys_TG_1>-POS_CTSPAN.
<_ys_TG_1>-POS_CTSPAN = G2-POS_CTSPAN.
ENDIF.
ls_cross-insegid = 1.
ls_cross-inrecord = l_recno_SC_1.
ls_cross-outsegid = 1.
ls_cross-outrecord = <_ys_TG_1>-record.
CALL METHOD i_r_log->add_cross_tab
EXPORTING
I_S_CROSSTAB = ls_cross.
ELSE.
ASSIGN rdsTG_1->* to <_ys_TG_1>.
CLEAR <_ys_TG_1>.
<_ys_TG_1>-CURRENCY = G1-CURRENCY.
MOVE-CORRESPONDING G2 TO <_ys_TG_1>.
<_ys_TG_1>-requid = l_requid.
l_recno_TG_1 = l_recno_TG_1 + 1.
ls_cross-insegid = 1.
ls_cross-inrecord = l_recno_SC_1.
ls_cross-outsegid = 1.
ls_cross-outrecord = l_recno_TG_1.
CALL METHOD i_r_log->add_cross_tab
EXPORTING
I_S_CROSSTAB = ls_cross.
Record# in target = sy-tabix - if sorting of table won't be changed
<_ys_TG_1>-record = l_recno_TG_1.
INSERT <_ys_TG_1> INTO TABLE <_yth_TG_1>.
IF sy-subrc <> 0.
CALL METHOD cl_rsbm_log_step=>raise_step_failed_callstack.
ENDIF.
ENDIF. "Read table
Thanks for looking into this and will appreciate your response on this.
Regards
Raman