Skip to Content
Product Information

采购价格主数据OData服务 – 读取服务

S/4HANA系统中的价格管理模块,包括价格主数据管理和定价信息管理。S/4HANA系统作为定价管理系统,外围的采购系统可以从S/4HANA系统中读取定价信息,并且可以创建,修改和删除价格主数据。

S/4HANA系统提供价格主数据OData服务API_PURGPRICINGCONDITIONRECORD_SRV这个同步的主数据入站服务可以让用户获取,创建,更新和删除采购价格主数据。该OData服务包括采购中的定价记录,定价条件有效期,定价等级和定价补充。

定价数据集成场景配置

为了激活上述的OData服务,用户必须创建并激活通信场景SAP_COM_0294。

OData服务列表

1.png

OData服务操作

读取服务: 读取服务支持绝大部分的查询操作,包括filter, value, top, skip, select, orderby, count, inlinecount, expand和links。format支持三种格式,Json, Xml 和Atom,默认格式是xml。其中filter查询支持逻辑和分组操作,但是对于算术操作是不支持的,同时也支持字符串函数,对于其他函数都不支持。

上述的服务主体都支持上述的查询操作,下面的例子中以定价记录服务为主要部分,同时穿插其他服务的例子。

查询过滤操作和方法列表

读取时应用各种过滤条件示例一 – filter

请求正文 - 读取条件类型是PB00且物料为ADOBE READER的所有定价有效期记录,指定返回结果为JSON格式:
GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity/?$filter=(ConditionType eq 'PB00' and Material eq 'ADOBE READER')
CSRF-Token: abc

Accept: application/json


返回结果:
Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0


{

"d" : {

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000009129',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000009129',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgCndnRecdValidityType",

"etag" : "W/"'CD6D3382F474471B8E980FB6C34FBCC570FF8EAC'""

},

"ConditionRecord" : "0000009129",

"ConditionValidityEndDate" : "/Date(253402214400000)/",

"ConditionValidityStartDate" : "/Date(1440720000000)/",

"ConditionApplication" : "M",

"ConditionType" : "PB00",

"ConditionReleaseStatus" : "",

"PurgDocOrderQuantityUnit" : "",

"CompanyCode" : "",

"ConditionContract" : "",

"MaterialConditionGroup" : "",

"PurchasingOrganization" : "0001",

"PurchasingInfoRecordCategory" : "0",

"PurchasingDocument" : "",

"PurchasingDocumentItem" : "0",

"IncotermsClassification" : "",

"PurchasingInfoRecord" : "",

"AccountTaxType" : "",

"BillToParty" : "",

"BPForBillToParty" : "",

"Country" : "",

"Supplier" : "ASTRID",

"BPForSupplier" : "",

"InvoicingParty" : "",

"BPForInvoicingParty" : "",

"DestinationCountry" : "",

"ActiveSupplierSubrange" : "",

"MaterialGroup" : "",

"Material" : "ADOBE READER",

......

}

读取时应用各种过滤条件示例二 – filter

请求正文 - 读取物料以“SOURCE”开头的所有定价有效期记录:
GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity?$filter=(startswith(Material, 'SOURCE'))

X-CSRF-Token: abc

Accept: application/json


返回结果:
Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0


{

{

"d" : {

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000009168',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')",
"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000009168',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')",

"type" : "API_PURGPRCGCOND<host>ITIONRECORD_SRV.A_PurgPrcgCndnRecdValidityType",

          "etag" : "W/"'1ED3A4547B0172B734AEEFC1441D32C0B19DC628'""

},

"ConditionRecord" : "0000009168",

"ConditionValidityEndDate" : "/Date(253402214400000)/",

"ConditionValidityStartDate" : "/Date(1441065600000)/",

"ConditionApplication" : "M",

"ConditionType" : "PB00",

"ConditionReleaseStatus" : "",

"PurgDocOrderQuantityUnit" : "",

"CompanyCode" : "",

"ConditionContract" : "",

"MaterialConditionGroup" : "",

"PurchasingOrganization" : "0001",

"PurchasingInfoRecordCategory" : "0",

"PurchasingDocument" : "",

"PurchasingDocumentItem" : "0",

"IncotermsClassification" : "",

"PurchasingInfoRecord" : "",

"AccountTaxType" : "",

"BillToParty" : "",

"BPForBillToParty" : "",

"Country" : "",

"Supplier" : "ASTRID",

"BPForSupplier" : "",

"InvoicingParty" : "",

"BPForInvoicingParty" : "",

"DestinationCountry" : "",

"ActiveSupplierSubrange" : "",

"MaterialGroup" : "",

"Material" : "SOURCELIST2",

"MaterialType" : "",

       ......
}

读取时应用各种过滤条件示例三 – Not

请求正文 - 读取物料不以“SOURCE”开头的前两条定价条件有效期记录:
GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity?$filter=not(startswith(Material, 'SOURCE'))

Accept: application/json


返回结果:

Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0



{

"d" : {

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000006868',ConditionValidityEndDate=datetime'2019-12-31T00%3A00%3A00')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000006868',ConditionValidityEndDate=datetime'2019-12-31T00%3A00%3A00')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgCndnRecdValidityType",

"etag" : "W/"'D77D9E07B224692400B5038BE3093F4363D04EAE'""

},

"ConditionRecord" : "0000006868",

"ConditionValidityEndDate" : "/Date(1577750400000)/",

"ConditionValidityStartDate" : "/Date(1425168000000)/",

"ConditionApplication" : "M",

"ConditionType" : "PB00",

"ConditionReleaseStatus" : "",

"PurgDocOrderQuantityUnit" : "",

"CompanyCode" : "",

"ConditionContract" : "",

"MaterialConditionGroup" : "",

"PurchasingOrganization" : "0001",

"PurchasingInfoRecordCategory" : "0",

"PurchasingDocument" : "",

"PurchasingDocumentItem" : "0",

"IncotermsClassification" : "",

"PurchasingInfoRecord" : "",

"AccountTaxType" : "",

"BillToParty" : "",

"BPForBillToParty" : "",

"Country" : "",

"Supplier" : "STANDARD",

"BPForSupplier" : "STANDARD",

"InvoicingParty" : "",

"BPForInvoicingParty" : "",

"DestinationCountry" : "",

"ActiveSupplierSubrange" : "",

"MaterialGroup" : "",

"Material" : "STANDARD",

......

}

读取指定字段内容 – value



请求正文 - 返回物料字段的内容:

GET <host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000241124',ConditionValidityEndDate=datetime'9999-12-31T00:00:00')/Material/$value
X-CSRF-Token: abc


返回结果:

Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0

AIRBUS_321

读取前任意条和跳过任意条记录 – top 和 skip


请求正文 - 跳过前4条并返回前5条定价条件有效期,执行时会先根据定价记录编号和定价条件结束日期一起按升序排列再取结果:
GET <host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity?$top=5&$skip=4
X-CSRF-Token: abc
Accept: application/json


返回结果:

Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0

{   

"d" : {

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000006908',ConditionValidityEndDate=datetime'2016-03-20T00%3A00%3A00')",

"uri" : "<host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000006908',ConditionValidityEndDate=datetime'2016-03-20T00%3A00%3A00')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgCndnRecdValidityType",

"etag" : "W/"'07F847E62615030DB379D459F8FF0184AA83ED85'""

},

"ConditionRecord" : "0000006908",

"ConditionValidityEndDate" : "/Date(1458432000000)/",

"ConditionValidityStartDate" : "/Date(1430870400000)/",

"ConditionApplication" : "M",

"ConditionType" : "PB00",

"ConditionReleaseStatus" : "",

"PurgDocOrderQuantityUnit" : "",

......
}

 

读取返回指定字段的定价记录 – select


请求正文 - 每条记录只返回定价记录编码,定价类型,定价表,定价金额和定价金额币种字段:

GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord/?$select=ConditionRecord,ConditionType,ConditionTable,ConditionRateValue,ConditionRateValueUnit
X-CSRF-Token: abc
Accept: application/json


返回结果:
Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0

{


"d" : {

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000028401')",

"uri" : "<host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000028401')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgConditionRecordType",

"etag" : "W/"'4B2EA211F10B81F8C83B3097541938FB8CA9C39B'""

},

"ConditionRecord" : "0000028401",

"ConditionTable" : "017",

"ConditionType" : "PB00",

"ConditionRateValue" : "50.00",

"ConditionRateValueUnit" : "EUR"

},

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000028402')",

"uri" : "<host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000028402')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgConditionRecordType",

"etag" : "W/"'53A19B88C3E9BFAB8FBA443C52BEFBC3F574DF31'""

},

"ConditionRecord" : "0000028402",

"ConditionTable" : "017",

"ConditionType" : "PB00",

"ConditionRateValue" : "50.00",

"ConditionRateValueUnit" : "EUR"

},

......
}

读取时按指定字段排序 – orderby


请求正文 - 每条记录只返回定价记录编码,定价类型,并且以定价记录编码降序排列(默认是升序排列)。由于数据太多,此例子只选取前3条:

GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord/?$select=ConditionRecord,ConditionType&$orderby=ConditionRecord desc&$top=3
X-CSRF-Token: abc
Accept: application/json


返回结果:
Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0


{

"d" : {

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000246852')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000246852')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgConditionRecordType",

"etag" : "W/"'9237D8EB5A217E1C60DADC2567E0FE1189DEED17'""

},

"ConditionRecord" : "0000246852",

"ConditionType" : "ZPB0"

},

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000246851')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000246851')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgConditionRecordType",

"etag" : "W/"'4A2A0DF244DE691615B1CB4D04278D36466DE900'""

},

"ConditionRecord" : "0000246851",

"ConditionType" : "ZPB0"

},

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000246850')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000246850')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgConditionRecordType",

"etag" : "W/"'00A07A829863CA7DB9C9C3CE2E3A4BB2DD16534A'""

},

"ConditionRecord" : "0000246850",

"ConditionType" : "PB00"

}

]

}

}


读取记录条数 – count


请求正文 - 获取定价记录的总条数:

GET <host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord/$count
X-CSRF-Token: abc
Accept: application/json


返回结果:

Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0

67964


读取记录内容和条数 – inlinecount


请求正文 - 获取前5条记录和定价记录总条数:

GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord?$top=5&$inlinecount=allpages
X-CSRF-Token: abc
Accept: application/json


返回结果:
Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0

{


"d" : {

"__count" : "67964",

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('%24%2400000003')",

"uri" : "<host>/sap/opu/odata/SAP/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('%24%2400000003')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgConditionRecordType",

"etag" : "W/"'168D0DF2C407B7A8646CF8887787D050E5572B8B'""

},

"ConditionRecord" : "$$00000003",

"ConditionSequentialNumber" : "1",

"ConditionTable" : "016",

"ConditionApplication" : "M",

"ConditionType" : "PB00",

"ConditionValidityEndDate" : "/Date(1548374400000)/",

"ConditionValidityStartDate" : "/Date(1547424000000)/",

"CreatedByUser" : "KUMARRAJE4",

"CreationDate" : "/Date(1548633600000)/",

"ConditionTextID" : "",

"PricingScaleType" : "A",
......
}

读取定价记录时扩展至定价条件有效期 – expand

请求正文 - 读取定价记录并扩展至对应的定价条件有效期,定价记录中只返回定价记录编码,定价类型,定价金额,定价货币单位。定价条件有效期中只返回定价结束日期和物料:

GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000241124')?$expand=to_PurgPrcgCndnRecdValidity&$select=ConditionType,ConditionRecord,ConditionRateValue,ConditionRateValueUnit,to_PurgPrcgCndnRecdValidity/Material,to_PurgPrcgCndnRecdValidity/ConditionValidityEndDate

X-CSRF-Token: abc

Accept: application/json


返回结果:

Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0


{

"d" : {

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000241124')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000241124')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgConditionRecordType",

"etag" : "W/"'182123C814BC23C0E62F5A5A15319CD713FFAAAA'""

},

"ConditionRecord" : "0000241124",

"ConditionType" : "PB00",

"ConditionRateValue" : "500.00",

"ConditionRateValueUnit" : "EUR",

"to_PurgPrcgCndnRecdValidity" : {

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000241124',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000241124',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgCndnRecdValidityType",

"etag" : "W/"'D69664CEFC2D6756749733E7B2ECB258FF0A01AD'""

},

"ConditionValidityEndDate" : "/Date(253402214400000)/",

"Material" : "AIRBUS_321"

}

]

}

}

}

读取定价记录时扩展至定价等级 – expand

请求正文 - 读取定价记录并扩展至价格等级,定价记录中只返回定价记录编码,定价类型,定价金额,定价金额币种,定价等级中返回所有字段内容:
GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000046706')?$expand=to_PurgPricingCndnRecdScale&$select=ConditionRecord,ConditionType,ConditionRateValue,ConditionRateValueUnit,to_PurgPricingCndnRecdScale/*
X-CSRF-Token: abc
Accept: application/json


返回结果:
Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0


{

"d" : {

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000046706')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000046706')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgConditionRecordType",

"etag" : "W/"'13ABD90A42ED28B2379405A6FA9228AF861B2628'""

},

"ConditionRecord" : "0000046706",

"ConditionType" : "PB00",

"ConditionRateValue" : "2.00",

"ConditionRateValueUnit" : "EUR",

"to_PurgPricingCndnRecdScale" : {

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecordScale(ConditionRecord='0000046706',ConditionSequentialNumber='1',ConditionScaleLine='1')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecordScale(ConditionRecord='0000046706',ConditionSequentialNumber='1',ConditionScaleLine='1')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgCndnRecordScaleType",

"etag" : "W/"'BF81A04BE9E1C2F2EBB5929A492A9CFA38975469'""

},

"ConditionRecord" : "0000046706",

"ConditionSequentialNumber" : "1",

"ConditionScaleLine" : "1",

"ConditionScaleQuantity" : "1",

"ConditionScaleQuantityUnit" : "PCS",

"ConditionScaleAmount" : "0.00",

"ConditionScaleAmountCurrency" : "",

"ConditionRateValue" : "2.00",

"ConditionRateValueUnit" : "EUR",

"ETag" : "BF81A04BE9E1C2F2EBB5929A492A9CFA38975469",

"to_PurgPrcgCndnRecdSuplmnt" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecordScale(ConditionRecord='0000046706',ConditionSequentialNumber='1',ConditionScaleLine='1')/to_PurgPrcgCndnRecdSuplmnt"

}

},

"to_PurgPrcgConditionRecord" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecordScale(ConditionRecord='0000046706',ConditionSequentialNumber='1',ConditionScaleLine='1')/to_PurgPrcgConditionRecord"

}

}

},

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecordScale(ConditionRecord='0000046706',ConditionSequentialNumber='1',ConditionScaleLine='4')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecordScale(ConditionRecord='0000046706',ConditionSequentialNumber='1',ConditionScaleLine='4')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgCndnRecordScaleType",

"etag" : "W/"'05ADDEF7FF5DFE406A77F270914AEA327A1FFD41'""

},

"ConditionRecord" : "0000046706",

"ConditionSequentialNumber" : "1",

"ConditionScaleLine" : "4",

"ConditionScaleQuantity" : "2",

"ConditionScaleQuantityUnit" : "PCS",

"ConditionScaleAmount" : "0.00",

"ConditionScaleAmountCurrency" : "",

"ConditionRateValue" : "5.00",

"ConditionRateValueUnit" : "EUR",

"ETag" : "05ADDEF7FF5DFE406A77F270914AEA327A1FFD41",

"to_PurgPrcgCndnRecdSuplmnt" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecordScale(ConditionRecord='0000046706',ConditionSequentialNumber='1',ConditionScaleLine='4')/to_PurgPrcgCndnRecdSuplmnt"

}

},

"to_PurgPrcgConditionRecord" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecordScale(ConditionRecord='0000046706',ConditionSequentialNumber='1',ConditionScaleLine='4')/to_PurgPrcgConditionRecord"

}

}

}

]

}

}

}

读取定价记录中定价等级的链接 – links

请求正文 - 获取定价记录中对应的价格等级的链接地址:
GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000012908')/$links/to_PurgPricingCndnRecdScale

X-CSRF-Token: abc

Accept: application/json


返回结果:

Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0

<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecordScale(ConditionRecord='0000012908',ConditionSequentialNumber='1',ConditionScaleLine='1')

从定价记录跳转到定价条件有效期 – “/”

请求正文 - 从定价记录通过斜杠跳转到定价条件有限期:
GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000241124')/to_PurgPrcgCndnRecdValidity

X-CSRF-Token: abc

Accept: application/json


返回结果:
Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0


{

"d" : {

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000241124',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdValidity(ConditionRecord='0000241124',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgCndnRecdValidityType",

"etag" : "W/"'A176CB9A5A33775E304A7CCA5FF6F717C7B3F628'""

},

"ConditionRecord" : "0000241124",

"ConditionValidityEndDate" : "/Date(253402214400000)/",

"ConditionValidityStartDate" : "/Date(1581897600000)/",

"ConditionApplication" : "M",

"ConditionType" : "PB00",

"ConditionReleaseStatus" : "",

"PurgDocOrderQuantityUnit" : "",

......

}

从定价记录跳转到定价补充 – “/”

请求正文 - 从定价记录通过斜杠跳转到价格补充:
GET <host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgConditionRecord('0000032258')/to_PurgPrcgCndnRecdSuplmnt

X-CSRF-Token: abc

Accept: application/json


返回结果:
Status: 200 OK

content-Type: application/json; charset=utf-8

dataserviceversion: 2.0


{

"d" : {

"results" : [

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdSuplmnt(ConditionRecord='0000032258',ConditionSequentialNumber='2')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdSuplmnt(ConditionRecord='0000032258',ConditionSequentialNumber='2')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgCndnRecdSuplmntType",

"etag" : "W/"'6CF1EF41AEC09A1B34206D25BA0F1CBB1029F9AA'""

},

"ConditionRecord" : "0000032258",

"ConditionSequentialNumber" : "2",

"ConditionTable" : "016",

"ConditionApplication" : "M",

"ConditionType" : "FRA1",

"ConditionValidityEndDate" : "/Date(253402214400000)/",

"ConditionValidityStartDate" : "/Date(1455408000000)/",

"CreatedByUser" : "SNAGA0",

"CreationDate" : "/Date(1472688000000)/",

"ConditionTextID" : "",

"PricingScaleType" : "A",

"PricingScaleBasis" : "",

"ConditionScaleQuantity" : "0.000",

"ConditionScaleQuantityUnit" : "",

"ConditionScaleAmount" : "0.00",

"ConditionScaleAmountCurrency" : "",

"ConditionCalculationType" : "A",

"ConditionRateValue" : "2.00",

"ConditionRateValueUnit" : "%",

"ConditionQuantity" : "0",

"ConditionQuantityUnit" : "",

"ConditionToBaseQtyNmrtr" : "0",

"ConditionToBaseQtyDnmntr" : "0",

"BaseUnit" : "",

"ConditionLowerLimit" : "0.00",

"ConditionUpperLimit" : "0.00",

"ConditionAlternativeCurrency" : "",

"ConditionExclusion" : "",

"ConditionIsDeleted" : false,

"AdditionalValueDays" : "0",

"FixedValueDate" : null,

"PaymentTerms" : "",

"CndnMaxNumberOfSalesOrders" : "0",

"MinimumConditionBasisValue" : "0.000",

"MaximumConditionBasisValue" : "0.000",

"MaximumConditionAmount" : "0.00",

"IncrementalScale" : "0",

"PricingScaleLine" : "0",

"ConditionReleaseStatus" : "",

"ETag" : "6CF1EF41AEC09A1B34206D25BA0F1CBB1029F9AA",

"to_PurgPrcgCndnRecdValidity" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdSuplmnt(ConditionRecord='0000032258',ConditionSequentialNumber='2')/to_PurgPrcgCndnRecdValidity"

}

},

"to_PurgPrcgConditionRecord" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdSuplmnt(ConditionRecord='0000032258',ConditionSequentialNumber='2')/to_PurgPrcgConditionRecord"

}

},

"to_PurgPricingCndnRecdScale" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdSuplmnt(ConditionRecord='0000032258',ConditionSequentialNumber='2')/to_PurgPricingCndnRecdScale"

}

}

},

{

"__metadata" : {

"id" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdSuplmnt(ConditionRecord='0000032258',ConditionSequentialNumber='3')",

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdSuplmnt(ConditionRecord='0000032258',ConditionSequentialNumber='3')",

"type" : "API_PURGPRCGCONDITIONRECORD_SRV.A_PurgPrcgCndnRecdSuplmntType",

"etag" : "W/"'700DF5934446930BD95E1C0B693FBF496966D8DC'""

},

"ConditionRecord" : "0000032258",

"ConditionSequentialNumber" : "3",

"ConditionTable" : "016",

"ConditionApplication" : "M",

"ConditionType" : "FRB1",

"ConditionValidityEndDate" : "/Date(253402214400000)/",

"ConditionValidityStartDate" : "/Date(1455408000000)/",

"CreatedByUser" : "SNAGA0",

"CreationDate" : "/Date(1472688000000)/",

"ConditionTextID" : "",

"PricingScaleType" : "A",

"PricingScaleBasis" : "",

"ConditionScaleQuantity" : "0.000",

"ConditionScaleQuantityUnit" : "",

"ConditionScaleAmount" : "0.00",

"ConditionScaleAmountCurrency" : "",

"ConditionCalculationType" : "B",

"ConditionRateValue" : "4.00",

"ConditionRateValueUnit" : "EUR",

"ConditionQuantity" : "0",

"ConditionQuantityUnit" : "",

"ConditionToBaseQtyNmrtr" : "0",

"ConditionToBaseQtyDnmntr" : "0",

"BaseUnit" : "",

"ConditionLowerLimit" : "0.00",

"ConditionUpperLimit" : "0.00",

"ConditionAlternativeCurrency" : "",

"ConditionExclusion" : "",

"ConditionIsDeleted" : false,

"AdditionalValueDays" : "0",

"FixedValueDate" : null,

"PaymentTerms" : "",

"CndnMaxNumberOfSalesOrders" : "0",

"MinimumConditionBasisValue" : "0.000",

"MaximumConditionBasisValue" : "0.000",

"MaximumConditionAmount" : "0.00",

"IncrementalScale" : "0",

"PricingScaleLine" : "0",

"ConditionReleaseStatus" : "",

"ETag" : "700DF5934446930BD95E1C0B693FBF496966D8DC",

"to_PurgPrcgCndnRecdValidity" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdSuplmnt(ConditionRecord='0000032258',ConditionSequentialNumber='3')/to_PurgPrcgCndnRecdValidity"

}

},

"to_PurgPrcgConditionRecord" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdSuplmnt(ConditionRecord='0000032258',ConditionSequentialNumber='3')/to_PurgPrcgConditionRecord"

}

},

"to_PurgPricingCndnRecdScale" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/sap/API_PURGPRCGCONDITIONRECORD_SRV/A_PurgPrcgCndnRecdSuplmnt(ConditionRecord='0000032258',ConditionSequentialNumber='3')/to_PurgPricingCndnRecdScale"

}

}

}

]

}

}



结语

上面描述了在读取时所有支持的操作和相关的部分例子,用户在使用的时候可以参考上述例子并结合自己的查询需求来组合所需要的查询请求。

Be the first to leave a comment
You must be Logged on to comment or reply to a post.