FORM FRM_CREATE_PO  USING    P_POSNR
CHANGING P_EBELN. DATA: LV_VENDOR TYPE LIFNR,
LV_ITEM TYPE EBELP,
LV_CONDTYPE(). DATA: LV_AMOUNT TYPE P DECIMALS ,
LV_TAX TYPE P DECIMALS VALUE '1.17',
LV_RATIO TYPE P DECIMALS ."公司间加价系数 CHECK P_EBELN IS INITIAL. CLEAR: GS_POHEADER,
GS_POHEADERX. PERFORM FRM_GET_COMPANY_RATIO(ZSDS0002) USING IT_ZSDT0018-BUKRS CHANGING LV_RATIO. PERFORM FRM_CONVERT_VENDOR USING '' CHANGING LV_VENDOR. GS_POHEADER-VENDOR = LV_VENDOR.
GS_POHEADER-SUPPL_PLNT = ''.
GS_POHEADER-DOC_TYPE = 'ZRTO'.
GS_POHEADER-DOC_DATE = IT_ZSDT0018-DATUM.
GS_POHEADER-CREAT_DATE = SY-DATUM.
GS_POHEADER-CREATED_BY = SY-UNAME.
GS_POHEADER-PURCH_ORG = ''.
GS_POHEADER-PUR_GROUP = 'A15'.
GS_POHEADER-COMP_CODE = IT_ZSDT0018-BUKRS.
GS_POHEADER-SALES_PERS = P_POSNR. GS_POHEADERX-DOC_TYPE = 'X'.
GS_POHEADERX-DOC_DATE = 'X'.
GS_POHEADERX-CREAT_DATE = 'X'.
GS_POHEADERX-CREATED_BY = 'X'.
GS_POHEADERX-VENDOR = 'X'.
GS_POHEADERX-PURCH_ORG = 'X'.
GS_POHEADERX-PUR_GROUP = 'X'.
GS_POHEADERX-COMP_CODE = 'X'.
GS_POHEADERX-SALES_PERS = 'X'.
GS_POHEADERX-OUR_REF = 'X'.
GS_POHEADERX-SUPPL_PLNT = 'X'. CLEAR LV_ITEM. REFRESH: GT_POITEM,GT_POITEMX,
GT_POCOND,GT_POCONDX. REFRESH: GT_POSCHEDULE,
GT_POSCHEDULEX. LOOP AT ITAB WHERE POSNR = P_POSNR.
ADD TO LV_ITEM. CLEAR GS_POITEM.
GS_POITEM-PO_ITEM = LV_ITEM.
GS_POITEM-MATERIAL = ITAB-MATNR."Article (商品款号)
GS_POITEM-PLANT = ITAB-WERKS.
GS_POITEM-BATCH = ITAB-CHARG.
GS_POITEM-QUANTITY = ITAB-MENGE.
GS_POITEM-STGE_LOC = ''.
GS_POITEM-RET_ITEM = 'X'.
GS_POITEM-VAL_TYPE = ITAB-CHARG.
GS_POITEM-TAX_CODE = 'J1'.
APPEND GS_POITEM TO GT_POITEM. CLEAR GS_POITEMX.
GS_POITEMX-PO_ITEM = LV_ITEM.
GS_POITEMX-MATERIAL = 'X'.
GS_POITEMX-BATCH = 'X'.
GS_POITEMX-STGE_LOC = 'X'.
GS_POITEMX-PLANT = 'X'.
GS_POITEMX-QUANTITY = 'X'.
GS_POITEMX-STGE_LOC = 'X'.
GS_POITEMX-RET_ITEM = 'X'.
GS_POITEMX-VAL_TYPE = 'X'.
GS_POITEMX-TAX_CODE = 'X'.
APPEND GS_POITEMX TO GT_POITEMX. CLEAR GS_POSCHEDULE.
GS_POSCHEDULE-PO_ITEM = LV_ITEM.
GS_POSCHEDULE-SCHED_LINE = .
GS_POSCHEDULE-DELIVERY_DATE = IT_ZSDT0018-DATUM.
APPEND GS_POSCHEDULE TO GT_POSCHEDULE. CLEAR GS_POSCHEDULEX.
GS_POSCHEDULEX-PO_ITEM = LV_ITEM.
GS_POSCHEDULEX-SCHED_LINE = .
GS_POSCHEDULEX-DELIVERY_DATE = 'X'.
APPEND GS_POSCHEDULEX TO GT_POSCHEDULEX. * 获取物料的成本价 * 加价系数 * 1.17
PERFORM FRM_GET_MAT_VALUE(ZSDS0002) USING ITAB-MATNR ITAB-CHARG '' LV_RATIO CHANGING LV_AMOUNT.
** 根据是否有采购信息记录 判断净价的条件类型
* PERFORM FRM_CHECK_CONDITION_TYPE(ZSDS0002) USING LV_VENDOR '8000' ITAB-WERKS ITAB-MATNR CHANGING LV_CONDTYPE.
IF ITAB-CHARG+() = 'W' AND LV_AMOUNT IS INITIAL.
SELECT SINGLE ZJE FROM ZMMT0121
INTO LV_AMOUNT
WHERE MATNR = ITAB-MATNR
AND CHARG = ITAB-CHARG
AND WERKS = ITAB-WERKS. IF SY-SUBRC EQ .
* ---> 定价过程取消税率 1.17 20150426 start
* LV_AMOUNT = LV_AMOUNT * LV_TAX.
* <--- 定价过程取消税率 1.17 20150426 end
ENDIF.
ENDIF. CLEAR GS_POCOND.
GS_POCOND-ITM_NUMBER = LV_ITEM.
GS_POCOND-COND_TYPE = 'PB00'.
GS_POCOND-COND_VALUE = LV_AMOUNT.
GS_POCOND-CURRENCY = 'CNY'.
GS_POCOND-CHANGE_ID = 'U'.
GS_POCOND-COND_UPDAT = 'X'.
APPEND GS_POCOND TO GT_POCOND. CLEAR GS_POCONDX.
GS_POCONDX-ITM_NUMBER = LV_ITEM.
GS_POCONDX-COND_TYPE = 'X'.
GS_POCONDX-COND_VALUE = 'X'.
GS_POCONDX-CURRENCY = 'X'.
GS_POCONDX-CHANGE_ID = 'X'.
GS_POCONDX-COND_UPDAT = 'X'.
APPEND GS_POCONDX TO GT_POCONDX. CLEAR GS_POCOND.
GS_POCOND-ITM_NUMBER = LV_ITEM.
GS_POCOND-COND_TYPE = 'PBXX'.
GS_POCOND-COND_VALUE = LV_AMOUNT.
GS_POCOND-CURRENCY = 'CNY'.
GS_POCOND-CHANGE_ID = 'U'.
GS_POCOND-COND_UPDAT = 'X'.
APPEND GS_POCOND TO GT_POCOND. CLEAR GS_POCONDX.
GS_POCONDX-ITM_NUMBER = LV_ITEM.
GS_POCONDX-COND_TYPE = 'X'.
GS_POCONDX-COND_VALUE = 'X'.
GS_POCONDX-CURRENCY = 'X'.
GS_POCONDX-CHANGE_ID = 'X'.
GS_POCONDX-COND_UPDAT = 'X'.
APPEND GS_POCONDX TO GT_POCONDX.
ENDLOOP. CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = GS_POHEADER
POHEADERX = GS_POHEADERX
IMPORTING
EXPPURCHASEORDER = GV_EXPPURCHASEORDER
TABLES
RETURN = IT_RETURN
POITEM = GT_POITEM
POITEMX = GT_POITEMX
POCOND = GT_POCOND
POCONDX = GT_POCONDX
POSCHEDULE = GT_POSCHEDULE
POSCHEDULEX = GT_POSCHEDULEX. LOOP AT IT_RETURN WHERE TYPE = 'E' OR TYPE = 'A' OR TYPE = 'X'. ENDLOOP. IF SY-SUBRC EQ .
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. CLEAR P_EBELN. APPEND_MSG_LIST 'E' 'ZSD002' '' P_POSNR IT_RETURN-MESSAGE '' ''.
ELSE. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'. P_EBELN = GV_EXPPURCHASEORDER. APPEND_MSG_LIST 'S' 'ZSD002' '' P_POSNR P_EBELN '' ''.
ENDIF.
ENDFORM. " FRM_CREATE_PO
FORM frm_get_mat_value  USING    p_matnr
p_charg
p_werks
p_ratio
CHANGING p_value. DATA : lv_ratio TYPE p DECIMALS ,"公司间加价系数
lv_value TYPE p DECIMALS ,"物料成品价
lv_amount TYPE p DECIMALS ,
lv_matnr TYPE matnr,
lv_mtart TYPE mtart,
lv_tax TYPE p DECIMALS VALUE '1.17'. SELECT SINGLE *
FROM mbew
WHERE matnr = p_matnr
AND bwkey = p_werks
AND bwtar = p_charg. IF mbew-vprsv EQ 'S'.
lv_value = mbew-stprs / mbew-peinh.
ELSE.
lv_value = mbew-verpr / mbew-peinh.
ENDIF. SELECT SINGLE mtart INTO lv_mtart FROM mara WHERE matnr = p_matnr. * IF LV_MTART EQ 'Z006'."辅料.
* P_VALUE = LV_VALUE * LV_TAX.
* ELSE.
* P_VALUE = LV_VALUE * P_RATIO * LV_TAX.
* ENDIF. * ---> 定价过程取消税率 1.17 20150426 start
IF lv_mtart EQ 'Z006'."辅料.
p_value = lv_value.
ELSE.
p_value = lv_value * p_ratio.
ENDIF.
* <--- 定价过程取消税率 1.17 20150426 end
ENDFORM. " FRM_GET_MAT_VALUE

创建PO的更多相关文章

  1. 利用MyEclipse自动创建PO类、hbm文件(映射文件)、DAO

    原文地址:http://blog.csdn.net/fangzhibin4712/article/details/7179414 前提条件:表sjzdfl  表sjzdxx (使用数据库MySQL) ...

  2. SAP MM ME21N 创建PO时报错 - Net price in CNY becomes too large –

    SAP MM ME21N 创建PO时报错 - Net price in CNY becomes too large – 笔者所在的项目上,由于客户尚未正式大规模量产,在现阶段,所有的物料基本都是走费用 ...

  3. 「SAP技术」已启用质检物料创建PO时候'STOCK TYPE'没有默认为X?

    「SAP技术」 SAP MM 已启用质检物料创建PO时候'STOCK TYPE'没有默认为X? Part I:SAP 标准行为 1, 物料11002335, QM视图里 01 inspection t ...

  4. 使用bapi创建PO遇到问题(BAPI_PO_CREATE1

    今天用 BAPI_PO_CREATE1创建po. 注意事项: vendor 供应商号:长度必须和系统一致,10位.如 2000025要写成 0002000025传递给参数. POITEM 中的 PO_ ...

  5. BAPI创建PO,禁止净价信息更新

    大家都知道创建PO时,我们如果勾选了"信息更新",则该PO保存后相应的信息记录会把这个PO更新为其最后的凭证,那么这张PO的净价会作为下次创建新PO时净价的默认值. 这样我们设置的 ...

  6. 创建PO/SO

    IF P_ZY EQ 'X'."直营订单 调拨单 PERFORM FRM_INIT_PO_HEADER. PERFORM FRM_INIT_PO_ITEM. PERFORM FRM_INIT ...

  7. BAPI_PO_CREATE1 创建PO ch_memory_complete = ‘x',导致hold on 解决方案,

    1.尝试注释标准逻辑,看会不会有什么问题, ZME_BAPI_PO_CUST IF_EX_ME_BAPI_PO_CREATE_02~INBOUND 里面有个控制很费解 我给注释了 2.改用 BAPI_ ...

  8. 创建第一个Hiberntae工程

    一.前言 很久之前已经对Hibernate有所了解,在项目中进行过简单的应用,基本了解hibernate的简单应用,没有深入的了解,来Shine公司快三个月了,公司的ORM框架就是用Hiberante ...

  9. BOM/ROUTING/PO/WIP等模块常用查询

    常用查询scripts /*bom*/ select p_item.segment1,c_item.segment1,bic.COMPONENT_QUANTITY,bic.COMPONENT_YIEL ...

随机推荐

  1. JAVA排序--[冒泡排序]

    package com.array; public class Sort_MaoPao { /** * 项目名称:冒泡排序 * 项目要求:用JAVA对数组进行排序,并运用冒泡排序算法 * 作者:Sev ...

  2. [C和指针]第二部分

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  3. CUBRID学习笔记 25 数据类型2

    ---恢复内容开始--- 6枚举类型 语法 <enum_type> : ENUM '(' <char_string_literal_list> ')' <char_str ...

  4. FLASH CC 2015 CANVAS 中 gotoAndStop、gotoAndPlay() 不起作用

    哎 话不多说先看我的代码: //舞台上 放着sp0.sp1....sp8,9个mc,每个mc都有几帧, //帧上有如下代码 var S=this; S.stop() inIt1();//not wor ...

  5. 超实用压力测试工具-ab工具

    在学习ab工具之前,我们需了解几个关于压力测试的概念 吞吐率(Requests per second)概念:服务器并发处理能力的量化描述,单位是reqs/s,指的是某个并发用户数下单位时间内处理的请求 ...

  6. php用curl调用接口方法,get和post两种方式

    首先是客户端执行方法ApiModel.php: <?php /** * 模拟post进行url请求 * @param string $url * @param array $post_data ...

  7. Linux socket编程应用学习笔记

    参考这个系列吧 http://www.cnblogs.com/wunaozai/tag/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/default.html?page=2 ...

  8. CodeForces 185A 快速幂

    一开始找矩阵快速幂的题来做时就看到了这题,题意就是让你求出如图所示的第n个三角形中指向向上的小三角形个数.从图中已经很容易看出递推关系了,我们以f[n]表示第n个大三角形中upward的小三角形个数, ...

  9. gdufs 1237 最优分解问题

    题目链接:http://cstfs.gdufs.edu.cn:8080/JudgeOnline/problem.jsp?id=1237 (好像是内网的0.0) 简单来说,这道题目就是把一个数分解为若干 ...

  10. js object(对象)

    http://www.cnblogs.com/pingchuanxin/p/5773326.html Object(对象)是在所有的编程语言中都十分重要的一个概念,对于事物我们可以把他们看作是一个对象 ...