对货币中的数字进行分组并删除前导零
我想知道
- 如何进行数字分组
当我物有所值时
- ,例如 3000000(300 万)我想在屏幕上打印 3.000.000(从最后一个字符开始每三个字符有一个点)删除值前面的零
当我从表中选择一个值并将其打印在屏幕上时,该值会自动用零填充:例如 129
变为 0000129
I want to know how to do
- digit grouping
when I have value for money for example 3000000 ( 3million) i want to print 3.000.000 on the screen (there is a dot every three character from the last character)
- Remove zeroes in front of value
when I select a value from table and print it on the screen, the value get padded with zeroes automatically: e.g. 129
becomes 0000129
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
WRITE
语句允许您指定货币。示例:请注意,这不会解释数字本身,而只是根据您指定的货币在某些位置添加逗号和点。因此,如果您有一个值为
3000000
的整数,并且用货币USD
写入它,则结果将是30.000,00
。我建议你阅读关于
WRITE
语句的F1帮助信息,因为除了这个之外还有很多选项。--
删除前导零是通过使用转换例程来完成的。
CONVERSION_EXIT_ALPHA_INPUT
将添加前导零,CONVERSION_EXIT_ALPHA_OUTPUT
将删除它们。可以将这些例程添加到字典中的域中,因此转换将自动完成。例如
MATNR
类型:这将输出
129
,因为域MATNR
指定了转换例程。例如,对于没有此类型的类型:
输出将为
0000129
。您可以调用CONVERSION_EXIT_ALPHA_OUTPUT
例程来实现不带前导零的输出:The
WRITE
statement allows you to specify a currency. Example:Note that this does not interpret the number itself, but just adds commas and dots at certain positions depending on the currency you specify. So in the event you have an integer with the value of
3000000
and you write it with currencyUSD
the result will be30.000,00
.I suggest you read the F1 help information on the
WRITE
statement, because there are a lot more options besides this one.--
Removing leading zeroes is done by using a conversion routine.
The
CONVERSION_EXIT_ALPHA_INPUT
will add leading zeroes andCONVERSION_EXIT_ALPHA_OUTPUT
will remove them.It is possible to add these routines to a Domain in the dictionary, so the conversion will be done automatically. For example the
MATNR
type:This will output
129
because the DomainMATNR
has a conversion routine specified.In the case of a type which does not have this, for example:
The output will be
0000129
. You can call theCONVERSION_EXIT_ALPHA_OUTPUT
routine to achieve the output without leading zeroes:另请注意,由
WRITE
语句触发的类数字类型的输出转换由用户主数据中的属性控制。应在那里配置小数分隔符和数字分组。
您可以在用户主事务中检查这一点,例如 SU01 或 SU01D。
Please also note that output conversion for numberlike types - triggered by the
WRITE
statement - is controlled by a property in the user master data.Decimal separator and digit grouping should be configured there.
You could check this in the user master transactions e.g. SU01 or SU01D.
要删除零填充,请使用 NO-ZERO 语句。对于千位分隔符,我没有看到任何问题,因为它是 ABAP 打印 P 类型值的标准方式。下面是示例代码。
这会产生输出。
For removing the zero padding use NO-ZERO statement. For the thousand separator I do not see any problem because it is a standard way ABAP prints values of type P. Here is a sample code.
This produces the output.
要删除前导零,您可以执行以下操作:
For removing leading zeros, you can do the following: