Application Development 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: 

FM to Delete dollar '$' sign

Former Member
0 Kudos

Hi experts,

I want to write a FM to check the amount value (data type KF/currency) if there is any $ sign before the amount. Say $15400.00, I would like to remove the $ sign from 15400.00. If it is -$145.00, delete dollar symbol and keep -145.00.

I have thousands of custom KF and have to implement it in BW. So I want this FM to call it from Transfer Rules start routine and will check one by one field only if it is a KF and remove $ sign if there are any. Please help.

Any help will be appretiated with points.

1 ACCEPTED SOLUTION

matt
Active Contributor
0 Kudos

You don't need a function module, you need to read the ABAP help on "REPLACE".

REPLACE ALL OCCURENCES OF '$' IN bw_field WITH ''.

matt

8 REPLIES 8

matt
Active Contributor
0 Kudos

You don't need a function module, you need to read the ABAP help on "REPLACE".

REPLACE ALL OCCURENCES OF '$' IN bw_field WITH ''.

matt

Former Member
0 Kudos

I don't want to write the code for thousand KFs and that's the reason decided to write a fm so that just I can call the FM from start routine and it will do the job for each KFs.

Thanks,

matt
Active Contributor
0 Kudos

So, you want a generic function module that takes ALL the key figures, and strips out the $? Your problem will be how to identify which fields are key figures, and which are characteristics.

matt

Former Member
0 Kudos

I will call the FM once for each Transfer Rules in Start Routine, not against each KF routine. we are in BW 3.1, not BI 7.0.

Thanks.

matt
Active Contributor
0 Kudos

OK, one call. But still, to have one fm to do this, is not trivial. How do you tell whether it is a key figure or not? I'm not at a BW system right now, but if I recall correctly, in the transfer routine you get field names - so you'll have to derive the infoobject from the field name.

The logic will be:

Get field names from structure (DD03L)

Derive InfoObject from field name.

If InfoObject is a key figure, strip out the $.

matt

Edited by: Matthew Billingham on Feb 8, 2008 9:17 PM

Former Member
0 Kudos

I will check all the fields if it's data type is CURR or FLTP, or data type is not CHAR, then check the value if there is any $ sign and remove it. That's it.

Yes - I think your logic is right. How can I write the code?

Edited by: Bhakta Das on Feb 8, 2008 9:24 PM

matt
Active Contributor
0 Kudos

That should work. Good luck!

matt

Former Member
0 Kudos

Thanks.