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

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

定价数据集成场景配置

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

OData服务列表

OData服务操作

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

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

查询操作和方法列表

读取时指定格式 - format


请求正文 - 指定返回格式为Json:

GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000006887')?$format=json
X-CSRF-Token: abc

返回结果:
Status: 200 OK
content-Type: application/json; charset=utf-8
dataserviceversion: 2.0

{     

"d" : { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000006887')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000006887')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgConditionRecordType", "etag" : "W/\"'E308C675B062688F73580777AA1AF08F96A1D1DB'\"" }, "ConditionRecord" : "0000006887", "ConditionSequentialNumber" : "1", "ConditionTable" : "304", "ConditionApplication" : "V", "ConditionType" : "PPR0", "ConditionValidityEndDate" : "\/Date(253402214400000)\/", "ConditionValidityStartDate" : "\/Date(1559001600000)\/", "CreationDate" : "\/Date(1559001600000)\/", "ConditionTextID" : "", "PricingScaleType" : "A", "PricingScaleBasis" : "C", ......
}
 

读取指定字段内容 - value



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

GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000006889',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

TG11

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


请求正文 - 跳过前4条并返回前5条定价条件有效期,执行时会先根据定价记录编号和定价条件结束日期一起按升序排列再取结果:
GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity?$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_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000000165',ConditionValidityEndDate=datetime'2020-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000000165',ConditionValidityEndDate=datetime'2020-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'35D81347C4B8946BF5F53004E2189068D6E43070'\"" }, "ConditionRecord" : "0000000165", "ConditionValidityEndDate" : "\/Date(1609372800000)\/", "ConditionValidityStartDate" : "\/Date(1293840000000)\/", "ConditionApplication" : "V", "ConditionType" : "PST0", "ConditionReleaseStatus" : "", "DepartureCountry" : "", "SalesDocument" : "", ......
}

读取记录条数 - count


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

GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord/$count
X-CSRF-Token: abc
Accept: application/json

返回结果:

Status: 200 OK content-Type: application/json; charset=utf-8 dataserviceversion: 2.0

11377


读取记录内容和条数 - inlinecount


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

GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord?$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" : "11377", "results" : [ { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000000161')",
"uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000000161')",
"type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgConditionRecordType", "etag" : "W/\"'F5A754283A36BC1E7C6434AD7732D6A67D3BE240'\"" }, "ConditionRecord" : "0000000161", "ConditionSequentialNumber" : "1", "ConditionTable" : "4BA", "ConditionApplication" : "V", "ConditionType" : "PST0", "ConditionValidityEndDate" : "\/Date(1609372800000)\/", "ConditionValidityStartDate" : "\/Date(1293840000000)\/", "CreationDate" : "\/Date(1562889600000)\/", "ConditionTextID" : "", "PricingScaleType" : "A",
......
}

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


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

GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord/?$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_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000009641')",
"uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000009641')",
"type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgConditionRecordType", "etag" : "W/\"'F467D4C392418094BBAE6B05DDF914E8D1649382'\"" }, "ConditionRecord" : "0000009641", "ConditionTable" : "304", "ConditionType" : "PPR0", "ConditionRateValue" : "16.90", "ConditionRateValueUnit" : "GBP" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000009642')",
"uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000009642')",
"type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgConditionRecordType", "etag" : "W/\"'76D59D255F3616288E6F6228DF02D0CBB17A9352'\"" }, "ConditionRecord" : "0000009642", "ConditionTable" : "304", "ConditionType" : "PPR0", "ConditionRateValue" : "17.55", "ConditionRateValueUnit" : "GBP" }, ......
}

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


请求正文 - 每条记录只返回定价记录编码,定价类型,物料,并且以物料倒序排列(默认是升序排列):

GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity/?$select=ConditionRecord,ConditionType,Material&$orderby=Material desc
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_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000129100',ConditionValidityEndDate=datetime'2019-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000129100',ConditionValidityEndDate=datetime'2019-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'6B4A341C185213EC779D3BA32D600000B210C170'\"" }, "ConditionRecord" : "0000129100", "ConditionType" : "DSC1", "Material" : "ZSRV_K1" },
{ "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000129364',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000129364',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'5A29AE44343E1957AD904D979D213A730AC7EB07'\"" }, "ConditionRecord" : "0000129364", "ConditionType" : "PPR0", "Material" : "ZSRV_K1" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000030762',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000030762',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'C834EEB716F0080ED8FF105DB7F207E3C6A6E3FF'\"" }, "ConditionRecord" : "0000030762", "ConditionType" : "PPR0", "Material" : "ZSRV_JM" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000030026',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000030026',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'274FD8A4EED8D3CEE63477EA13A19705A5A8DAA7'\"" }, "ConditionRecord" : "0000030026", "ConditionType" : "PPR0", "Material" : "ZSRV_05" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000029663',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000029663',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'17B1F3A8B01386697D21BA7DBA521D839226A2A4'\"" }, "ConditionRecord" : "0000029663", "ConditionType" : "PPR0", "Material" : "Z99_SRV_05" }, ...... }

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

请求正文 - 读取定价记录并扩展至对应的定价条件有效期,定价记录中只返回定价记录编码,定价类型,定价金额,定价货币单位。定价条件有效期中只返回定价结束日期,客户和物料:
GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000032848')?$expand=to_SlsPrcgCndnRecdValidity&$select=ConditionType,ConditionRecord,ConditionRateValue,ConditionRateValueUnit,to_SlsPrcgCndnRecdValidity/Customer,to_SlsPrcgCndnRecdValidity/Material,to_SlsPrcgCndnRecdValidity/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_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000032848')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000032848')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgConditionRecordType", "etag" : "W/\"'918FD4907CB16FAF18A51B57213939113E14A205'\"" }, "ConditionRecord" : "0000032848", "ConditionType" : "PPR0", "ConditionRateValue" : "150.00", "ConditionRateValueUnit" : "EUR", "to_SlsPrcgCndnRecdValidity" : { "results" : [ { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000032848',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000032848',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'E24DA9AB38A9D16C66D99457E7EF7CB9E92A4AF2'\"" }, "ConditionValidityEndDate" : "\/Date(253402214400000)\/", "Customer" : "1001487", "Material" : "TG13" } ] } } }

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

请求正文 - 读取定价记录并扩展至价格等级,定价记录中只返回定价记录编码,定价类型,定价金额,定价金额币种,定价等级中返回所有字段内容:
GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000032848')?$expand=to_SlsPrcgCndnRecordScale&$select=ConditionRecord,ConditionType,ConditionRateValue,ConditionRateValueUnit,to_SlsPrcgCndnRecordScale/*
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_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000032848')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000032848')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgConditionRecordType", "etag" : "W/\"'918FD4907CB16FAF18A51B57213939113E14A205'\"" }, "ConditionRecord" : "0000032848", "ConditionType" : "PPR0", "ConditionRateValue" : "150.00", "ConditionRateValueUnit" : "EUR", "to_SlsPrcgCndnRecordScale" : { "results" : [ { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000032848',ConditionSequentialNumber='1',ConditionScaleLine='1')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000032848',ConditionSequentialNumber='1',ConditionScaleLine='1')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecordScaleType", "etag" : "W/\"'D4D659AAF071276E5BC24E3357925E2FF4B3B3E8'\"" }, "ConditionRecord" : "0000032848", "ConditionSequentialNumber" : "1", "ConditionScaleLine" : "1", "ConditionScaleQuantity" : "1", "ConditionScaleQuantityUnit" : "PC", "ConditionScaleAmount" : "0.00", "ConditionScaleAmountCurrency" : "", "ConditionRateValue" : "150.00", "ConditionRateValueUnit" : "EUR", "ETag" : "D4D659AAF071276E5BC24E3357925E2FF4B3B3E8", "to_SlsPrcgCndnRecdSuplmnt" : { "__deferred" : { "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000032848',ConditionSequentialNumber='1',ConditionScaleLine='1')/to_SlsPrcgCndnRecdSuplmnt" } }, "to_SlsPrcgConditionRecord" : { "__deferred" : { "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000032848',ConditionSequentialNumber='1',ConditionScaleLine='1')/to_SlsPrcgConditionRecord" } } }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000032848',ConditionSequentialNumber='1',ConditionScaleLine='4')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000032848',ConditionSequentialNumber='1',ConditionScaleLine='4')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecordScaleType", "etag" : "W/\"'E6201156CEE38033F3E672D5EC0515249DA519BE'\"" }, "ConditionRecord" : "0000032848", "ConditionSequentialNumber" : "1", "ConditionScaleLine" : "4", "ConditionScaleQuantity" : "5", "ConditionScaleQuantityUnit" : "PC", "ConditionScaleAmount" : "0.00", "ConditionScaleAmountCurrency" : "", "ConditionRateValue" : "120.00", "ConditionRateValueUnit" : "EUR", "ETag" : "E6201156CEE38033F3E672D5EC0515249DA519BE", "to_SlsPrcgCndnRecdSuplmnt" : { "__deferred" : { "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000032848',ConditionSequentialNumber='1',ConditionScaleLine='4')/to_SlsPrcgCndnRecdSuplmnt" } }, "to_SlsPrcgConditionRecord" : { "__deferred" : { "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000032848',ConditionSequentialNumber='1',ConditionScaleLine='4')/to_SlsPrcgConditionRecord" } } }
] } } }

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

请求正文 - 获取定价记录中对应的价格等级的链接地址:
GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000028994')/$links/to_SlsPrcgCndnRecordScale 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_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000028994',ConditionSequentialNumber='1',ConditionScaleLine='1')

从定价记录跳转到定价条件有效期 - "/"

请求正文 - 从定价记录通过斜杠跳转到定价条件有限期:
GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000032848')/to_SlsPrcgCndnRecdValidity 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_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000032848',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000032848',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'0E9EE4F48F1D13178A4B84C0C6B08D26AAD87E87'\"" }, "ConditionRecord" : "0000032848", "ConditionValidityEndDate" : "\/Date(253402214400000)\/", "ConditionValidityStartDate" : "\/Date(1565222400000)\/", "ConditionApplication" : "V", "ConditionType" : "PPR0", "SalesOrganization" : "1010", "Customer" : "1001487", "Material" : "1903", ...... }

从定价记录跳转到定价补充 - "/"

请求正文 - 从定价记录通过斜杠跳转到价格补充:
GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000027288')/to_SlsPrcgCndnRecdSuplmnt 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_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000027288',ConditionSequentialNumber='2')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000027288',ConditionSequentialNumber='2')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdSuplmntType", "etag" : "W/\"'8A09AE8681A8355A43060E171FE406856FAA57FF'\"" }, "ConditionRecord" : "0000027288", "ConditionSequentialNumber" : "2", "ConditionTable" : "305", "ConditionApplication" : "V", "ConditionType" : "PPR0", "ConditionValidityEndDate" : "\/Date(253402214400000)\/", "ConditionValidityStartDate" : "\/Date(1577404800000)\/", "ConditionCalculationType" : "C", "ConditionRateValue" : "300", "ConditionRateValueUnit" : "JPY", "ConditionQuantity" : "1", "ConditionQuantityUnit" : "PC", "ConditionToBaseQtyNmrtr" : "0", "ConditionToBaseQtyDnmntr" : "0", "BaseUnit" : "", "ConditionLowerLimit" : "0", "ConditionUpperLimit" : "0", "ConditionAlternativeCurrency" : "EUR", ...... "to_SlsPrcgCndnRecdValidity" : { "__deferred" : { "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000027288',ConditionSequentialNumber='2')/to_SlsPrcgCndnRecdValidity" } }, "to_SlsPrcgCndnRecordScale" : { "__deferred" : { "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000027288',ConditionSequentialNumber='2')/to_SlsPrcgCndnRecordScale" } }, "to_SlsPrcgConditionRecord" : { "__deferred" : { "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000027288',ConditionSequentialNumber='2')/to_SlsPrcgConditionRecord" } } } ] } }

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

请求正文 - 读取条件类型是PPR0,客户编号为10100001且物料大于等于TG12小于等于TG20;或者读取条件类型是PPR0,销售组织大于1010且物料大于等于TG12小于等于TG20;结果按销售组织升序,物料降序排列:
GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity/?$filter=(ConditionType eq 'PPR0' and (Customer eq '10100001' or SalesOrganization gt '1010') and Material ge 'TG12' and Material le 'TG20')&$orderby=SalesOrganization asc,Material desc&$select=ConditionRecord,ConditionApplication,ConditionType,Material,SalesOrganization,Customer&$inlinecount=allpages
X-CSRF-Token: abc Accept: application/json

返回结果:
Status: 200 OK content-Type: application/json; charset=utf-8 dataserviceversion: 2.0


{ "d" : { "__count" : "153", "results" : [ { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000031025',ConditionValidityEndDate=datetime'2019-08-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000031025',ConditionValidityEndDate=datetime'2019-08-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'906E1481A5032A825AF1B960F8B3F308572B5E1D'\"" }, "ConditionRecord" : "0000032531", "ConditionApplication" : "V", "ConditionType" : "PPR0", "Customer" : "10100001", "Material" : "TG13", "SalesOrganization" : "1010" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000028650',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000028650',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'168BA518A281E5B8DD4FCFA6ECC02FEF4B20A0BA'\"" }, "ConditionRecord" : "0000030170", "ConditionApplication" : "V", "ConditionType" : "PPR0", "Customer" : "10100001", "Material" : "TG12", "SalesOrganization" : "1010" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000028727',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000028727',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'6752C56BBCB3E2692324B2F26D99350B778378A3'\"" }, "ConditionRecord" : "0000028727", "ConditionApplication" : "V", "ConditionType" : "PPR0", "Customer" : "10100006", "Material" : "TG12", "SalesOrganization" : "1010" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000014742',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000014742',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'DB3099A5523928BEA2F3737F89AA52FDECC234B2'\"" }, "ConditionRecord" : "0000010476", "ConditionApplication" : "V", "ConditionType" : "PPR0", "Customer" : "", "Material" : "TG20", "SalesOrganization" : "1110" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000014741',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000014741',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'6D760097CE760BD4EAAD9F337C0295687E32866F'\"" }, "ConditionRecord" : "0000010475", "ConditionApplication" : "V", "ConditionType" : "PPR0", "Customer" : "", "Material" : "TG14", "SalesOrganization" : "1110" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000014740',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000014740',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'0225B5BA3E19B9D7010A8C7B0F30EF97340FFF32'\"" }, "ConditionRecord" : "0000017271", "ConditionApplication" : "V", "ConditionType" : "PPR0", "Customer" : "", "Material" : "TG20", "SalesOrganization" : "1310" }, ...... ] } }

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

请求正文 - 读取定价类型包含“PR”,同时物料以“TG”开头的所有定价有效期记录:
GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity?$filter=(startswith(Material, 'TG') and substringof(ConditionType, 'PR'))&$select=ConditionRecord,ConditionType,ConditionValidityEndDate,ConditionValidityStartDate,Material 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_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000006888',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000006888',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'AD1C0606526461D6140515B994CB06D307D69BF5'\"" }, "ConditionRecord" : "0000006888", "ConditionValidityEndDate" : "\/Date(253402214400000)\/", "ConditionValidityStartDate" : "\/Date(1559001600000)\/", "ConditionType" : "PPR0", "Material" : "TG10" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000006889',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000006889',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'974E8E78A339A18D3A671E9B5DC59E548685BD0B'\"" }, "ConditionRecord" : "0000006889", "ConditionValidityEndDate" : "\/Date(253402214400000)\/", "ConditionValidityStartDate" : "\/Date(1559001600000)\/", "ConditionType" : "PPR0", "Material" : "TG11" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000006890',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000006890',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'A7AE0C6E2EB010551D7A664EBD9FDAA775436346'\"" }, "ConditionRecord" : "0000006890", "ConditionValidityEndDate" : "\/Date(253402214400000)\/", "ConditionValidityStartDate" : "\/Date(1559001600000)\/", "ConditionType" : "PPR0", "Material" : "TG12" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000006899',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000006899',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'7ADA14237F709A74DB3144D48A067BB218630BAA'\"" }, "ConditionRecord" : "0000006899", "ConditionValidityEndDate" : "\/Date(253402214400000)\/", "ConditionValidityStartDate" : "\/Date(1559001600000)\/", "ConditionType" : "PPR0", "Material" : "TG13" } ...... ] } }

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

请求正文 - 读取定价类型中不包含“PR”,同时物料不以“TG”开头的所有定价条件有效期记录:
GET <host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity?$filter=not(startswith(Material, 'TG') and substringof(ConditionType, 'PR'))&$select=ConditionRecord,ConditionType,ConditionValidityEndDate,ConditionValidityStartDate,Material 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_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000000161',ConditionValidityEndDate=datetime'2020-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000000161',ConditionValidityEndDate=datetime'2020-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'6E2385142C93F252F8B55D87C02B1E6942EE2A54'\"" }, "ConditionRecord" : "0000000161", "ConditionValidityEndDate" : "\/Date(1609372800000)\/", "ConditionValidityStartDate" : "\/Date(1293840000000)\/", "ConditionType" : "PST0", "Material" : "" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000000162',ConditionValidityEndDate=datetime'2020-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000000162',ConditionValidityEndDate=datetime'2020-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'CA9478B946D8EFA9527C94EE83655086573D1EC5'\"" }, "ConditionRecord" : "0000000162", "ConditionValidityEndDate" : "\/Date(1609372800000)\/", "ConditionValidityStartDate" : "\/Date(1293840000000)\/", "ConditionType" : "PST0", "Material" : "" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000007566',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000007566',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'D652886F5533373E16B9A6E55295E2BF685858D1'\"" }, "ConditionRecord" : "0000007566", "ConditionValidityEndDate" : "\/Date(253402214400000)\/", "ConditionValidityStartDate" : "\/Date(1559088000000)\/", "ConditionType" : "TTX1", "Material" : "" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000007567',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000007567',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'C098B7F4ED69B6EB9BAFD473E54EBA430AB582BB'\"" }, "ConditionRecord" : "0000007567", "ConditionValidityEndDate" : "\/Date(253402214400000)\/", "ConditionValidityStartDate" : "\/Date(1559088000000)\/", "ConditionType" : "TTX1", "Material" : "" }, ...... { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000138369',ConditionValidityEndDate=datetime'2019-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000138369',ConditionValidityEndDate=datetime'2019-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'464B2420DE5EDE338068658FCF33F436644872C3'\"" }, "ConditionRecord" : "0000138369", "ConditionValidityEndDate" : "\/Date(1577750400000)\/", "ConditionValidityStartDate" : "\/Date(1546300800000)\/", "ConditionType" : "RES1", "Material" : "" }, { "__metadata" : { "id" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000138372',ConditionValidityEndDate=datetime'2019-12-31T00%3A00%3A00')", "uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000138372',ConditionValidityEndDate=datetime'2019-12-31T00%3A00%3A00')", "type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdValidityType", "etag" : "W/\"'BBD704220F71797F4E5EA2061BBCBBB15C002D29'\"" }, "ConditionRecord" : "0000138372", "ConditionValidityEndDate" : "\/Date(1577750400000)\/", "ConditionValidityStartDate" : "\/Date(1546300800000)\/", "ConditionType" : "RES1", "Material" : "" }, ...... ] } }

结语

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