服务订单SO创建
FUNCTION Z_SD_SALESORDER_CREATE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IM_HEADER) LIKE VBAK STRUCTURE VBAK
*" EXPORTING
*" VALUE(EX_SALESORDER) TYPE VBELN
*" TABLES
*" IT_ITEM STRUCTURE VBAP
*" IT_RETURN STRUCTURE BAPIRET2 OPTIONAL
*"---------------------------------------------------------------------- PERFORM FRM_INIT_SALESORDER_HEADER USING IM_HEADER. PERFORM FRM_INIT_SALESORDER_ITEM TABLES IT_ITEM USING IM_HEADER. PERFORM FRM_INIT_SOPARTNER USING IM_HEADER-KUNNR. PERFORM FRM_INIT_SALESORDER_CONDITION TABLES IT_ITEM. PERFORM FRM_CREATE_SALESORDER CHANGING EX_SALESORDER. * APPEND LINES OF GT_RETURN TO IT_RETURN. IT_RETURN[] = GT_RETURN[].
ENDFUNCTION.
FORM FRM_INIT_SALESORDER_HEADER USING P_HEADER STRUCTURE VBAK. CLEAR GS_SALESORDER_HEADER.
* Mandatory entries:
GS_SALESORDER_HEADER-DOC_TYPE = 'ZRWF'."入网费 GS_SALESORDER_HEADER-SALES_ORG = ''. "Sales organization
GS_SALESORDER_HEADER-DISTR_CHAN = ''. "Distribution channel
GS_SALESORDER_HEADER-DIVISION = ''. " Division * Optional entries:
GS_SALESORDER_HEADER-DOC_DATE = SY-DATUM. "Document date (订单日期)
GS_SALESORDER_HEADER-REF_1 = P_HEADER-IHREZ. "Customer PO No. (POS订单号码)
* GS_SALESORDER_HEADER-ORD_REASON = U_HEADER-ZDDLX. "Order reason. (订单类型)
* GS_SALESORDER_HEADER-TELEPHONE = U_HEADER-ZLXDH. "Telephone Number. (联系电话)
* GS_SALESORDER_HEADER-NAME = U_HEADER-ZLSR. "Name of order. (联系人)
** GS_SALESORDER_HEADER-DOC_DATE = SY-DATUM. "Name of order. (联系人) * Change index
GS_SALESORDER_HEADERX-UPDATEFLAG = 'I'. "Sales document type
GS_SALESORDER_HEADERX-DOC_TYPE = 'X'. "Sales document type
GS_SALESORDER_HEADERX-SALES_ORG = 'X'. "Sales organization
GS_SALESORDER_HEADERX-DISTR_CHAN = 'X'. "Distribution channel
GS_SALESORDER_HEADERX-DIVISION = 'X'. " Division GS_SALESORDER_HEADERX-DOC_DATE = 'X'. "Document date (订单日期)
GS_SALESORDER_HEADERX-REF_1 = 'X'. "Customer PO No. (POS订单号码)
* GS_SALESORDER_HEADERX-ORD_REASON = 'X'. "Order reason. (订单类型)
* GS_SALESORDER_HEADERX-TELEPHONE = 'X'. "Telephone Number. (联系电话)
* GS_SALESORDER_HEADERX-NAME = 'X'. "Name of order. (联系人)
* GS_SALESORDER_HEADERX-DOC_DATE = 'X'. "Name of order. (联系人) CLEAR GS_LOGIC_SWITCH.
* GS_LOGIC_SWITCH-COND_HANDL = 'X'.
GS_LOGIC_SWITCH-PRICING = 'G'.
ENDFORM. " FRM_INIT_SALESORDER_HEADER
FORM FRM_INIT_SALESORDER_ITEM TABLES IT_ITEM STRUCTURE VBAP
USING P_HEADER STRUCTURE VBAK.
DATA : LS_ITEM TYPE VBAP,
LV_MATNR TYPE MATNR,
LV_POSNR TYPE POSNR. CLEAR : GS_SALESORDER_ITEM,
GT_SALESORDER_ITEM,
GT_SALESORDER_CONDITIONS,
GT_SALESORDER_CONDITIONX. CLEAR : GS_SALESORDER_SCHLINE,
GT_SALESORDER_SCHLINE,
GS_SALESORDER_SCHLINEX,
GT_SALESORDER_SCHLINEX. CLEAR LV_POSNR. LOOP AT IT_ITEM INTO LS_ITEM.
ADD TO LV_POSNR.
*** Items
* Convert Article no. (商品款号)
PERFORM FRM_CONVERT_ARTICLE USING LS_ITEM-MATNR CHANGING LV_MATNR. GS_SALESORDER_ITEM-ITM_NUMBER = LV_POSNR."'10'. "Item (行项目号)
GS_SALESORDER_ITEM-MATERIAL = LV_MATNR."70 ”Article (商品款号)
GS_SALESORDER_ITEM-BATCH = LS_ITEM-CHARG."70 ”Article (商品款号)
GS_SALESORDER_ITEM-PLANT = LS_ITEM-WERKS."P_HEADER-WERKS. "Site ()
GS_SALESORDER_ITEM-STORE_LOC = LS_ITEM-LGORT."Storage location
GS_SALESORDER_ITEM-TARGET_QTY = ''."Target quantity in sales units (商品件数)
* gs_salesorder_item-target_qu = 'ST'.
APPEND GS_SALESORDER_ITEM TO GT_SALESORDER_ITEM. GS_SALESORDER_ITEMX-UPDATEFLAG = 'I'.
GS_SALESORDER_ITEMX-ITM_NUMBER = LV_POSNR.
GS_SALESORDER_ITEMX-MATERIAL = 'X'.
GS_SALESORDER_ITEMX-BATCH = 'X'.
GS_SALESORDER_ITEMX-PLANT = 'X'.
GS_SALESORDER_ITEMX-STORE_LOC = 'X'.
* gs_salesorder_itemx-sales_unit = 'X'.
GS_SALESORDER_ITEMX-TARGET_QTY = 'X'.
* gs_salesorder_itemx-target_qu = 'X'.
APPEND GS_SALESORDER_ITEMX TO GT_SALESORDER_ITEMX. *** Scheuld line
CLEAR GS_SALESORDER_SCHLINE.
GS_SALESORDER_SCHLINE-ITM_NUMBER = LV_POSNR.
GS_SALESORDER_SCHLINE-SCHED_LINE = ''.
GS_SALESORDER_SCHLINE-REQ_QTY = ''.
* gs_salesorder_schline-req_date = '20140830'.
APPEND GS_SALESORDER_SCHLINE TO GT_SALESORDER_SCHLINE. CLEAR GS_SALESORDER_SCHLINEX.
GS_SALESORDER_SCHLINEX-ITM_NUMBER = LV_POSNR.
GS_SALESORDER_SCHLINEX-SCHED_LINE = ''.
GS_SALESORDER_SCHLINEX-UPDATEFLAG = 'I'.
* gs_salesorder_schlinex-req_date = 'X'.
GS_SALESORDER_SCHLINEX-REQ_QTY = 'X'.
APPEND GS_SALESORDER_SCHLINEX TO GT_SALESORDER_SCHLINEX. * Conditions
CLEAR GS_SALESORDER_CONDITIONS.
GS_SALESORDER_CONDITIONS-ITM_NUMBER = LV_POSNR.
* GS_SALESORDER_CONDITIONS-COND_COUNT = '10'.
GS_SALESORDER_CONDITIONS-COND_TYPE = 'ZF01'.
GS_SALESORDER_CONDITIONS-COND_VALUE = LS_ITEM-NETPR.
* GS_SALESORDER_CONDITIONS-CONDVALUE = '10'.
GS_SALESORDER_CONDITIONS-CURRENCY = 'CNY'.
APPEND GS_SALESORDER_CONDITIONS TO GT_SALESORDER_CONDITIONS. CLEAR GS_SALESORDER_CONDITIONX.
GS_SALESORDER_CONDITIONX-ITM_NUMBER = LV_POSNR.
* GS_SALESORDER_CONDITIONS-COND_COUNT = '10'.
GS_SALESORDER_CONDITIONX-COND_TYPE = 'ZF01'.
GS_SALESORDER_CONDITIONX-UPDATEFLAG = 'I'.
GS_SALESORDER_CONDITIONX-COND_VALUE = 'X'.
* GS_SALESORDER_CONDITIONX-CONDVALUE = 'X'.
GS_SALESORDER_CONDITIONX-CURRENCY = 'X'.
APPEND GS_SALESORDER_CONDITIONX TO GT_SALESORDER_CONDITIONX. ENDLOOP. ENDFORM. " FRM_INIT_SALESORDER_ITEM
FORM FRM_INIT_SOPARTNER USING P_CUSTOMER.
DATA : LV_KUNNR TYPE KUNNR. * Convert customer no. to internal no.(客户编码)
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = P_CUSTOMER
IMPORTING
OUTPUT = LV_KUNNR. * WE Ship to , AG Sold to
CLEAR GS_SALESORDER_PARTNER.
* gs_salesorder_partner-itm_number = '10'."
GS_SALESORDER_PARTNER-PARTN_ROLE = 'WE'."SP
GS_SALESORDER_PARTNER-PARTN_NUMB = LV_KUNNR. "(客户编码)
* gs_salesorder_partner-name = u_header-zkhmc. "Name (客户名称)
APPEND GS_SALESORDER_PARTNER TO GT_SALESORDER_PARTNER.
ENDFORM. " FRM_INIT_SOPARTNER
FORM FRM_INIT_SALESORDER_CONDITION TABLES IT_ITEM STRUCTURE VBAP. ENDFORM. " FRM_INIT_SALESORDER_CONDITION
FORM FRM_CREATE_SALESORDER CHANGING P_SALESORDER. DATA : LV_SALESORDER TYPE BAPIVBELN-VBELN,
LV_ERROR. REFRESH GT_RETURN. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
ORDER_HEADER_IN = GS_SALESORDER_HEADER
ORDER_HEADER_INX = GS_SALESORDER_HEADERX
LOGIC_SWITCH = GS_LOGIC_SWITCH
IMPORTING
SALESDOCUMENT = LV_SALESORDER
TABLES
RETURN = GT_RETURN
ORDER_ITEMS_IN = GT_SALESORDER_ITEM
ORDER_ITEMS_INX = GT_SALESORDER_ITEMX
ORDER_PARTNERS = GT_SALESORDER_PARTNER
ORDER_SCHEDULES_IN = GT_SALESORDER_SCHLINE
ORDER_SCHEDULES_INX = GT_SALESORDER_SCHLINEX
ORDER_CONDITIONS_IN = GT_SALESORDER_CONDITIONS
ORDER_CONDITIONS_INX = GT_SALESORDER_CONDITIONX. LOOP AT GT_RETURN INTO GS_RETURN WHERE TYPE = 'E' OR
TYPE = 'X' OR
TYPE = 'A'.
EXIT.
ENDLOOP. IF SY-SUBRC EQ .
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'. P_SALESORDER = LV_SALESORDER.
ENDIF. REFRESH : GT_SALESORDER_ITEM,
GT_SALESORDER_ITEMX,
GT_SALESORDER_PARTNER,
GT_SALESORDER_SCHLINE,
GT_SALESORDER_SCHLINEX,
GT_SALESORDER_CONDITIONS,
GT_SALESORDER_CONDITIONX.
ENDFORM. " FRM_CREATE_SALESORDER
服务订单SO创建的更多相关文章
- SAP S4CRM 1811 服务订单API介绍
Jerry在今年2月28日,SAP Customer Management for S/4HANA 1.0正式问世这个具有纪念意义的日子,同时发布了中英文版的博客进行介绍. 英文版发在SAP社区上,至 ...
- S/4HANA服务订单Service Order的批量创建
我工作中接到一个任务,需要在性能测试系统里创建一亿条服务订单service order来做性能测试. 这么大规模的数据量,当然只能用代码来创建了. 本文提到的所有ABAP代码,我均已上传到我的Gith ...
- 【FAQ】HMS Core推送服务与本地创建通知消息如何相互覆盖?
我们知道,单独使用HMS Core推送服务或本地创建通知消息,都可以实现通知消息的覆盖,方式分别为: 1.本地创建通知消息(简称本地通知消息) 通过notificationManager.notify ...
- ABAP 生产订单的创建与修改函数
ABAP 生产订单的创建与修改函数转自http://www.cnblogs.com/aBaoRong/archive/2012/04/11/2441946.html 如果生产订单过多,可以批量创建 ...
- WCF服务二:创建一个简单的WCF服务程序
在本例中,我们将实现一个简单的计算服务,提供基本的加.减.乘.除运算,通过客户端和服务端运行在同一台机器上的不同进程实现. 一.新建WCF服务 1.新建一个空白解决方案,解决方案名称为"WC ...
- C#创建服务及使用程序自动安装服务,.NET创建一个即是可执行程序又是Windows服务的exe
不得不说,.NET中安装服务很麻烦,即要创建Service,又要创建ServiceInstall,最后还要弄一堆命令来安装和卸载. 今天给大家提供一种方式,直接使用我们的程序来安装/卸载服务,并且可以 ...
- [转]C#创建服务及使用程序自动安装服务,.NET创建一个即是可执行程序又是Windows服务的exe
写在前面 原文地址:C#创建服务及使用程序自动安装服务,.NET创建一个即是可执行程序又是Windows服务的exe 这篇文章躺在我的收藏夹中有很长一段时间了,今天闲着没事,就自己动手实践了一下.感觉 ...
- 事件日志ID 2511:服务器服务无法重新创建 <sharename> 共享关系,因为 <address> 目录已不再存在
服务器服务无法重新创建 QQMusicDownload 共享关系,因为 D:\QQMusic\QQMusicDownload 目录已不再存在.请运行 "net share QQMusicDo ...
- Linux应用server搭建手冊—Weblogic服务域的创建与部署
前一篇谈到了Weblogic的安装,接下来整理weblogic服务域的创建及项目的部署 一.webLogic服务域创建 使用root用户登录后使用命令:#su W ...
随机推荐
- CSRF的防御实例(PHP)
CSRF的防御可以从服务端和客户端两方面着手,防御效果是从服务端着手效果比较好,现在一般的CSRF防御也都在服务端进行. 1.服务端进行CSRF防御 服务端的CSRF方式方法很多样,但总的思想都是一致 ...
- SQL Server 小技巧【2】
--1.不要使用×来查询所有字段 SELECT * FROM DBO.tb1 --改为 SELECT FName,PWD,CreateDate FROM DBO.tb1 (NOLOCK) --2.查询 ...
- JS——ajax login test
1.新建一个webproject,我用的是myeclipse10,建立如下的LoginServlet.java文件 2.编写java文件 import java.io.IOException; imp ...
- 预习 jQuary
一.jQuary简介 1.jQuery 库 - 特性 jQuery 是一个 JavaScript 函数库. jQuery 库包含以下特性: HTML 元素选取 HTML 元素操作 CSS 操作 HTM ...
- 函数对象适配器之ptr_fun的使用示例
//============================================================================ // Name : CopyInts4.c ...
- Codeforces Round #199 (Div. 2)
A.Xenia and Divisors 题意:给定N个数,每个数的取值范围为1-7,N是3的倍数,判定是否能够恰好将N个数分成若干三元组,使得一个组中的元素a,b,c满足 a < b < ...
- Thinking in Java 笔记初衷
当读到第十章的时候,发现之前读过的内容很难准确的记忆起来,这样给后续的阅读带来了一定的困惑,而之前也没有做适当的可读性的复习笔记,所以发现重新找后续阅读需要的知识点时,是有一定的困难的. 同时在知乎今 ...
- iOS 推送证书生成pem
cert: openssl x509 -in aps_development\ \(8\).cer -inform der -out pushDeveCerTopem.pem key: openssl ...
- thinkphp ajax 无刷新分页效果的实现
思路:先做出传统分页效果,然后重新复制一份Page.class.php类,对它进行修改,把js中的函数传到page类中,把上一页.下一页.首页.尾页.链接页中的url地址改成js控制的函数,模板页面中 ...
- iOS 开发之 Xcode6 创建真机调试证书
http://jingyan.baidu.com/article/ff411625b8141312e48237a7.html 1.登录苹果开发者中心 2.登录后的界面如图所示,如果没有最上面的两个选项 ...