The user roles are Studio Administrator, Developer, and Business User.

  • PDI_ADMINISTRATION / Administration
  • PDI_DEVELOPMENT / Development

对于Sales Order creation来说,Buyer Party以及行项目的Product维护是必须的。

通过TypeCode区分CustomerQuote是Sales Order还是Sales Quote:

使用ABSL创建Sales Order的代码:

import ABSL;
import AP.CRM.Global;// ABSL example for CustomerQuote// define CustomerQuote root node
var elCustomerQuote_Root: elementsof CustomerQuote;
var instCustomerQuote;// define CustomerQuote item node
var elCustomerQuote_Item: elementsof CustomerQuote.Item;
var instCustomerQuote_Item;// CustomerQuote: maintain Business Object type - optional (default value: 30 = Sales Quote set by system; other values: 2059 = Sales Order)
elCustomerQuote_Root.TypeCode = "30";// CustomerQuote: maintain description - optional
elCustomerQuote_Root.Name.content = "PSM CRM ABSL Test - CallCustomerQuoteExample";// CustomerQuote: maintain external reference - optional
elCustomerQuote_Root.BuyerID.content = "PSM CRM ABSL Test - Example_01";// CustomerQuote: create new instance
instCustomerQuote = CustomerQuote.Create(elCustomerQuote_Root);// CustomerQuote: maintain buyer party - mandatory
//             the instance of node Party is created automatically by the system
instCustomerQuote.BuyerParty.PartyKey.PartyID.content = "MC9785";// CustomerQuote: maintain item with product// CustomerQuote: set item ID or any other attribute of the node Item in order
//             to be able to enter a product later on
elCustomerQuote_Item.ID = "10";// CustomerQuote: create item instance
instCustomerQuote_Item = instCustomerQuote.Item.Create(elCustomerQuote_Item);// set product identifier - mandatory
instCustomerQuote_Item.ItemProduct.ProductKey.ProductID.content = "MCF-0001";        // change quantity - optional
if ( instCustomerQuote_Item.FirstRequestedItemScheduleLine.IsSet()) { // set product quantity and UOM (will be defaulted by the system if not set) instCustomerQuote_Item.FirstRequestedItemScheduleLine.Quantity.content  = 2;instCustomerQuote_Item.FirstRequestedItemScheduleLine.Quantity.unitCode = "EA";
}

读取CustomerQuote的ABSL代码:

import ABSL;
import AP.CRM.Global;// ABSL example for CustomerQuote// Define variables to query CustomerQuote
var qryCustomerQuote_QueryByElements;
var selParamsCustomerQuote_QueryByElements;
var colQryResult;
var instCustomerQuote;// CustomerQuote: define query and parameters to be used for retrieval of data
qryCustomerQuote_QueryByElements = CustomerQuote.QueryByElements;
selParamsCustomerQuote_QueryByElements = qryCustomerQuote_QueryByElements.CreateSelectionParams();// CustomerQuote: set Business Object type - optional (default value: 30 = Sales Quote set by system; other values: 2059 = Sales Order)
selParamsCustomerQuote_QueryByElements.Add(qryCustomerQuote_QueryByElements.TypeCode, "I","EQ","30");// CustomerQuote: fill the query parameter values - in this example search via the external reference
selParamsCustomerQuote_QueryByElements.Add(qryCustomerQuote_QueryByElements.BuyerID.content, "I","EQ","PSM CRM ABSL Test - Example_01");// CustomerQuote: execute the query
colQryResult = qryCustomerQuote_QueryByElements.Execute(selParamsCustomerQuote_QueryByElements);// CustomerQuote: loop all found instances
foreach (instCustomerQuote in colQryResult) { break; // take only first instance in case multiple are found
}

修改customer quote的代码:

import ABSL;
import AP.CRM.Global;// ABSL example for CustomerQuote// Define variables to query CustomerQuote
var qryCustomerQuote_QueryByElements;
var selParamsCustomerQuote_QueryByElements;
var colQryResult;
var instCustomerQuote;
var instCustomerQuote_Item;// CustomerQuote: define query and parameters to be used for retrieval of data
qryCustomerQuote_QueryByElements = CustomerQuote.QueryByElements;
selParamsCustomerQuote_QueryByElements = qryCustomerQuote_QueryByElements.CreateSelectionParams();// CustomerQuote: set Business Object type - optional (default value: 30 = Sales Quote set by system; other values: 2059 = Sales Order)
selParamsCustomerQuote_QueryByElements.Add(qryCustomerQuote_QueryByElements.TypeCode, "I","EQ","30");// CustomerQuote: fill the query parameter values - in this example search via the external reference
selParamsCustomerQuote_QueryByElements.Add(qryCustomerQuote_QueryByElements.BuyerID.content, "I","EQ","PSM CRM ABSL Test - Example_01");// CustomerQuote: execute the query
colQryResult = qryCustomerQuote_QueryByElements.Execute(selParamsCustomerQuote_QueryByElements);// CustomerQuote: loop all found instances
foreach (instCustomerQuote in colQryResult) { break; // take only first instance in case multiple are found
}// CustomerQuote: update quantity for item product
foreach (instCustomerQuote_Item in instCustomerQuote.Item) {// get item with a certain ID to be changedif (instCustomerQuote_Item.ID.Contains("10")) {break;};
}
if ( instCustomerQuote_Item.IsSet()) { // set product quantity and UOM (will be defaulted by the system if not set) instCustomerQuote_Item.FirstRequestedItemScheduleLine.Quantity.content  = 5;instCustomerQuote_Item.FirstRequestedItemScheduleLine.Quantity.unitCode = "EA";
}

Item Schedule Lines

The requested delivery date is defaulted automatically when a customer quote is created.

当Customer Quote被创建时,requested delivery date被默认逻辑填充。

It can be changed using the association RequestedFulfillmentPeriod.

这个默认值可以被RequestedFulfillmentPeriod这个association修改。

This date is taken over as requested delivery date for the items.

item级别的requested delivery date从订单抬头的对应字段带过来。

On item level the requested delivery date can be set using the association FirstRequestedItemScheduleLine.

带过来的值也可以通过FirstRequestedItemScheduleLine修改。

Price and Tax Calculation Item

When interacting with the Price And Tax Calculation Item node the following specifics have to be considered using the public model.

Prices are derived automatically from the price lists maintained for the products and customers.

通过product和customer主数据上维护的price list,行项目的价格被自动决定出来。

In order to set or get the automatically determined prices the following associations can be used:

  • Item Main Price
  • Item Main Discount
  • Item Main Surcharge
  • Item Main Total
  • Operational Item Price Component

Address

The address of a Party can be accessed via the following associations:

  • AddressSnapshot (read-only)
  • UsedAddress (read/write)

In case address data of a Party node instance is changed via association UsedAddress a document specific address will be created.

我们每次通过association UsedAddress 修改 Party的地址时,一个新的Document specific address会被创建。

This means, the address change is exclusively applied to the party instance in the respective transactional document.

只是文档的party transaction 数据的地址被修改了,而party主数据地址保持不变。

The master data address of the party remains unchanged.

// ABSL example to create a document-specific address for a party, for example the product recipient: ....
if ( this.ProductRecipientParty.UsedAddress.DefaultPostalAddressRepresentation.IsSet( ) ) {/ * For performance reasons DO NOT update every single attribute by using the association path:this.UsedAddress.DefaultPostalAddressRepresentation.CityName = " Document City";this.UsedAddress.DefaultPostalAddressRepresentation.HouseID = "217";....
*///...to improve performance retrieve the address via association once and update afterwards the respective attributes:var elPartyAddress =  this.ProductRecipientParty.UsedAddress.DefaultPostalAddressRepresentation;elPartyAddress.CityName = "Document City";elPartyAddress.HouseID = "217";elPartyAddress.StreetName = "Doc Street";elPartyAddress.StreetPostalCode = "27272";}
....

更多Jerry的原创文章,尽在:“汪子熙”:

使用ABSL(ABAP Script Language)完成SAP Cloud for Customer里Customer Quote以及行项目的增删改查相关推荐

  1. SAP Cloud Application Programming 里的@(path) 注解

    标题:SAP Cloud Application Programming 里的@(path:'/browse') service 实现的 .cds 文件源代码: using { sap.capire. ...

  2. SAP abap内表分类与增删改查操作

    SAP abap内表分类与增删改查操作 1.内表的分类 1.1.标准表 (standard table ) 系统为该表每一行生成一个院级索引.填表是可以将数据附加在现有行之后,也可以插入到指定的位置, ...

  3. 如何基于Restful ABAP Programming模型开发并部署一个支持增删改查的Fiori应用

    Jerry之前的文章30分钟用Restful ABAP Programming模型开发一个支持增删改查的Fiori应用 发布之后,有朋友问我,"没错, 我是在你的文章里看到了Fiori应用的 ...

  4. 30分钟用Restful ABAP Programming模型开发一个支持增删改查的Fiori应用

    2016年时,Jerry曾经写过一系列关于SAP Fiori Smart Template(现在更名为Fiori Elements了)的博客,介绍了所谓的MDD开发方法论 - Metadata Dri ...

  5. SAP CDS view生成的OData服务对CRUD(增删改查)的支持

  6. SAP系统会计凭证出口OBBH/GBB1抬头与行项目的替代使用

    针对某些特定类型的财务记账,希望对凭证做统一的处理,如 成本中心a001+科目1001的记账成本中心全部替换为b001:凭证抬头文本字段=年度+凭证编号: 以上需求都是可以通过OBBH实现的 标准替换 ...

  7. SAP Cloud Application Programming 介绍(2021 更新版)

    这是Jerry 2021年的第 25 篇文章,也是汪子熙公众号总共第 296 篇原创文章. 最近有朋友给我留言,询问关于 SAP Cloud Application Programming(简称CAP ...

  8. 使用abapGit在ABAP On-Premises系统和SAP云平台ABAP环境之间进行代码传输

    SAP ABAP顾问朋友们,应该都使用过SAPLink这个工具.如果两个ABAP Netweaver系统没有建立起传输路径时,我们无法使用标准的SE10事务码创建传输请求的方式进行这两个系统间的代码传 ...

  9. SAP Cloud SDK for JavaScript 概述

    原文链接 TypeScript 和 JavaScript 开发人员,这是为您准备的:SAP Cloud SDK (fka SAP S/4HANA Cloud SDK) 现在可用于 JavaScript ...

最新文章

  1. 微信 request 合法域名校验出错
  2. 波士顿房价预测学习项目笔记
  3. 如何优雅的导出 Excel
  4. 红帽集群套件RHCS四部曲(维护篇)
  5. 三菱plc两个16转换32位_三菱FX2NPLC如何将十进制数转换成十六进制-专业自动化论坛-中国工控网论坛...
  6. 3750交换机简要配置手册(中文)
  7. 奇特的恐怖之门:谈周德东的恐怖小说《门》
  8. FastDFS分布式文件系统设计原理
  9. 【CF603E】Pastoral Oddities cdq分治+并查集
  10. Thread.join()
  11. mysql 获取天数_MySQL获取某月份的天数
  12. 一个轻量级分布式RPC框架--NettyRpc
  13. Linux开发_printf打印无消息或末尾带“#“or“%“
  14. caffe 实践程序2——用细分的方法实现caffe中cifar100的识别
  15. 结构体做函数参数的进阶:嵌套一二级指针
  16. 为什么谷歌浏览器打不开 Google Chrome打不开解决方法
  17. 共线性分析软件MCScanX安装、报错解决方法及使用
  18. 盘点:在造自行车的团队里,你最看好哪个?
  19. android自定义View之(四)------一键清除动画
  20. 建立“图书_读者”数据库及如下 3 个表,并输入实验数据,用 SQL 语句实现如下五个查询(opengauss)

热门文章

  1. RFID位置数据这么多,企业应该怎么利用?
  2. SQLserver语句命令
  3. LNMP_静态文件不记录日志,配置缓存
  4. php设计模式的六大原则(六):迪米特法则
  5. HDFS应用场景、部署、原理与基本架构
  6. 解决CI框架的Disallowed Key Characters错误提示
  7. TCP/IP 2.5浮动静态路由
  8. java.util.Date与 java.sql.Date两个包下Date的区别与联系
  9. “No operations defined in spec!”一文教你swagger如何扫描多个controller
  10. O-R mapping工具