使用 ABAP 代码打印 SAP 系统指定订单的 Referen
2023-09-11 本文已影响0人
华山令狐冲
关于 Reference Currency
字段的业务含义,请查看这篇文章:
什么是 SAP 系统订单的 Reference Currency 字段
打印某订单 Reference Currency 的值:
REPORT zorder_get_ref_currency.
DATA: lv_guid TYPE crmt_object_guid,
lv_object_id TYPE crmd_orderadm_h-object_id,
lv_price_guid LIKE lv_guid,
ls_price TYPE crmd_pricing.
lv_object_id = '5052529'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_object_id
IMPORTING
output = lv_object_id.
SELECT SINGLE guid INTO lv_guid FROM crmd_orderadm_h WHERE object_id = lv_object_id AND process_type = 'AG'.
IF sy-subrc <> 0.
WRITE:/ 'no order found'.
RETURN.
ENDIF.
SELECT SINGLE guid_set FROM crmd_link INTO lv_price_guid WHERE guid_hi = lv_guid AND objtype_hi = '05'
AND objtype_set = '09'.
IF sy-subrc <> 0.
WRITE: / 'No price link found'.
RETURN.
ENDIF.
SELECT SINGLE * INTO ls_price FROM crmd_pricing WHERE guid = lv_price_guid.
IF sy-subrc <> 0.
WRITE: / 'no price document found'.
RETURN.
ENDIF.
WRITE: / 'reference currency: ' , ls_price-ref_currency.