cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert number into words in HCM process & forms

Former Member
0 Kudos

HI Experts.

I new to HCM forms .

I am working on hcm form for company loans  .

user will enter the loan amount in the form and i have to display that  amount in words .

I tried to write the code at  interface level but its not working .

Please help me .

Tanks & regards

Rajesh

Accepted Solutions (1)

Accepted Solutions (1)

bhushan_ghule
Active Participant
0 Kudos

Hi Rajesh .

For HCM process & forms you can create Custom Backend service that is nothing but badi only .

There you can write the code to convert number into words using function module spell_amount .

Whenever user press check & send button custom Backend service will get trigger or you can trigger custom backend service through java code also .

Try this it will defiantly work .

Thanks & Regards

Bhushan Ghule

Former Member
0 Kudos

HI Bhushan .

Thanks for the replay .

I don't have any idea on custom backend service .

Do you have any document related to this .  

Thanks & regards .

Rajesh

Former Member
0 Kudos

Hi Rajesh,

Apart from the standard services given by SAP you can create your own custom services where u can write your own custom code to achieve the intended functionality.

This will help: please have a look

http://scn.sap.com/docs/DOC-35622

Here you will find steps to create your custom back end service.

Regards,

Mayank

bhushan_ghule
Active Participant
0 Kudos

Hi Rajesh .

For custom back end service you can refer this link .

http://scn.sap.com/community/interactive-forms-by-adobe/blog/2011/08/24/hcm-processes-forms-validati...

In the DO_OPERATIONS method you have to read the value of loan amount convert that number into words and display it on the form .

Hope this helps.

Thanks & regards .

Bhushan

Answers (5)

Answers (5)

ChrisSolomon
Active Contributor
0 Kudos

Answers above are correct. You could create an event to do it within the "edit" step or simply have it handled as a "check" (do_operations) service on the "check and send" step.

Create a custom "Generic Service" (aka. backend service) and have it handle this for you.

You should have 2 form fields.....your numeric amount and your "string" to hold the numeric value spelled out. (also, you might want to add a "language" field to pass to make it scalable later)

Your service will take in the numeric amount (and languge if you use that). It should check to make sure the value passed "is numeric" and then if so, pass it to the standard SAP function(s) that will do the work of converting it for you. Then pass back this string value in your "numeric value spelled out" field.

VERY easy generic service

Former Member
0 Kudos

Hi rajesh,

            

            You can do the coding at interface level. Instead you can write the your logic in your back end services. Assign DE EMPTY Property to that Amount field so that on entering values on the Amount field Back end will trigger and you have to capture the value and pass it to the function module SPELL_AMOUNT  it will return the Amount in Words.

Regards,

Arun

Former Member
0 Kudos

Maybe this can help you, have a look:

http://scn.sap.com/message/14313445#14313445

Good luck

Shai

Former Member
0 Kudos

Hi Rajesh,

You can achieve this by creating a custom backend service and write your code to display the amount in words in the corresponding class.

Now there are two ways in which you can call this backend service:

1) You can create an exit event on your amount field which will be triggered by Javascript.

    This way you will be able to display the amount in words on the same step.

    Here you can create rules to ensure that only relevant services are called for this event.

    You can write you code in Initialize or Do-operations method depending upon the type of your event.

2) You can write your code in do-operations method of your class corresponding to your backend service. It will automatically be called when user clicks on "check and send".

However, in this case the text will be displayed when the form is in "review" stage so if then the user wants to change the amount after viewing the text he will have to come back to the "fill out form" stage and then change the amount.

Regards,

Mayank

rakesh_m2
Contributor
0 Kudos

Hi Rajesh,

Try this function module HR_IN_CHG_INR_WRDS or SPELL_AMOUNT

--

Rakesh