ABAP BAPI_PO_CREATE1 净价net_price 无效

194 篇文章 96 订阅

今天测试发现用BAPI_PO_CREATE1 创建采购订单,虽然能成功创建采购订单,但是行项目的净价总是和自己导入的数据不对。然后在前台手工创建时,发现会自动带出一个净价,奇怪从哪来。原来是因为我采购信息记录没有维护净价,它就会采用上一个采购订单的净价。

  

 查找相关资料,BAPI_PO_CREATE1 函数中的 EXPORTING中的NO_PRICE_FROM_PO 设为X。

还要注意一个问题

如果有税码,那么导入的时候那个价格是含税价格!!!比如我导入时poitem-tax_code 为J1,poitem-net_price=100,导入成功后,净价就变为85.47了!!!如下图。

85.47*(1+17%)。所以一般是先不设置税码。。后面再批量

 

另外找到一些资料:

 

using BAPI_PO_CREATE1 to create POs meanwhile passing the netprice instead of price from inforrecords.

From 580225:

  1. 1. NO_PRICE_FROM_PO

If you transfer the value 'X' in this field, no conditions are copied from the last document. This includes purchase orders, scheduling agreements, contracts and quotations. The system still copies  conditions from the information record.
The field can only be filled at header level. It is valid for all items.

Prerequisite
You must implement Note 552189 in your system to use the NO_PRICE_FROM_PO field.

  1. 2. POITEM-PO_PRICE

You can use the PO_PRICE field to control, at item level, if the value should be copied from the POITEM-NET_PRICE field to the conditions. PO_PRICE can have the values ' ', '1' or '2' with the following  meaning:

  • PO_PRICE = ' ': The conditions are determined automatically, the value from the NET_PRICE field is only copied if the system cannot determine a condition.

  • PO_PRICE = '1': The value transferred in field NET_PRICE is copied as a  gross price that is, it is set with the condition type specified as base price in the calculation schema. In the SAP Standard System, these are condition types PB00 or PBXX. All other condition types  remain unchanged. No conditions are copied from the last document.

  • PO_PRICE = '2': The value transferred in field NET_PRICE is copied as a  net price that is, it is set with the condition type specified as base price in the calculation procedure. All other condition types are deleted.

 

Keyword: NO_PRICE_FROM_PO = X   Poitem-po_price = '2'

Alternative: BBP_PO_INBOUND_BADI

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
BAPI_PO_CREATE1是一个针对事务码ME21N的函数模块,用于创建采购订单。它接受抬头和行项目作为输入参数,并根据这些参数创建采购订单[^2]。 在使用BAPI_PO_CREATE1时,需要注意以下几点: 1. 抬头数据:需要提供采购订单的抬头信息,例如供应商、采购组织、采购组等。 2. 行项目数据:需要提供采购订单的行项目信息,例如物料号、数量、价格等。 3. lt_poitem-ematerial字段:在同一个BAPI COMMIT中多次调用BAPI_PO_CREATE1时,需要赋值该字段。如果不赋值,系统会自动将其值设置为lt_poitem-material的值,并在后续调用中记忆该值。如果不正确地赋值该字段,可能会导致后续的BAPI调用报错[^1]。 下面是一个使用BAPI_PO_CREATE1创建采购订单的示例代码: ```python import pyrfc # 创建RFC连接 conn = pyrfc.Connection(user='username', passwd='password', ashost='host', sysnr='00', client='client') # 准备抬头数据 header_data = { 'COMP_CODE': '0001', 'DOC_TYPE': 'NB', 'VENDOR': '10000001', # 其他抬头字段... } # 准备行项目数据 item_data = [ { 'PO_ITEM': '00010', 'MATERIAL': 'MATERIAL1', 'QUANTITY': 10, # 其他行项目字段... }, { 'PO_ITEM': '00020', 'MATERIAL': 'MATERIAL2', 'QUANTITY': 20, # 其他行项目字段... }, # 其他行项目... ] # 调用BAPI_PO_CREATE1创建采购订单 result = conn.call('BAPI_PO_CREATE1', POHEADER=header_data, POITEM=item_data) # 检查返回结果 if result['RETURN'][0]['TYPE'] == 'E': print('创建采购订单失败:', result['RETURN'][0]['MESSAGE']) else: print('创建采购订单成功:', result['RETURN'][0]['MESSAGE']) # 关闭RFC连接 conn.close() ``` 请注意,上述示例代码中的参数值需要根据实际情况进行替换。另外,还需要安装pyrfc库来进行RFC连接的操作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值