自学内容网 自学内容网

SAP 采购订单 Adobe 消息输出

目录

1 简介

2 业务数据例子

3 选择增强 & 代码

1)BADI: MM_PUR_S4_PO_MODIFY_HEADER

2)BADI: MM_PUR_S4_PO_MODIFY_ITEM

4 自定义 Adobe form

1)PO Master form

2)PO form

5 前台主数据配置

6 后台配置

1)基于常规规则定义输出,可以参考标准来配即可。

2)关联自定义的 PO Master form 和 PO form。


1 简介

标准的 SAP 采购订单消息输出不会带税金额,但实际业务都会有税金额产生,这时候我们不得不选择做增强+创建自定义 Adboe form 的方式满足实际业务。

2 业务数据例子

PO 表头和行项目明细分别增加,自定义字段 PO 总金额(净价+税价)和自定义 PO 税金额和税码。自定义的 PO 总金额和 PO 税金额反映到 Adobe 自定义模板。

3 选择增强 & 代码

1)BADI: MM_PUR_S4_PO_MODIFY_HEADER

* purchaseorderchange-<your_field_name> = 'Your field content'.

data: lv_total_amount type if_ex_mmpur_final_check_po=>bwert.

data lv_taxRate TYPE P length 2.

loop at purchaseorderitem_table into data(ls_item) where purchasingdocumentdeletioncode = space.

clear lv_taxRate.

case ls_item-taxcode.

when 'J2'.

lv_taxRate = 13.

when 'Y1'.

lv_taxRate = 11.

when 'J4'.

lv_taxRate = 9.

when 'JB'.

lv_taxRate = 6.

when 'R3'.

lv_taxRate = 5.

when 'JC'.

lv_taxRate = 4.

when 'R2'.

lv_taxRate = 3.

when 'J5'.

lv_taxRate = 1.

when 'J0'.

lv_taxRate = 0.

WHEN others.

endcase.

lv_total_amount = lv_total_amount + ls_item-netamount + ls_item-netamount * lv_taxRate / 100.

endloop.

PURCHASEORDERCHANGE-YY1_PO_TOTAL_VALUE_PDH = lv_total_amount.

2)BADI: MM_PUR_S4_PO_MODIFY_ITEM

" purchaseorderitemchange-<your_field_name> = 'Enter your field content'.

"Defaulting of TaxCode for PO item in first round-trip

"IF purchaseorderitem_old IS INITIAL.

" purchaseorderitemchange-taxcode = 'V2'.

"ENDIF.

"Defaulting of PurchasingInfoRecordUpdateCode for PO item

"either in first round-trip or when material or plant changes

"IF purchaseorderitem_old IS INITIAL

" OR purchaseorderitem-material <> purchaseorderitem_old-material

" OR purchaseorderitem-plant <> purchaseorderitem_old-plant.

" purchaseorderitemchange-purchasinginforecordupdatecode = 'B'.

"ENDIF.

"Set the info update flag when the supplier number is filled.

"IF purchaseorderitem-suppliermaterialnumber IS NOT INITIAL.

" IF purchaseorderitem_old-purchasinginforecordupdatecode IS INITIAL AND

" purchaseorderitem-purchasinginforecordupdatecode IS INITIAL.

" purchaseorderitemchange-purchasinginforecordupdatecode = 'A'.

" ENDIF.

"ENDIF.

"Defaulting of Shipping Type in first roundtrip

"IF purchaseorderitem_old IS INITIAL AND purchaseorderitemchange-shippingtype IS INITIAL.

" purchaseorderitemchange-shippingtype = '01'.

"ENDIF.

data lv_taxcode type C length 2 .

data lv_taxRate TYPE P length 2.

if purchaseorderitemchange-taxcode is not initial.

lv_taxcode = purchaseorderitemchange-taxcode.

else.

select single TaxCode from I_PurchaseOrderItemAPI01

where PurchaseOrder = @purchaseorderitem-purchaseorder and PurchaseOrderItem = @purchaseorderitem-PurchaseOrderItem

into @lv_taxcode.

endif.

case lv_taxcode.

when 'J2'.

lv_taxRate = 13.

when 'Y1'.

lv_taxRate = 11.

when 'J4'.

lv_taxRate = 9.

when 'JB'.

lv_taxRate = 6.

when 'R3'.

lv_taxRate = 5.

when 'JC'.

lv_taxRate = 4.

when 'R2'.

lv_taxRate = 3.

when 'J5'.

lv_taxRate = 1.

when 'J0'.

lv_taxRate = 0.

WHEN others.

endcase.

if lv_taxcode is not initial.

purchaseorderitemchange-yy1_po_item_tax_amount_pdi = ( purchaseorderitem-netamount * lv_taxRate ) / 100 .

endif.

purchaseorderitemchange-yy1_po_tax_coce_pdi = lv_TaxCode .

4 自定义 Adobe form

自定义 PO Master form 和 PO form 关联起来。基于标准的 PO Master form 和 PO form 复制下来,然后再增加税金额字段。总金额字段重新命名成自定义字段,这样才能接收到前台 PO 自定义总金额数据。

1)PO Master form

2)PO form

5 前台主数据配置

基于常规的消息输出挨个定义即可。

6 后台配置

1)基于常规规则定义输出,可以参考标准来配即可。

2)关联自定义的 PO Master form 和 PO form。


原文地址:https://blog.csdn.net/weixin_42579000/article/details/140586439

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!