函数使用十四:BAPI_PO_CREATE1
*&---------------------------------------------------------------------*
*& Report ZBAPI_PO_CREATE2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
"场景:因需求,采购部门将各业务部门的采购需求汇总,单独创建采购订单。
"根据
REPORT zbapi_po_create2. DATA:gw_head TYPE bapimepoheader,
gw_headx TYPE bapimepoheaderx,
gt_item TYPE TABLE OF bapimepoitem,
gw_item LIKE LINE OF gt_item,
gt_itemx TYPE TABLE OF bapimepoitemx,
gw_itemx LIKE LINE OF gt_itemx,
gt_return TYPE TABLE OF bapiret2,
gw_return LIKE LINE OF gt_return,
gt_sch TYPE TABLE OF bapimeposchedule,
gw_sch LIKE LINE OF gt_sch,
gt_schx TYPE TABLE OF bapimeposchedulx,
gw_schx LIKE LINE OF gt_schx,
gt_comp TYPE TABLE OF bapimepocomponent,
gw_comp LIKE LINE OF gt_comp,
gt_compx TYPE TABLE OF bapimepocomponentx,
gw_compx LIKE LINE OF gt_compx,
gv_po TYPE ebeln. "header
gw_head-comp_code = '6375'.
*gw_head-comp_code = '8380'.
gw_head-doc_type = 'NB'.
gw_head-status = 'B'.
gw_head-creat_date = sy-datum.
gw_head-doc_date = sy-datum.
gw_head-purch_org = '6375'.
*gw_head-purch_org = '8380'.
gw_head-pur_group = 'D01'.
*gw_head-pur_group = '137'.
gw_head-vendor = '0000401210'.
*gw_head-vendor = '0000100031'.
gw_head-langu = 'E'.
gw_head-ref_1 = 'E'."Your Reference gw_headx-comp_code = 'X'.
gw_headx-doc_type = 'X'.
gw_headx-status = 'X'.
gw_headx-creat_date = 'X'.
gw_headx-doc_date = 'X'.
gw_headx-purch_org = 'X'.
gw_headx-pur_group = 'X'.
gw_headx-vendor = 'X'.
gw_headx-langu = 'X'.
gw_headx-ref_1 = 'X'. "PO行项目
gw_item-po_item = 10.
gw_item-material = 'K300000'.
gw_item-item_cat = 'L'.
*gw_item-material = 'T60602475'.
gw_item-plant = '6375'.
*gw_item-plant = '8380'.
*gw_item-STGE_LOC = '8380'.
gw_item-quantity = 2.
gw_item-net_price = 100.
gw_item-price_unit = 1.
gw_item-preq_no = '0010001627'.
gw_item-preq_item = 10.
*gw_item-batch = 'HS'.
APPEND gw_item TO gt_item.CLEAR:gw_item. gw_itemx-po_item = 10.
gw_itemx-material = 'X'.
gw_itemx-item_cat = 'X'.
gw_itemx-plant = 'X'.
*gw_item-STGE_LOC = '8380'.
gw_itemx-quantity = 'X'.
gw_itemx-net_price = 'X'.
gw_itemx-price_unit = 'X'.
gw_itemx-preq_no = 'X'.
gw_itemx-preq_item = 'X'.
*gw_itemx-batch = 'X'.
APPEND gw_itemx TO gt_itemx.CLEAR:gw_itemx. "PO计划行
gw_sch-po_item = 10.
gw_sch-sched_line = 1.
gw_sch-delivery_date = '20210605'.
gw_sch-com_date = sy-datum + 1.
gw_sch-po_date = sy-datum.
gw_sch-quantity = 2.
gw_sch-preq_no = '0010001627'.
gw_sch-preq_item = 10.
gw_sch-com_qty = 2.
APPEND gw_sch TO gt_sch. gw_schx-po_item = 10.
gw_schx-sched_line = 1.
gw_schx-delivery_date = 'X'.
gw_schx-com_date = 'X'.
gw_schx-po_date = 'X'.
gw_schx-quantity = 'X'.
gw_schx-preq_no = 'X'.
gw_schx-preq_item = 'X'.
gw_schx-com_qty = 'X'.
APPEND gw_schx TO gt_schx. *gw_comp-po_item = 10.
*gw_comp-sched_line = 1.
*gw_comp-item_no = 10.
*gw_comp-material = 'K100000'.
*gw_comp-entry_quantity = 1.
*gw_comp-plant = '6375'.
*gw_comp-change_id = 'I'.
**gw_comp-plant = '8380'.
*APPEND gw_comp TO gt_comp.
*
*gw_compx-po_item = 10.
*gw_compx-sched_line = 1.
*gw_compx-item_no = 10.
*gw_compx-material = 'X'.
*gw_compx-entry_quantity = 'X'.
*gw_compx-plant = 'X'.
*gw_compx-change_id = 'X'.
*APPEND gw_compx TO gt_compx. CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = gw_head
poheaderx = gw_headx
IMPORTING
exppurchaseorder = gv_po
TABLES
return = gt_return
poitem = gt_item
poitemx = gt_itemx
poschedule = gt_sch
poschedulex = gt_schx
pocomponents = gt_comp
pocomponentsx = gt_compx.
READ TABLE gt_return INTO gw_return WITH KEY type = 'E'.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WRITE gv_po.
ENDIF.
函数使用十四:BAPI_PO_CREATE1的更多相关文章
- Python - 函数 - 第十四天
Python 函数 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 函数能提高应用的模块性,和代码的重复利用率.你已经知道Python提供了许多内建函数,比如print().但你也 ...
- JAVA之旅(十四)——静态同步函数的锁是class对象,多线程的单例设计模式,死锁,线程中的通讯以及通讯所带来的安全隐患,等待唤醒机制
JAVA之旅(十四)--静态同步函数的锁是class对象,多线程的单例设计模式,死锁,线程中的通讯以及通讯所带来的安全隐患,等待唤醒机制 JAVA之旅,一路有你,加油! 一.静态同步函数的锁是clas ...
- Django笔记二十四之数据库函数之比较和转换函数
本文首发于公众号:Hunter后端 原文链接:Django笔记二十四之数据库函数之比较和转换函数 这一篇笔记开始介绍几种数据库函数,以下是几种函数及其作用 Cast 转换类型 Coalesce 优先取 ...
- Python小白学习之路(十四)—【作用域】【匿名函数】【编程方法论】【高阶函数】
吧啦吧啦内心戏 在没有具体学作用域之前,我在之前的学习笔记中就有提到 我开始以为是自己自创的词儿 没想到这个词早已经存在(手动捂脸) 真是个无知的小火锅(不知者无罪) 我发现自己最擅长做的事情,就是给 ...
- 我的MYSQL学习心得(十四) 备份和恢复
我的MYSQL学习心得(十四) 备份和恢复 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) ...
- 雅虎(yahoo)前端优化十四条军规
第一条.尽可能的减少 HTTP 的请求数 (Make Fewer HTTP Requests ) http请求是要开销的,想办法减少请求数自然可以提高网页速度.常用的方法,合并css,js(将一个页面 ...
- 解剖SQLSERVER 第十四篇 Vardecimals 存储格式揭秘(译)
解剖SQLSERVER 第十四篇 Vardecimals 存储格式揭秘(译) http://improve.dk/how-are-vardecimals-stored/ 在这篇文章,我将深入研究 ...
- Chrome浏览器扩展开发系列之十四
Chrome浏览器扩展开发系列之十四:本地消息机制Native messaging 时间:2015-10-08 16:17:59 阅读:1361 评论:0 收藏:0 ...
- NeHe OpenGL教程 第四十四课:3D光晕
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- NeHe OpenGL教程 第三十四课:地形
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
随机推荐
- OpenGL与GLSL各版本对应说明
OpenGL 4.6 (API Core Profile) (API Compatibility Profile) OpenGL Shading Language 4.60 Specification ...
- kvm内存优化--KSM
一.KSM(Kernel SamePage Merging) 1.KSM简介 KSM允许内核在多个进程(包括虚拟机)之间共享完全相同的内存页,KSM让内核扫描检查正在运行中的程序并且比较他们的内存,若 ...
- 爬虫管理平台-TaskPyro的任务管理
官网:https://docs.taskpyro.cn/ 任务管理 TaskPyro提供了强大而灵活的任务管理功能,让您能够轻松创建和管理Python脚本的定时任务. 创建任务 在TaskPyro中创 ...
- EntityFrameworkCore 中实体的几种配置方法
使用数据注解 实体类通常是在Models目录下,直接在实体类上添加属性注解,比如[Required]/[Key]等. using System.ComponentModel.DataAnnotatio ...
- Asp.net mvc基础(八)Layout页面的使用
Layout页面相当于母版页. 使用步骤如下: 1.创建MVC5布局页 @RenderBody()渲染正文部分 @ViewBag.Title表示标题内容 也可以自己定义渲染的部分:比如在布局页中添加@ ...
- MySQL 中如何进行 SQL 调优?
MySQL 中如何进行 SQL 调优? SQL 调优是提高数据库查询性能的过程,主要目的是减少查询的响应时间和系统的负载.下面是一些常见的 SQL 调优方法和技巧. 1. 使用索引 索引的使用可以显著 ...
- MCP云托管最优解,揭秘国内最大MCP中文社区背后的运行时
作者:封崇 近期,中国第一AI开源社区魔搭(ModelScope)推出全新MCP广场,上架千余款热门的 MCP 服务.从当下火热的高德地图.网页抓取再到独家的支付宝,开发者/机构可以查看近1500种M ...
- sonarqube+gitlab+jenkins+maven集成搭建(三)
安装JENKINS 关闭防火墙[root@localhost ~]# systemctl stop firewalld[root@localhost ~]# systemctl disable fir ...
- 在 Spring Boot 2 中集成 JCasbin 并实现 ClassPath 模型文件加载
在 Spring Boot 2 中集成 JCasbin 并实现 ClassPath 模型文件加载 概述 在现代Web应用开发中,权限管理和认证是不可或缺的一部分.JCasbin 是一个强大的.高效的开 ...
- Git Reset 彻底解析:--hard 模式操作步骤、风险与完整恢复指北
结论先行 使用 git reset --hard <commit_id> 可强制将本地代码.暂存区.工作目录彻底回退到指定提交状态,但会丢弃目标提交之后的所有提交记录(需谨慎操作,尤其涉及 ...