Skip to Content
Product Information

销售价格主数据OData服务 – 创建服务

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

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

定价数据集成场景配置

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

OData服务列表

OData服务操作

创建定价记录:创建定价记录针对非扁平数据结构,即纵深数据结构进行数据的创建。单独创建定价记录对扁平数据结构是不支持的,单独创建定价条件有效期也是不支持的,二者必须同时创建。但是针对已存在的定价记录,单独创建定价等级和定价补充支持扁平数据结构。

下面会针对不同的创建情况提供相对应的例子。

创建定价记录和定价条件有限期

请求正文:
POSTT <host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord

X-CSRF-Token: abc

Content-Type: application/json

Accept: application/json

{

"ConditionTable" : "305",

"ConditionType" : "PPR0",

"ConditionRateValue" : "123.00",

"ConditionRateValueUnit" : "EUR",

"to_SlsPrcgCndnRecdValidity" : [

{

"ConditionValidityEndDate" : "2020-12-13T00:00:00",

"ConditionValidityStartDate" : "2020-12-13T00:00:00",

"Customer" : "10100001",

"Material" : "TG11",

"SalesOrganization" : "1010",

"DistributionChannel" : "10"

}

]

}

返回结果:

Status: 201 Created

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

location: <host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000027889')

etag: W/"''"

dataserviceversion: 2.0

{

"d" : {

"__metadata" : {

"id" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000027889')",

"uri" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000027889')",

"type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgConditionRecordType",

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

},

"ConditionRecord" : "0000027889",

"ConditionSequentialNumber" : "1",
......
}


创建定价记录,定价条件有限期和定价等级

请求正文:
POST <host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord

X-CSRF-Token: abc

Content-Type: application/json

Accept: application/json

{

"ConditionTable" : "305",

"ConditionType" : "PPR0",

"ConditionRateValue" : "200.00",

"ConditionRateValueUnit" : "EUR",

"to_SlsPrcgCndnRecdValidity" : [

{

"ConditionValidityEndDate" : "2022-11-30T00:00:00",

"ConditionValidityStartDate" : "2022-11-02T00:00:00",

"ConditionType" : "PPR0",

"Customer" : "10100001",

"Material" : "TG11",

"SalesOrganization" : "1010",

"DistributionChannel" : "10"

}

],

"to_SlsPrcgCndnRecordScale" : [

{

"ConditionSequentialNumber" : "1",

"ConditionScaleLine" : "1",

"ConditionScaleQuantity" : "10.000",

"ConditionRateValue" : "400.000",

"ConditionRateValueUnit" : "EUR"

},

{

"ConditionSequentialNumber" : "1",

"ConditionScaleLine" : "2",

"ConditionScaleQuantity" : "20.000",

"ConditionRateValue" : "300.000",

"ConditionRateValueUnit" : "EUR"

},

{

"ConditionSequentialNumber" : "1",

"ConditionScaleLine" : "3",

"ConditionScaleQuantity" : "30.000",

"ConditionRateValue" : "200.000",

"ConditionRateValueUnit" : "EUR"

}

]

}

返回结果:

Status: 201 Created

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

location: <host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000027865')

etag: W/"''"

dataserviceversion: 2.0

{

"d" : {

"__metadata" : {

"id" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000027865')",

"uri" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000027865')",

"type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgConditionRecordType",

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

},

"ConditionRecord" : "0000027865",

"ConditionSequentialNumber" : "1",

"ConditionTable" : "305",
......
}

创建定价记录,定价条件有效期和定价补充

请求正文:
POST <host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord

X-CSRF-Token: abc

Content-Type: application/json

Accept: application/json

{

"ConditionTable" : "305",

"ConditionType" : "PPR0",

"ConditionRateValue" : "231.12",

"ConditionRateValueUnit" : "EUR",

"to_SlsPrcgCndnRecdValidity" : [

{

"ConditionValidityEndDate" : "2024-11-30T00:00:00",

"ConditionValidityStartDate" : "2024-11-05T00:00:00",

"ConditionType" : "PPR0",

"Customer" : "10100001",

"Material" : "TG11",

"SalesOrganization" : "1010",

"DistributionChannel" : "10"

}

],

"to_SlsPrcgCndnRecdSuplmnt" : [

{

"ConditionSequentialNumber" : "2",

"ConditionType" : "PPR0",

"ConditionRateValue" : "555.55",

"ConditionRateValueUnit" : "EUR"

},

{

"ConditionSequentialNumber" : "3",

"ConditionType" : "DRG1",

"ConditionRateValue" : "10.0",

"ConditionRateValueUnit" : "%"

}

]

}


返回结果:
Status: 201 Created

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

location: <host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000061098')

etag: W/"''"

dataserviceversion: 2.0

{

"d" : {

"__metadata" : {

"id" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000061098')",

"uri" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000061098')",

"type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgConditionRecordType",

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

},

"ConditionRecord" : "0000061098",

"ConditionSequentialNumber" : "1",

"ConditionTable" : "305",
......
}

基于已存在的定价记录创建定价等级

请求正文:
POST <host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale

X-CSRF-Token: abc

Content-Type: application/json

Accept: application/json

{

"ConditionRecord" : "0000027867",

"ConditionSequentialNumber" : "1",

"ConditionScaleLine" : "1",

"ConditionScaleQuantity" : "10.000",

"ConditionScaleQuantityUnit": "PC",

"ConditionRateValue" : "222.23",

"ConditionRateValueUnit" : "EUR"

}

返回结果:

Status: 201 Created

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

location: <host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000027867',ConditionSequentialNumber='1',ConditionScaleLine='1')

etag: W/"''"

dataserviceversion: 2.0

{

"d" : {

"__metadata" : {

"id" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000027867',ConditionSequentialNumber='1',ConditionScaleLine='1')",

"uri" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000027867',ConditionSequentialNumber='1',ConditionScaleLine='1')",

"type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecordScaleType",

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

},

"ConditionRecord" : "0000027867",

"ConditionSequentialNumber" : "1",

"ConditionScaleLine" : "1",

"ConditionScaleQuantity" : "10",

"ConditionScaleQuantityUnit" : "PC",

"ConditionScaleAmount" : "0.00",

"ConditionScaleAmountCurrency" : "",

"ConditionRateValue" : "222.23",

"ConditionRateValueUnit" : "EUR",

"ETag" : "",

"to_SlsPrcgCndnRecdSuplmnt" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000027867',ConditionSequentialNumber='1',ConditionScaleLine='1')/to_SlsPrcgCndnRecdSuplmnt"

}

},

"to_SlsPrcgConditionRecord" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecordScale(ConditionRecord='0000027867',ConditionSequentialNumber='1',ConditionScaleLine='1')/to_SlsPrcgConditionRecord"

}

}

}

}

基于已存在的定价记录创建定价补充

请求正文:
POST <host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt

X-CSRF-Token: abc

Content-Type: application/json

Accept: application/json

{

"ConditionRecord" : "0000061098",

"ConditionSequentialNumber" : "4",

"ConditionType" : "PPR0",

"ConditionRateValue" : "3000",

"ConditionRateValueUnit" : "JPY"

}


返回结果:
Status: 201 Created

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

location: <host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000061098',ConditionSequentialNumber='4')

etag: W/"''"

dataserviceversion: 2.0

{

"d" : {

"__metadata" : {

"id" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000061098',ConditionSequentialNumber='4')",

"uri" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000061098',ConditionSequentialNumber='4')",

"type" : "API_SLSPRICINGCONDITIONRECORD_SRV.A_SlsPrcgCndnRecdSuplmntType",

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

},

"ConditionRecord" : "0000061098",

"ConditionSequentialNumber" : "4",

"ConditionTable" : "305",

"ConditionApplication" : "V",

"ConditionType" : "PPR0",

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

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

"CreatedByUser" : "",

"CreationDate" : null,

"ConditionTextID" : "",

"PricingScaleType" : "",

"PricingScaleBasis" : "C",

"ConditionScaleQuantity" : "0.000",

"ConditionScaleQuantityUnit" : "",

"ConditionScaleAmount" : "0",

"ConditionScaleAmountCurrency" : "",

"ConditionCalculationType" : "C",

"ConditionRateValue" : "3000",

"ConditionRateValueUnit" : "JPY",

"ConditionQuantity" : "1",

"ConditionQuantityUnit" : "PC",

"ConditionToBaseQtyNmrtr" : "0",

"ConditionToBaseQtyDnmntr" : "0",

"BaseUnit" : "",

"ConditionLowerLimit" : "0",

"ConditionUpperLimit" : "0",

"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" : "",

"to_SlsPrcgCndnRecdValidity" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000061098',ConditionSequentialNumber='4')/to_SlsPrcgCndnRecdValidity"

}

},

"to_SlsPrcgCndnRecordScale" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000061098',ConditionSequentialNumber='4')/to_SlsPrcgCndnRecordScale"

}

},

"to_SlsPrcgConditionRecord" : {

"__deferred" : {

"uri" : "<host>/sap/opu/odata/SAP/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000061098',ConditionSequentialNumber='4')/to_SlsPrcgConditionRecord"

}

}

}

}


结语

上述文章中描述了定价记录,定价条件有限期,定价等级和定价补充的创建,用户可以直接拷贝上述提供的JSON请求正文来使用,同时用户也可以添加其他需要赋值的字段。由于篇幅有限,部分的返回结果无法完全提供,用户在使用时可以看到完整的返回结果。

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