1 s4sdk
我正在尝试使用VDM从我们的S/4HANA云(公共云)获取业务合作伙伴数据.
final List<BusinessPartner> businessPartners =
new DefaultBusinessPartnerService()
.getAllBusinessPartner()
.select(BusinessPartner.BUSINESS_PARTNER,
BusinessPartner.BUSINESS_PARTNER_NAME)
.filter(BusinessPartner.BUSINESS_PARTNER_CATEGORY.eq("2"))
.orderBy(BusinessPartner.BUSINESS_PARTNER, Order.ASC)
.execute();
Run Code Online (Sandbox Code Playgroud)
正确显示英文业务伙伴名称.但日本商业伙伴名称显示为?????.
{"BusinessPartner":"80000001","BusinessPartnerName":"Domestic US Customer 1"},
{"BusinessPartner":"80000002","BusinessPartnerName":"?????????????"},
{"BusinessPartner":"90000001","BusinessPartnerName":"Domestic US Supplier 1"},
{"BusinessPartner":"90000002","BusinessPartnerName":"????????"}
Run Code Online (Sandbox Code Playgroud)
你能给我建议如何获取本地化字段的文本吗?
谢谢.
(补充说明)
我用Postman手动执行了OData.在这种情况下,本地化字段以日语显示.
https://myXXXXXX.s4hana.ondemand.com/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner?$select=BusinessPartner,BusinessPartnerName&$orderby=BusinessPartner&$filter=BusinessPartnerCategory%20eq%20'2'&$format=json&saml2=disabled
Run Code Online (Sandbox Code Playgroud)
产量
{
"d": {
"results": [
{
"__metadata": {
"id": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('80000001')",
"uri": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('80000001')",
"type": "API_BUSINESS_PARTNER.A_BusinessPartnerType"
},
"BusinessPartner": "80000001",
"BusinessPartnerName": "Domestic US Customer 1"
},
{
"__metadata": {
"id": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('80000002')",
"uri": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('80000002')",
"type": "API_BUSINESS_PARTNER.A_BusinessPartnerType"
},
"BusinessPartner": "80000002",
"BusinessPartnerName": "?????????"
},
{
"__metadata": {
"id": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('90000001')",
"uri": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('90000001')",
"type": "API_BUSINESS_PARTNER.A_BusinessPartnerType"
},
"BusinessPartner": "90000001",
"BusinessPartnerName": "Domestic US Supplier 1"
},
{
"__metadata": {
"id": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('90000002')",
"uri": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('90000002')",
"type": "API_BUSINESS_PARTNER.A_BusinessPartnerType"
},
"BusinessPartner": "90000002",
"BusinessPartnerName": "?????????"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
小智 6
如果您正在使用a HttpServlet,那么在写入响应之前,请确保将HttpServletResponse对象的字符编码UTF-8和内容类型设置为application/json.
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
96 次 |
| 最近记录: |