SAP BDC 调用中 金额格式转换
在BDC调用中,由于用户设置不同,导致金额、日期等字段的输入格式不正确。此处给出 自创 金额转换FM 并配有 调用方式。
function zgm_conver_cuur.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_STRIN)
*" REFERENCE(I_DECIMALS) TYPE I
*" EXPORTING
*" REFERENCE(E_STROUT)
*"----------------------------------------------------------------------
data:l_dcpfm like usr01-dcpfm,
l_strin type char20,
l_reverse type char20,
l_strout type char20,
l_str1 type string,
l_str2 type string, l_mask type string.
data:l_lenth type i.
data:l_lenth2 type i.
clear l_mask.
l_str2 = '___'.
case i_decimals.
when 2.
l_str1 = '__'.
when 3.
l_str1 = '___'.
when 4.
l_str1 = '____'.
when others.
endcase. l_strin = i_strin.
"remove Punctuation by space
replace '.' with '' into l_strin.
condense l_strin no-gaps.
l_lenth = strlen( l_strin ).
l_lenth2 = l_lenth - i_decimals. case l_lenth2.
when 1 or 2 or 3.
when 4 or 5 or 6.
when others.
endcase.
"reverse string
call function 'STRING_REVERSE'
exporting
string = l_strin
lang = sy-langu
importing
rstring = l_reverse. select single dcpfm into l_dcpfm from usr01 where bname = sy-uname. case l_dcpfm.
when ''.
case l_lenth2.
when 1 or 2 or 3.
concatenate l_str1 l_str2 into l_mask separated by ','.
when 4 or 5 or 6.
concatenate l_str2 l_str2 into l_mask separated by '.'.
concatenate l_str1 l_mask into l_mask separated by ','.
when 7 or 8 or 9.
concatenate l_str2 l_str2 l_str2 into l_mask separated by '.'.
concatenate l_str1 l_mask into l_mask separated by ','.
when 10 or 11 or 12.
concatenate l_str2 l_str2 l_str2 l_str2 into l_mask separated by '.'.
concatenate l_str1 l_mask into l_mask separated by ','.
when others.
endcase.
when 'X'.
case l_lenth2.
when 1 or 2 or 3.
concatenate l_str1 l_str2 into l_mask separated by '.'.
when 4 or 5 or 6.
concatenate l_str2 l_str2 into l_mask separated by ','.
concatenate l_str1 l_mask into l_mask separated by '.'.
when 7 or 8 or 9.
concatenate l_str2 l_str2 l_str2 into l_mask separated by ','.
concatenate l_str1 l_mask into l_mask separated by '.'.
when 10 or 11 or 12.
concatenate l_str2 l_str2 l_str2 l_str2 into l_mask separated by ','.
concatenate l_str1 l_mask into l_mask separated by '.'.
when others.
endcase.
when 'Y'.
case l_lenth2.
when 1 or 2 or 3.
concatenate l_str1 l_str2 into l_mask separated by ','.
when 4 or 5 or 6.
concatenate l_str2 l_str2 into l_mask separated by space.
concatenate l_str1 l_mask into l_mask separated by ','.
when 7 or 8 or 9.
concatenate l_str2 l_str2 l_str2 into l_mask separated by space.
concatenate l_str1 l_mask into l_mask separated by ','.
when 10 or 11 or 12.
concatenate l_str2 l_str2 l_str2 l_str2 into l_mask separated by space.
concatenate l_str1 l_mask into l_mask separated by ','.
when others.
endcase.
endcase. write l_reverse using edit mask l_mask to l_strout. if sy-subrc = 0.
"reverse string
call function 'STRING_REVERSE'
exporting
string = l_strout
lang = sy-langu
importing
rstring = e_strout.
endif.
endfunction.
DATA:l_wrbtr LIKE bdcdata-fval. "BDC Amount
l_wrbtr = <lfs_post>-kwert.
CONDENSE l_wrbtr NO-GAPS.
CALL FUNCTION 'ZGM_CONVER_CUUR'
EXPORTING
i_strin = l_wrbtr
i_decimals = 2"两位小数,也可三位 四位
IMPORTING
e_strout = l_wrbtr.
SAP BDC 调用中 金额格式转换的更多相关文章
- JAVA中时间格式转换
1.将任意日期格式的字符串转换为指定格式的字符串 //默认格式 String s1 = "20190110133236"; //给定格式 String s2 = "201 ...
- layui的table中日期格式转换
我使用的layui的2.4.5版本,在util中已经带了格式转换的函数.这里主要记录如何使用. 未使用前在table中显示如下: 前端代码如下: {field:'createDate', title: ...
- SpringBoot+MyBatis Plus对Map中Date格式转换的处理
在 SpringBoot 项目中, 如何统一 JSON 格式化中的日期格式 问题 现在的关系型数据库例如PostgreSQL/MySQL, 都已经对 JSON 类型提供相当丰富的功能, 项目中对于不需 ...
- Sql与C#中日期格式转换总结
SQL中的转换方法: 一.将string转换为datetime,主要是使用Convert方法, 方法,Convert(datetime [ ( length ) ] , expression, [st ...
- Mac中的格式转换如何用读写工具Tuxera NTFS完成
Tuxera NTFS for Mac是一款专门为Mac用户提供的NTFS驱动软件,它不仅可以进行磁盘文件的访问.编辑.传输和存储,还可以对硬盘进行维修检查以及修复. 今天小编就给大家简单介绍一下Tu ...
- Sql Server中Float格式转换字符串varchar方法(转)
1.[Sql Server](70) SELECT CONVERT(varchar(100), CAST(@testFloat AS decimal(38,2)))SELECT STR(@testF ...
- js读取excel中日期格式转换问题
在使用js-xlsx插件来读取excel时,会将2018/10/16这种数据自动装换成48264.12584511. 所以需要自己手动再转换回来 // excel读取2018/01/01这种时间格式是 ...
- JAVA中日期格式转换各个字母代表含义
G Era 标志符 Text AD y 年 Year 1996; 96 M 年中的月份 Month July; Jul; 07 w 年中的周数 Number 27 W ...
- linq中日期格式转换或者比较,程序报错说不支持方法的解决办法
public void TestMethod1(){using (var _context = new hotelEntities()){var rq = DateTime.Now.Date;var ...
随机推荐
- (2020行人再识别综述)Person Re-Identification using Deep Learning Networks: A Systematic Review
目录 1.引言 2.研究方法 2.1本次综述的贡献 2.2综述方法 2.3与现有综述的比较 3.行人再识别基准数据集 3.1基于图像的再识别数据集 3.2基于视频的再识别数据集 4.基于图像的深度再识 ...
- 2021.07.23 P2474 天平(差分约束)
2021.07.23 P2474 天平(差分约束) [P2474 SCOI2008]天平 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 题意: 已知A,B和每两个点点权,求点权i, ...
- linux 手动挂载硬盘没有移到回收站解决方法
linux 手动挂载硬盘没有移到回收站解决方法 修改挂载硬盘的文件夹权限为当前用户即可 或者 修改读写权限 chmod 777 mount-disk-path
- mmdetection 绘制PR曲线
参考:https://github.com/xuhuasheng/mmdetection_plot_pr_curve 适用于COCO数据集 import os import mmcv import n ...
- 关于openstreet map的osm文件转shp文件方法(附arcgis10.2插件)
一.下载并安装对应arcgis版本的osm插件 对应arcgis版本的osm转换插件在arcgis官网可以下载 http://www.arcgis.com/home/search.html?q=Arc ...
- Python求解线性规划——PuLP使用教程
简洁是智慧的灵魂,冗长是肤浅的藻饰.--莎士比亚<哈姆雷特> 1 PuLP 库的安装 如果您使用的是 Anaconda[1] 的话(事实上我也更推荐这样做),需要先激活你想要安装的虚拟环境 ...
- 攻防世界-MISC:base64stego
这是攻防世界新手练习区的第十一题,题目如下: 点击下载附件一,发现是一个压缩包,点击解压,发现是需要密码才能解密 先用010editor打开这个压缩包,这里需要知道zip压缩包的组成部分,包括压缩源文 ...
- SICP 2.2: 层次性数据和闭包性质(Python实现)
绪论 序对可以为我们提供用于构造复合数据的基本"粘接剂",鉴于Python中tuple中元素不可变的性质,我们通过list来实现序对,如[1, 2].Python的PyListOb ...
- java实现空心金字塔
前言 最近在学习java,遇到了一个经典打印题目,空心金字塔,初学者记录,根据网上教程,有一句话感觉很好,就是先把麻烦的问题转换成很多的简单问题,最后一一解决就可以了,然后先死后活,先把程序写死,后面 ...
- 拖动元素调换位置——sortable.js
使用简介: https://github.com/SortableJS/Sortable https://segmentfault.com/a/1190000008209715 /**! * Sort ...