如何使用C#获取SAP的表结构

时间:2015-12-11 07:13:24

标签: c# .net sap-connector

我使用 C# SAP 编写了一些关于提取表结构的代码,我对RFC_READ_TABLE有疑问,当我定义一个表的名称时,FIELDS表返回了5列,例如:FIELDNAMEOFFSETLENGTHTFIELDTEXT,实际上我根据这5列不知道数字字段的小数位是什么,有没有其他方法可以得到这个?请注意,我的 SAP帐户是公开的,因为其他人也在使用它,我不应该在 SAP 中创建新的功能模块。

以下信息是我从模块RFC_READ_TABLE的FIELDS表中得到的:

MANDT   | 000000   | 000003   | C   | Client**: length * 3**
BUKRS   | 000003   | 000004   | C   | Company Code: **length * 3**
ANLN1   | 000007   | 000012   | C   | Main Asset Number: **length * 3**
ANLN2   | 000019   | 000004   | C   | Asset Subnumber: **length * 3**
GJAHR   | 000023   | 000004   | N   | Fiscal Year: **numeric(4,0)**
LNRAN   | 000027   | 000005   | N   | Sequence Number of Asset Line Items in Fiscal Year: **numeric(5,0)**
AFABE   | 000032   | 000002   | N   | Real depreciation area: **numeric(2,0)**
ZUJHR   | 000034   | 000004   | N   | Asset acquisition year (currently not used): **numeric(4,0)**
ZUCOD   | 000038   | 000004   | N   | Sub-classification of asset acquisitions(currently not used): **numeric(4,0)**
AUFWV   | 000042   | 000013   | P   | Proportional cumulative revaluation on replacement value: **numeric(13,??=2)** 

根据数据库,这个字段的数据类型是数字(13,2),但我怎样才能得到这个线索? 提前谢谢!

1 个答案:

答案 0 :(得分:3)

RFC_READ_TABLE FM仅返回字段摘要。您可以使用DDIF_FIELDINFO_GET FM获取详细信息。