cancel
Showing results for 
Search instead for 
Did you mean: 

End Routine does not calculate

Former Member
0 Kudos

Hi Gurus,

I have written an end routine to calculate a field as mentioned below:-

LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.

CASE <result_fields>-COSTCENTER.

WHEN 'MUS80900'.

<result_fields>-/bic/YTOTHOURS = ( ( <result_fields>-/bic/YTOTHOURS * 65 ) / 100 ).

WHEN OTHERS.

<result_fields>-/bic/YTOTHOURS = <result_fields>-/bic/YTOTHOURS.

ENDCASE.

ENDLOOP.

But it does brings only '0.000' in result fields.

Any idea why its happening?

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello,

maybe it is better to do it in a characteristic rule (if you have all of the fields in the source). You can also link costcenter and write the following code:

DATA KF type /bic/YTOTHOURS.

IF source_fields-COSTCENTER = 'MUS90900'.

KF = source_fields-/bic/YTOTHOURS.

KF = KF*65.

RESULT = KF/100.

ELSEIF.

RESULT = source_fields-/bic/YTOTHOURS.

ENDIF.

Hope it helps.

Regards.

Simone.

Former Member
0 Kudos

Hi,

Have you assigned the update behaviour of your end routine?

you can find this option next to the end routine icon in Transformation. you can either choose 'with' or 'without' active rules.

if the field that has to be updated in the end routine has no assignment, then assign it as a constant or choose the update behaviour as 'apply to fields without active rules '. I dont remember the exact description. kindly check the rules and select as per your design. easy way would be assigning it to a constant.

then only the values will get updated in end routine. since you are getting initial values in your result, this could be a problem. check it and if not the case, simulate your load and analyse.

Thanks,

Yoga

Former Member
0 Kudos

The first thing to suspect is a type mismatch which yields you're consistent 0.000. Have a look within the debugger and watch the field "YTOTHOURS " come in.

It could be the ABAP interface is converting your data element as it comes into the running program.

I second the IF logic in place of Case logic as it has less overhead

Former Member
0 Kudos

LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.

CASE <result_fields>-COSTCENTER.

WHEN 'MUS80900'.

    • Please change the Code as follows now u will get correct results**

<result_fields>-/bic/YTOTHOURS = (( <result_fields>-/bic/YTOTHOURS) - (<result_fields>-/bic/YTOTHOURS * 65 / 100) ).

WHEN OTHERS.

<result_fields>-/bic/YTOTHOURS = <result_fields>-/bic/YTOTHOURS.

ENDCASE.

ENDLOOP.

Edited by: kkprasad11 on Jun 28, 2011 10:51 AM

Former Member
0 Kudos

This didn't help!

Former Member
0 Kudos

Hi,

try this..

DATA lv_hr TYPE /bic/YTOTHOURS.

LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.

if <result_fields>-COSTCENTER = 'MUS90900'.

lv_hr = <result_fields>-/bic/YTOTHOURS.

<result_fields>-/bic/YTOTHOURS = ( ( lv_hr * 65 ) / 100 ).

endif.

ENDLOOP.

Regards,

aDlin

Former Member
0 Kudos

hi there

There was no issue with the code you had, it is easier to use an if condition instead of when. I would recommend you to do a debugging of your code, I am wondering if ytothours is a kf or characteristics?

LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.

<result_fields>-/bic/YTOTHOURS = <result_fields>-/bic/YTOTHOURS.

if <result_fields>-COSTCENTER = 'MUS90900'.

<result_fields>-/bic/YTOTHOURS = ( ( <result_fields>-/bic/YTOTHOURS * 65 ) / 100 ).

endif.

ENDLOOP.

Former Member
0 Kudos

YTOTHOURS is a key Figure.