21
服务提供者在SAP EWM 中的调用实例 Service Delivery Provider in SAP EWM Call Examples 2009年11月7日

服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

服务提供者在SAP EWM

中的调用实例

Service Delivery Provider in SAP

EWM Call Examples

2009年11月7日

Page 2: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

1. SAP –重要声明及法律信息 ................................................................................................................... 3

2. 术语对照表 .............................................................................................................................................. 5

3. 服务提供者 .............................................................................................................................................. 6

3.1 UI 服务提供者 ................................................................................................................................... 6

3.2 交货服务提供者 ................................................................................................................................ 7

4 UI 服务提供者与交货服务提供者的相互关系 ...................................................................................... 8

5 方面 ........................................................................................................................................................... 9

5.1 实例 .................................................................................................................................................... 9

6 交货服务提供者界面 ............................................................................................................................. 12

7. 服务提供者调用实例 ............................................................................................................................ 14

7.1 服务提供者的一些方法调用 .......................................................................................................... 15

7.2 修改用户字段的示例程序 .............................................................................................................. 17

8. 获取交货数据的其他途径 .................................................................................................................... 20

Page 3: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the information, content, or advertisements (collectively, the "Materials") contained on, distributed through, or linked, downloaded, or accessed from any of the services contained on this Web site (the "Service"), nor the quality of any products, information, or other materials displayed, purchased, or obtained by you as a result of an advertisement or any other information or offer in or in connection with the Service (the "Products"). You hereby acknowledge that any reliance upon any Materials shall be at your sole risk. SAP reserves the right, in its sole discretion and without any obligation, to make improvements to, or correct any error or omissions in any portion of the Service or the Materials. THE SERVICE AND THE MATERIALS ARE PROVIDED BY SAP ON AN "AS IS" BASIS, AND SAP EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE SERVICE OR ANY MATERIALS AND PRODUCTS. IN NO EVENT SHALL SAP BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES OF ANY KIND WHATSOEVER WITH RESPECT TO THE SERVICE, THE MATERIALS, AND THE PRODUCTS. SAP encourages you to exercise discretion while browsing the Internet using this site. SAP makes no representations concerning any endeavor to review the content of sites linked to this site or any of the Materials, and so SAP isn't responsible for the accuracy, copyright compliance, legality, or decency of material contained in sites listed in the directory or in the Materials. SAP respects the rights (including the intellectual property rights) of others, and we ask our users to do the same. SAP may, in appropriate circumstances and in its sole discretion, terminate the accounts of users that infringe or otherwise violate such rights of others. If you believe that your work has been copied in a way that constitutes copyright infringement, please follow the instructions at the top of this page.

SAP – Guidelines for Using SAP Trademarks Throughout the world, thousands of customers recognize and select SAP solutions on the basis of the company's trademarks and service marks, which signify high-quality computer software products and services. Without these trademarks and service marks (collectively referred to as "trademarks"), consumers would not be able to distinguish SAP solutions from those of other companies, nor would they be able to readily identify the superior quality that SAP trademarks represent. Therefore, it is critically important that trademarks of SAP and its subsidiaries are protected. For guidelines on trademark usage, please see the following information: SAP trademarks and SAP offering names

Proper use of trademarks

Additional trademark usage information for third parties

Trademark usage information for all print and online media. If after reviewing the Guidelines for Using SAP Trademarks you still have a question about use, please direct your inquiry to [email protected]. SAP will make reasonable efforts to respond to your request. However, based on volume of requests you should allow several weeks for a response. In the absence of a response, the Guidelines for Using SAP Trademarks shall govern any and all uses.

Designing Marketing Material If you are a developer, partner, customer, or other third party, always use your own proprietary design style when creating and producing a marketing piece. You must not copy the SAP design style or borrow any SAP design elements.

Guidelines for Using SAP-Copyrighted Material The use of original texts, graphics, images, screen shots, and other materials from SAP sources must be approved by SAP. In addition, when using such materials, you must include a copyright notice – either in an adjacent area or as a footnote – to indicate SAP's copyright. The copyright should read as follows: "© SAP AG <year>. All rights reserved." Please note that SAP photography is only licensed for SAP use and must not be used by third parties in their communications.

SAP – Copyrights and Trademarks ENGLISH – German version below © Copyright 2009 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.

Page 4: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. GERMAN © Copyright 2009 SAP AG. Alle Rechte vorbehalten. Weitergabe und Vervielfältigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in welcher Form auch immer, ohne die ausdrückliche schriftliche Genehmigung durch SAP AG nicht gestattet. In dieser Publikation enthaltene Informationen können ohne vorherige Ankündigung geändert werden. Die von SAP AG oder deren Vertriebsfirmen angebotenen Softwareprodukte können Softwarekomponenten auch anderer Softwarehersteller enthalten. Microsoft, Windows, Excel, Outlook und PowerPoint sind eingetragene Marken der Microsoft Corporation. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli und Informix sind Marken oder eingetragene Marken der IBM Corporation. Linux ist eine eingetragene Marke von Linus Torvalds in den USA und anderen Ländern. Adobe, das Adobe Logo, Acrobat, PostScript und Reader sind Marken oder eingetragene Marken von Adobe Systems Inc. in den USA und/oder anderen Ländern. Oracle ist eine eingetragene Marke der Oracle Corporation. UNIX, X/Open, OSF/1 und Motif sind eingetragene Marken der Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame und MultiWin sind Marken oder eingetragene Marken von Citrix Systems, Inc. HTML, XML, XHTML und W3C sind Marken oder eingetragene Marken des W3C®, World Wide Web Consortium, Massachusetts Institute of Technology. Java ist eine eingetragene Marke von Sun Microsystems, Inc. JavaScript ist eine eingetragene Marke der Sun Microsystems, Inc., verwendet unter der Lizenz der von Netscape entwickelten und implementierten Technologie. SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign und weitere im Text erwähnte SAP-Produkte und -Dienstleistungen sowie die entsprechenden Logos sind Marken oder eingetragene Marken der SAP AG in Deutschland und anderen Ländern. Business Objects und das Business-Objects-Logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius und andere im Text erwähnte Business-Objects-Produkte und -Dienstleistungen sowie die entsprechenden Logos sind Marken oder eingetragene Marken der Business Objects S. A. in den USA und anderen Ländern. Business Objects ist ein Unternehmen der SAP. Alle anderen Namen von Produkten und Dienstleistungen sind Marken der jeweiligen Firmen. Die Angaben im Text sind unverbindlich und dienen lediglich zu Informationszwecken. Produkte können länderspezifische Unterschiede aufweisen. In dieser Publikation enthaltene Informationen können ohne vorherige Ankündigung geändert werden. Die vorliegenden Angaben werden von SAP AG und ihren Konzernunternehmen ("SAP-Konzern") bereitgestellt und dienen ausschließlich Informationszwecken. Der SAP-Konzern übernimmt keinerlei Haftung oder Garantie für Fehler oder Unvollständigkeiten in dieser Publikation. Der SAP-Konzern steht

lediglich für Produkte und Dienstleistungen nach der Maßgabe ein, die in der Vereinbarung über die jeweiligen Produkte und Dienstleistungen

ausdrücklich geregelt ist. Aus den in dieser Publikation enthaltenen Informationen ergibt sich keine weiterführende Haftung.

Page 5: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

2. 术语对照表

术语 描述

ABAP OO: Advanced Business Application

Programming, Object-Oriented

面向对象的高级业务应用程序

BO: Business Object(here usually a

delivery)

业务对象(此处通常指一个交付产品)

DR: Delivery Request 交付请求

ESA: Enterprise Service Architecture 企业服务架构

ESF: Enterprise Services Framework 企业服务框构

FD: Final Delivery = Outbound Delivery 最终交货 = 出库交货

IDN: Inbound Delivery Notification 收货通知

OD: Outbound Delivery 出库交货

ODO: Outbound Delivery Order 出库交货订单

ODP: Object Data Pattern 对象数据模式

OIP: Object Identification Pattern 对象识别模式

PRD: Processing Delivery 交货处理

SP: Service Provider 服务提供者

UI: User Interface 用户界面

UIC: User Interface Controller 用户界面控制器

WDP: Web Dynpro Pattern Web 屏幕模式

Page 6: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

3. 服务提供者

服务提供者是业务对象中“交货”的外部界面,其任务是绘制业务对象交货中面向对象的数据模

型,提供给为调用者呈现的方面结构。其目标是为调用者提供统一的 UI,从而以通用的方式来使

用业务对象。下图展示了交货总体架构下的核心服务提供者。

下图为此结构的概况:

图表一 服务架构

EWM 中包含了多种服务提供者,因此有必要区分不同提供者。

3.1 UI 服务提供者

/SCWM/ 服务提供者一般情况下仅供 UI 使用。这意味着这些方法也仅供 UI 使用。在图 1 的服

务结构中,这也被称作 UI 控制器或者 UI 服务采用。它仅被 UI 使用。在此仅提及主要的

服务类型

(例如, /SCWM/CL DLV

MANAGEMENT PRD)

服务调整

(/SCWM/Service provider)

应用程序 用户界面

(/SCDL/) 服务提供商

交货

查询 检索 修改 删除 清理 锁/

解锁

收信

执行

操作 保存

Page 7: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

/SCWM/交货 UI 服务提供者。此文不侧重 UI 层面,因此不对其进行详细描述。以下流程图显示

了服务提供者的类型以及其相互关系:

UI 服务提供者使用的界面(如/SCMB/IF_SP_ASPECT)与交货服务提供者使用的界面(如

/SCDL/IF_SP1_ASPECT)类似, 但又不是完全一样。它们的概念一样,因此以下章节中有关交

货服务提供者的信息能够部分地被 UI 服务提供者重新使用。再次提醒,下一章侧重的是交货服务

提供者而非 UI 服务提供者。

3.2 交货服务提供者

该服务提供者在图 1 中的服务架构中以及 Fehler! Verweisquelle konnte nicht gefunden

warden 中提到。下面的流程图展示了其类型以及相互关系。

Page 8: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

4 UI 服务提供者与交货服务提供者的相互关系

如上所述,对某特定对象(如出库交货订单),服务提供者(SP)提供阅读、插入、更新以及执

行操作等多种操作方法。所有交货对象(如入库交货通知,出库交货等)中都有服务提供者。服

务提供者实例包含了 DOCCAT(如 PDO 以及 FDO 等),意思是如果更改出库交货记录,就必

须使用包含 DOCCAT = FDO 的服务提供者实例,对于入库交货订单,就该使用包含 DOCCAT

= FDO 的服务提供者实例。

交货服务中有 UI 以及交货对象特定的服务提供者。存在”UI”以及“交货对象”服务提供者的

原因如下:

不同交货 UI 应拥有不同的结构组织方式(如与交货数据结构相比,拥有更少或更多的字

段)。

UI 中,应当执行专门的检查或更多 UI 特定的代码。

UI 服务提供者以及交货服务提供者之间的关系如下:

UI 服务提供者的方法都是从 UI 中调用的。UI 的方法要求交货服务商方法来插入、更新等。

交货服务提供者方法能够从多种 UI 中或从独立于 UI 以外的代码(如 RFC 功能、批次工

作等)中调用。

下文将详细描述其相互关系。

Page 9: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

5 方面

“方面”是服务提供者的主要术语之一,可讲它描述为现有业务对象的一个特定部分。例如,产

品方面包含了品名、产品 ID、产品批次等,日期方面包含交货条目的日期字段。

企业服务结构中存在两类型的方面: 键方面以及方面。键方面控制方面的行中的语义键(不一定

是句法键)。因此,每个方面都必须具有一个相关联的键方面,作为它本身的键方面。

常见服务提供者的命名惯例如下:

表格类型

/SCDL/T_SP_K_* or /SCWM/T_SP_K_* 键方面

/SCDL/T_SP_A_* or /SCWM/T_SP_A_* 方面

结构类型

/SCDL/S_SP_K_* or /SCWM/S_SP_K_*键方面

/SCDL/S_SP_A_* or /SCWM/S_SP_A_* 方面

/SCDL/S_SP_D_* or /SCWM/S_SP_D_* 文字方面面数据

/SCDL/S_SP_Q_* or /SCWM/S_SP_Q_* 查询参数

常量

替代企业服务框架的所有常量都定义在界面/SCDL/IF_SP_C and /SCWM/IF_SP_C中。

请注意,/SCWM/IF_SP_C不但包括SCDL的EWM UI常量,也包括SCDL的扩展EWM的常量。

5.1 实例

出库交货订单表头中的包含了数据模型与日期一对多的关系,意思是一个交货表头可拥有多个日

期,如在场地外的日期、交付日期等。

因此相应的方面为:

/SCDL/IF_SP_C=> SC_ASP_HEAD_DATE (固定值 „/SCDL/S_SP_A_HEAD_DATE')

Page 10: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

方面的结构应当是 /SCDL/S_SP_A_HEAD_DATE (正如上文变量中列举的)

以及表格类型 (作为一对多的关系) /SCDL/T_SP_A_HEAD_DATE

方面(结构)自身包括表头日期方面键数据以及“数据”字段。由于表头日期是表头中的一个方

面,它包括表头方面键以及日期键。通过表头方面键能确认交货信息或表头, 而通过日期键确认

日期(如区分该日期为在场地外的日期还是交付日期)。

以下截图展示了出库交货订单的 UI(交易/SCWM/PRDO)。

以下实例展示了 UI 的方面与 ACDL 的方面之间的关系。

方面/SCWM/S_SP_A_HEAD_DATE 方面/SCWM/S_SP_A_ITEM_PRDO

(注意这些是 UI 服务提供者的方面)

表头日期面包含:

Page 11: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

上文中的键方面/SCDL/S_SP_K_HEAD_DATE 包括下列字段:

此表头日期的方面键包含(/SCDL/S_SP_K_HEAD)的表头键方面以及

(SCDL/DL_DATE_KEY_STR)的日期方面键。上述二者一起,可识别交货表头日期的输入处

(UI 中的一个列)。

/SCWM/S_SP_A_HEAD_DATE 方面包含日期、时间等的“数据”信息,同时也可显示唯一字段,

如日期/时间类型的简短信息,此信息可显示在/SCWM/PRDO UI 中。

Page 12: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

在交货服务提供者中,方面是多种多样的。以下为同一个日期表头:

该图显示两个方面之间转换的必要性,这种转换是在服务提供者的 UI 中完成的。UI 服务提供者

能通过简短信息来对各个方面进行加强或者检查。

6 交货服务提供者界面

服务提供者实现了多重界面。下图提供了一个简单的概览。更多细节请查阅设计文档。

/SCDL/IF_SP1_ACTION 支持的操作

EXECUTE 执行操作

/SCDL/IF_SP1_ ASPECT 支持关于方面的操作

SELECT 读取

INSERT 插入

UPDATE 更新

DELETE 删除

SELECT_BY_RELATION 通过关系读取

/SCDL/IF_SP1_LOCKING 锁定服务

LOCK 锁定方面中的行

UNLOCK 解锁方面中的行

Page 13: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

/SCDL/IF_SP1_QUERY 查询界面

EXECUTE 执行查询

/SCDL/IF_SP1_TRANSACTION 入口界面

BEFORE_SAVE 存储前事件,检查一致性

CLEANUP 清除, 释放所有锁定对象

SAVE 存储累积的改变

/SCDL/IF_SP1_TRANSACTION 的操作不仅影响使用的服务提供者的 DOCCAT 的交货对象,而

且影响其他所有的交货对象。如果从 DOCCAT = PDI 的服务提供者中调用“清除”方法,

FDO,PDO,ODR 等的 DOCCATs 都将被清除。

/SCDL/IF_SP_QUERY_ID 用 ID 查询

QUERY_DOCID 搜索表头(GUID)

QUERY_DOCNO 搜索表头(Number)

QUERY_MAPKEY 键定位

QUERY_DOCFLOW 查询文件流

这些方法被以十分一般的方式实施。它们不包括特定的数据类型,除了 STRING, ANY 或者

TABLE 类型。这一点很重要,因为数据类型取决于方面和已使用过的服务提供者实例。特定的数

据类型能够通过方面名称以及上文提到的命名转换惯例轻易地找到。

/SCDL/IF_SP1_QUERY~EXECUTE

QUERY 导入 STRING 查询名称。例如:

/scdl/if_sp_c=>sc_qry_head or

/scdl/if_sp_c=>sc_qry_item

OPTIONS 导入 /SCDL/S_SP_QUERY_OPTIONS 查询选项。例如,仅读取表头,锁定结

重要提示!!!

Page 14: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

果,排序

SELECTIONS 导入 /SCDL/T_SP_SELECTION 选择

OUTRECORDS 导出 INDEX TABLE 数据类型取决于 QUERY.例如,针对一

个表头查询

(scdl/if_sp_c=>sc_qry_head )将返

回表头面(/scdl/t_sp_a_head)

REJECTED 导出 BOOLE_D 异常情况指示器

/SCDL/IF_SP1_ASPECT~UPDATE

ASPECT 导入 STRING 待更新的方面。例如,

/SCDL/IF_SP_C=>SC_ASP_HEAD or

/SCDL/IF_SP_C=>SC_ASP_HEAD_PARTYL

OC

INRECORDS 导入 INDEX TABLE 待修改条目。数据类型必须对应上述方面

OUTRECORDS 导出 INDEX TABLE 先修改再条目。数据类型必须对应上述方面。

数据类型经常与 INRECORDES 一一对应,但

是在不能更新或者执行判定等情况下,情况将

不同。

REJECTED 导出 BOOLE_D

异常情况指示器(整体调用失败)

RETURN_CODE

S

导出 /SCDL/T_SP_RETURN_

CODE

对应每条输入行的成功或者失败信息

7. 服务提供者调用实例

本章结合实际应用实例,介绍在代码中如何应用交货服务提供者。下例展示如何实例化一个服务

提供者及实例化后如何读取,更改数据。

注意:

关于本文中对函数及方法描述并不代表是 SAP 正式发布的函数及方法,即 SAP 不保证其不会被

改动。SAP 可在不做正式通知情况下对其进行更改/删除。不要使用任何提及的类方法及其参数,

如/scwm/cl_tm 包含很多方法。请仅在本文中使用这些方法。

Page 15: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

本文中提及的函数方法类是非正式的官方发布的程序接口,也没有正式发布给客户及合作伙伴。

即 SAP 有权在任何时间在不做任何声明前提下对其进行更改及删除,使用这些方法与函数可能存

在一定的风险。

7.1 服务提供者的一些方法调用

Page 16: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

阅读对象详细数据(此处为根据国际贸易

术语解释通则的订单表头)

此例展示如何为订单加锁

此处为表头部分新增一个相关方或者

地点(一对多的关系)。此处运用了

关联方式,因为表头可包含多个相关

方或地点。

此处表示更新表头中方面一对多的关

此处表示在表头中执行了一个操作。

在该例中, “执行操作”为通用操

作,用来执行BOPF中的“确定”操

作。

在服务提供调动时获取任意已发信息

详情。此例仅在出现重大错误时操

作。 [通常情况下,需计算

RETURN_CODES(返回代码)]

Page 17: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

7.2 修改用户字段的示例程序

以上代码示例不包含如何正确解决错误。通常服务提供者调动完成后,都应检查返回值与参数,

只有在这种情况下,数据才能保存。以下示例程序展示客户数据被更改的可能性。

注意:若交付可更改,该程序不提供任何检查,如状态检查等。GI 发出的任意交货信息均不得更

改。

该例会更改一个客户化的字段。更改任意其他 SAP 字段的操作是很危险的,因为不确定某字段是

否允许更改,若允许更改,又该在何时和用何种方法更改,该更改带来怎样的后果等。比如,已

开启执行操作,更改可能造成运行问题,该例在操作或其他方法中也会发生。再比如,服务提供

方允许更改产品、数量、或删除项目,但是这些操作存在风险,因为不知道更改后的确切影响和

后果。

Page 18: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the
Page 19: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the
Page 20: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

8. 获取交货数据的其他途径

在某些情况下,应用只要求阅读交货中的某些不同数据项目。若每个方面都需要分开来阅读,便

会导致冗长的使用服务提供方的代码。

Page 21: 服务提供者在SAP EWM · 2019. 11. 12. · 1. SAP –重要声明及法律信息 General Disclaimer SAP does not represent or endorse the accuracy or reliability of any of the

因此,/SCWM/CL_DLV_MANAGEMENT_PRD 类提供 QUERY(查询)手段,方便交货数据快

速阅读。QUERY 文档可在系统(如使用 SE24 交易)方法文档中找到。以下截图提供显示文档的

方法。

请注意,不要使用该类的其他任意方法,甚至是 QUERY 方法的平行处理选项。