`
csstome
  • 浏览: 1476305 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

外部程序调用BAPI应注意输入参数的位数...

阅读更多

今天上午 在.net 中创建 Bapi_Customer_Getdetail2 再读取sap 的customer的相关信息,测试不成功,Customer 10030 在SAP SE37 中没问题,但在.net 的web page 测试页却拿不到数据,原因是在调用BAPI 的过程中能输入的参数有严格的位数限制, 在SAP 的表 KNA1 中 KUNNR, Customer 的位数是10 位,所在就要写采用在前面补0 的功能,

.net 的class 中创建如下function 将参数进行格式化:

Private Function FormatStringZW(ByVal p_str As String, ByVal p_len As Integer) As String
Dim len As Integer
len = p_str.Length
FormatStringZW = p_str
While len < p_len
FormatStringZW = "0" + FormatStringZW
len = len + 1
End While
End Function


再次测试通过!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics