Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Tax Calculation

Former Member
0 Likes
1,897

Hello Friends,

We are using the function module "CALCULATE_TAX_FROM_NET_AMOUNT" for calculation of TAX. But we are facing an issue with this FM.

Actually the tax calculation is done through an external system. When the tax calculation is happening, for one particular scenario we receive an error message. For this scenario, we would like to capture the error and write it to the log file and continue with the process. But as this error is raised as an hard coded "E" in the standard FM, we are not able to change it.

We would like to know, if there is a replacement FM/ BAPI that we could try and make use of? Any suggestions related to this are absolutely welcome.

Thanks in advance.

Best Regards,

Ram.

Hello Friends,

We are using the function module "CALCULATE_TAX_FROM_NET_AMOUNT" for calculation of TAX. But we are facing an issue with this FM.

Actually the tax calculation is done through an external system. When the tax calculation is happening, for one particular scenario we receive an error message. For this scenario, we would like to capture the error and write it to the log file and continue with the process. But as this error is raised as an hard coded "E" in the standard FM, we are not able to change it.

We would like to know, if there is a replacement FM/ BAPI that we could try and make use of? Any suggestions related to this are absolutely welcome.

Thanks in advance.

Best Regards,

Ram.

7 REPLIES 7
Read only

Former Member
0 Likes
1,484

Hi,

You might be having like this:

if sy-subrc NE 0

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

You can do this: Once you are done with calling the FM, in the sy-subrc check,

if sy-subrc NE 0

call fucntion "FORMAT_MESSAGE' and pass the

MESSAGE ID sy-msgid, NUMBER sy-msgno

and sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 and prepare the message and move it into log..

endif.

Hope this helps you

Regards

Shiva

Read only

0 Likes
1,484

Hi Shiva,

Thanks for the reply. But that is not the case. Inside this standard Function Module itself the error message has been raised. I mean the control never comes out of this FM for me to check SY-SUBRC.

The message is raised as below.

if sy-subrc NE 0
MESSAGE ID sy-msgid *TYPE 'E'* NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.

This is why we are looking for replacement.

Thanks & Regards,

Ram.

Read only

0 Likes
1,484

Oh...Ok..

Did u check if there is any enhancement point?

Or you can do one this, check the below FM: CALCULATE_TAX_FROM_GROSSAMOUNT

This has same functionality..check it once

Regards

Shiva

Read only

0 Likes
1,484

Hi Shiva,

I have checked the FM "CALCULATE_TAX_FROM_GROSSAMOUNT". This is same as the other one that we are using. I mean, for the troubled scenario this also raises the error message ubruptly stopping the program.

Unfortunately this is not ECC 6.0 system. So, no question of Enhancement points

Thanks & Regards,

Ram.

Read only

Former Member
0 Likes
1,484

Hi,

You can use this FM : CALCULATE_TAX_ITEM

I am using this and it is working fine for all the senarios .

If you have any issue in using this FM feel free to get back to me.

Regards

Bikas

Read only

0 Likes
1,484

Hi Bikas,

Thanks. Will try this FM and get back to you.

Best Regards,

Ram.

Read only

Former Member
1,484

FYI . . . You can always "trap" E type messages from function calls using the special exception ERROR_MESSAGE. Just add this to your exception list just like you would OTHERS. That way if an E type message is issued inside a function module it will work like an exception was raised and the calling program can then detect that via sy-subrc based on the value you assigned to the ERROR_MESSAGE exception in the call.

So, as an example,

CALL FUNCTION 'SOME_FUNCTION'

EXPORTING

.

.

IMPORTING

.

.

EXCEPTIONS

.

ERROR_MESSAGE = 90

OTHERS = 91.

Then if sy-subrc = 90 you know there was an E message issued from the function call.