Remove decimal & zeros in variable
Hi,
How to remove zero & decimal point in variable
for eg.
insted 5.0000 it should priint 5
Thanks
Dear Imran,
Please use this code and you can vary the difference.
data: menge type MENGE_D,
con type i,
con1 type char5,
con2 type p,
con3 type n.
menge = '100.00'.
move menge to con.
move menge to con1.
move menge to con2.
move menge to con3.
con1 = menge.*
con2 = menge.*
con3 = menge.*
write: 'i', con,
'char', con1,
'p', con2,
'n', con3.
i think this will be help ful to you
Regards,
Kiran Kumar
Similar Messages
-
How to remove leading zeros from variable
hi,
how to remove leading zeros from variable like it_vbap-matnr.
value in it_vbap-matnr is 000000000000000358
i want to remove leading zeros so that it become 358
regards
deepakYou can use Function Module <b>'CONVERSION_EXIT_MATN1_OUTPUT'</b>
This Function Module will eliminate leading Zeros.
For each MATNR Value read form DB Table,u can eliminate Leading zeros and then modify ur Internal table.
I think u will not get leading Zeros into utr Internal table when u read from VBAP.
Bcoz MATNR in VBAP itself have Conversion routine.
If u r getting leading zeros,U can use following Logic.
tables:
vbap.
data:
t_vbap like standard table of vbap.
select matnr
from vbap
into corresponding fields of table t_vbap.
loop at t_vbap into vbap.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
EXPORTING
INPUT = vbap-matnr
IMPORTING
OUTPUT = vbap-matnr
modify t_vbap from vbap transporting matnr.
endloop.
Hope this will work..... -
Hello,
I managed to remove the default Zeros in the "Net_Price" and "Quantity" field by using the "Set_attribute_null" method.
But, after entering the value into the field and clicking on the button to execute the BAPI, it is inserting decimal zeros again after the values. I want to remove this decimal zeros. Is there any way of doing this? I would greatly appreciate your help.
Regards,
Gopal.Hi Gopal ,
there is a pretty print option for this . u cn set special formatting properties using the context editor or the methods GET_ATTRIBUTE_FORMAT_PROPS and SET_ATTRIBUTE_FORMAT_PROPS of IF_WD_CONTEXT_NODE_INFO.
the attribute formatting can be :
1 Display leading zeros
2 Position of the leading sign
3 Input Compression
4 Time output format
u wud like to see more on the SAP online help :
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/3a/2232666aeb45f4b759848a4caf9c8b/content.htm
regards,
amit -
Remove decimal points from variable.
Hi,
I have a little issue.
I have one variable v = 25.000
and i want to remove (.000) from this variable so my result will be only 25 and i want this.
So, is ther any function to remove this?
I want to do it in one shot.
No 2-3 statements.
Points rewarded soon
Regards
RHHi Ronny,
You move this variable data to an integer variable.
Data: v_tempint type i.
move your_variable to v_tempint.
v_tempint will have the required result.
Reward points if this helps,
Kiran -
Leading Zeros for variable vlaues(Date)
Hi,
How to remove leading zeros for variable values.
For example;
Comapny Code by Auth: 007.2004(July 2004)
How to take out the first two zeros or first zero.
Any suggestions would be of great help.
Regards,
SureshHow is that related to sql develper?
Did you read the forum title? - SQL Developer (Not for general SQLl/PLSQL questions) -
Function mudule to remove leading zeros of curreny and decimal type field
Hi Expers,
can any body suggest me the function mudule to remove leading zeros of curreny and decimal type fields.
plz do reply as early as possible.
Thanks .....
sunil.Hi,
Use this FM CNIF_CONVERT_CURRENCY2EXT
Import parameters Value
I_CURRENCY USD
I_AMOUNT 00000001233
I_DECIMALS 2
Export parameters Value
E_AMOUNT 1.233,0000
Regards
Shiva -
I want to remove Trailing zeros from a charecter value
Hello ,
i want to remove trailing zeros for a prticular value.Following is my code :
DATA: V_FLOAT TYPE F VALUE '4.8240000000000000E+03',
V_CHAR(25) ,
P10_4(10) TYPE P DECIMALS 4.
CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
EXPORTING
FLOAT_IMP = V_FLOAT
FORMAT_IMP = P10_4
ROUND_IMP = ' '
IMPORTING
CHAR_EXP = V_CHAR.
SHIFT V_CHAR RIGHT DELETING TRAILING '0'.
WRITE : V_CHAR ."NO-ZERO.
<u><b>Output:</b></u>
if we pass the value '1.3000000000000000E+01' it should be 13.0
ex2: '1.3400000000000000E+01' it should be 13.4
ex3:'4.8240000000000000E+03' it should be 4824
is there any way to get the solution without functional module. If so Please tell me with code.hi
u can do it in number of ways.
Use TCODE SU3
Select default tab and select radio button 123467.89 in decimal notation and save it.
or u can try :
if you want to do this through ABAP program.
1. to delete trailing spaces.
SHIFT <V_VARIABLE> RIGHT DELETING TRAILING '0'.
to delete leading zeroes,
SHIFT <VARIABLE_NAME> LEFT DELETING LEADING '0'.
only for one abap program, u can use set country command
for all programs :
sap menu>system->go to user profil->own data>default --> and choose ur format.
hope this helps u.
Regards,
Prasanth
Reward all hepful replies -
Chnfind unable to find the decimal type by variable and sometimes "Round" command
Dear all,
During the work with Diadem I got two troubles. Could you please take a look and show me the wrong if you find the issue?
1.) Here is my trouble as we see the photo below. It is most important problem which I have. I really have no idea why it could happened. It is alway happened to find a value with decimal type's variable, and even that variable is changed to "str()".
setlocale("en-gb")
dim Min_point,Index_low,result
Min_point=val(Data.Root.ChannelGroups(1).Channels("CopyYangle").Properties("minimum").Value)
Min_point=round(Min_point,6)
Min_point=str(Min_point)
msgbox("The Min.Value is: "&Min_point)
Index_low=Chnfind("ch(""CopyYangle"")<="&Min_point&"", 1)
msgbox("Index No. of Min. Value is: "&Index_low)
Index_low=Chnfind("ch(""CopyYangle"")<=-0.11374 ", 1)
msgbox("Index No. of Min. Value is: "&Index_low)
2.) Still the problem with ChnFind() or ChnFindreverse(). If I change the Rounds off a number to the nearest integer with the function "Round()" it might not work in ChnFindreverse(). Such like it works under 4, 6, 8 and even 7 but doesn't work with 3 and 5. Is this logical?
setlocale("en-gb")
Dim XE, Xchannel, Ychannel,round_N0
Xchannel = "[2]/Right"
T1 = Xchannel
R1 =val(Data.Root.ChannelGroups(2).Channels("Right").Properties("maximum").Value)
round_N0=4 ' <========= 3 and 5 Not work, 4, 6, 7, 8 .... work
R1 =round(R1,round_N0) ' <=========
msgbox("Max. point is: " &R1 &VbCrlf& "Round Nr is: "&round_N0)
L1 = ChnFindReverse ("Ch(T1)>=R1",0)
msgbox("Index number for Max.Point is: "&L1 &VbCrlf& "Round Nr is: "&round_N0)
.tdx is a valid extensions for an attachement?
If you couldn't open the TMD file. Please remove ".tdv" the attacments file name to make sure it is "ChnFind.tdx" but not "ChnFind.tdx.tdv".
Kind regards / Mit freundlichen Grüßen
J.Huang
Attachments:
ChnFind.TDM 5 KB
ChnFind.tdx.tdv 39 KBHello J.Huang,
I downloaded the files and was able to get it to work. It looks like when you format the minimum value to a string, you loose precision and then ChnFind doesn't find the value your are looking for. He is an example which worked for me :
Set oChnY = Data.Root.ChannelGroups(2).Channels("Right")
sgValue = str(oChnY.Properties("minimum").Value,"d.ddddddddddddddd")
Index = ChnFindReverse("Y<="&sgValue,,Array("Y"),Array(oChnY))
LogFileWrite(Index)
Using symbols (parameters 3 and 4) is not necessary to get the solution. The key is teh second value for "str" which formats using more digits. As soon as you reduce the number of digits, you may no longer get a result.
Ther is an alternative to ChnFind, in case there is only one occurance in teh signal which has the minimum value
Set oChnY = Data.Root.ChannelGroups(2).Channels("Right")
Index = PNo(oChnY,oChnY.Properties("minimum").Value)
LogFileWrite(Index)
I hope one of the two options works for you. I tested the approach with teh first channel too and it worked as well -
hi,
how to remove leading zeros. can anyone suggestHi ,
U can either use this function module also
CONVERSION_EXIT_ALPHA_OUTPUT
or
SHIFT <yourField> LEFT DELETING LEADING '0'
or
try NO-ZERO option of WRITE statement
or
Another way is to create another variable of type I and assign the value into it
example:
DATA: L_NUMC(08) TYPE N.
DATA: L_INT TYPE I.
L_NUMC = '00000018'.
L_INT = L_NUMC.
Result will be = 18.
Hope this helps
Regards,
Prasanth
Reward all the helpful answers -
Removing leading zeros for the quantity field
Hi all,
In my script form there is a quantity field, of 13 and 3 decimals , on the out put its taking that much space un neccesarily,and messing up.
how to make this adjustable in the provided space.
It always 3 digits and 2 decimal points in our case.
Please help me out,
Thanks,
PraveenHi,
For removing leading zeros
&V_VARIABLE(Z)&
Thanks,
Naren -
Hi all,
Iam having a requirement where in a enduser enters the vendor number and after pressing enter key it should display the vendor num along with vendor name concatenated in the same field. But the end user is provided the facility that he may not enter the exact vendor number ( I mean if vendor number is for example 0000055, the enduser may enter simply 55). The system should convert it with leading zeroes internally. And in display it should display removing leading zeroes.
like input: 55 output : 55 Vendor_Name
my approach
iam using conversion_exit_alpha_input for adding leading zeroes before select query ( to fetch the vendor name for vendor number the user supplies)
before displaying the output after concatenation,
iam using conversion_exit_alpha_output.
after execution,
it is asking the exact vendor number . But in the output, it is giving the vendor number along with vendor name by removing leading zeroes ( as expected).
how to make the system accept the number without leading zeroes. please suggest me.
tthanking you in advance
regards
BikashHi Bikash,
Since you have to display the Vendor number concatenated along with the Vendor Name, why do you need to use the Alpha Exit Function Module. As you have the Vendor number without the zeros in the input field, you can store it in a temporary variable and then once the Vendor name is available you can concatenate it along with the number in the same field.
If you need a code snippet, you can provide the Technical details of the fields of input. We can use the implicit ABAP type casting feature to get the Vendor Number without any leading zeros.
Hope this helps.
Thanks,
Samantak. -
Remove decimal out of an equation to send to a payment gateway
i have a value that currently has shows a decimal
@$amount = $_POST['amount'];
i need the decimal to show until the variable $amount is sent to the payment gateway
what is the best way to remove the decimal from the variable
so a value of e.g
250.59
will be sent as 25059
thankswould multiplying by 100 also work?
$amount = "250.59";
echo $amount*100;
// 250.59*100 displays 25059
$amount = str_replace(".","",$amount);
echo $amount*100;
// 25059*100 displays 2505900
Your original question specifically asked how to remove a decimal, not how to multiply a variable by 100.
best,
Shocker -
Dear Experts,
I am printing a variable from vbkd-bstkd in a form.Its size is 35 characters in length.while debugging am getting tha value for that variable is 999.When dat variable is printing on the form dat value is coming as
999 00000000.I need to display only 999 in d form.How can i come across dis problem
Advance thanks to all.
Regards,
Chitty.Hi,
There are these two function modules,
CONVERSION_EXIT_ALPHA_INPUT---- It is used to add the 0(Zero) at the begining of the value. You dont require to add zero manually for any variable.
CONVERSION_EXIT_ALPHA_OUTPUT--- It is used to Remove 0(Zero) from the Begining of the value. You dont require to remove Zero manually for any variable. Just call this Function Module and it will automatically removes zero from the begining
Hope it helps you
Regrds
Mansi -
Remove preceding zeros on BW Infoobject
Dear Experts,
My BW infoobjects showing preceding zeros in the BI4.1 WEBI Prompts LOVs, so user don't want the zeros and they need only values and also they compare BEx analyzer with BO since BEx analyzer LOVs shows only values without zeros.
Is there any function or setting either in BO or BEx designer to remove zeros in the BW infoobjects? so that in BO LOVs display only values without zeros.
Currently values is 0000123456 in BO LOVs and user want only 123456 as per BEx analyzer.
Please help
Thanks in advance.
Regards
Karuppiah NHi Karuppiah,
short answer: There is no way of removing those zeroes.
long answer: Those zeroes araise from the conversion routine on the InfoObject, the standard conversion routine is called Alpha and does exactly what you describe with numeric keys in order to convert from external to internal key format. The standard 0GL_ACCOUNT characteristic uses the Alpha routine as delivered by SAP. BEx will display the external key format in the LOV, while Web Intelligence will use the internal key format, hence the zeroes at the start of numeric keys.
This question was already raised here:
How to remove leading zeros from WebI Userpromt variable.
Best regards,
Victor -
Remove Leading zeros for Material in Transformation
Hi Experts,
I'm using DTP first time. I don't have much exp on DTP & Transformations.
I'm creating infocube with some objects. I want to remove leading zeros for zmaterial.
In 3.x writen update routines as fallows:
data: zmat(18) type c.
zmat = COMM_STRUCTURE-/BIC/ZMAT.
shift zmat left deleting leading '0'.
result value of the routine
RESULT = zmat.
I'm confusing in Transfermation where to write this routines.
I'm writing in Transformation as fallows:
data: zmat(18) type c.
zmat = SOURCE_FIELDS-/BIC/ZMAT.
shift zmat left deleting leading '0'.
RESULT = zmat.
But it's getting remove zero's.
Anybody suggest on this.
SiriDear Sir,
No confusion at all.
Just double click on the Target Infoobjct i,e Material object in Transformation, you will see a wizard popping up.
There you will see a option called "RULE TYPE" and the default value will be "Direct Assignment". In the same check box click on the drop down icon and select "Routine".
The moment you select the routine option, it will open up ABAP workspace where in you can write your routine and get the desired result.
Hope it helps.
Maybe you are looking for
-
While opening a screen none of the radio button should not selected
Hi, i have three radio button on the screens.By default the first radio button is getting selected for each and every time when ever i'm opening the screen.i dont want the default select should happen and even i dont want any of the radio button shou
-
Error when open query designer
Hi people when i try to open query designer on my dev system i have some message. In the query designer appears two STOP error that tell to me ther's a dump in system. On system on st22 the dump is this: Errore run-time RAISE_EXCEPTION
-
Hi, The other day I opened up my iPhoto 6 to view some photos, and when i clicked on a thumbnail to edit the picture, a blank square with a grey dashed border came up with an ! in the centre. I cant seem to view majority of my photos, however the pho
-
HT4946 resetting the password lock
How do you reset the password lock? Forgot password
-
Retreiving data from external DB using cursors (Native SQL)
Hi experts, Iu2019m trying to use some functionality based on the Native SQL on an Oracle Server. Iu2019m facing some difficulties using cursors and fetching data from the external database. Basically the synonym its zfisicc_c_dblink, and Iu2019m run