点击此处---> 群内免费提供SAP练习系统(在群公告中)
加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)
1.显示物料凭证
MIGO
CALL FUNCTION 'MIGO_DIALOG'
EXPORTING
i_action = 'A04'
i_refdoc = 'R02'
i_notree = 'X'
i_mblnr = 物料凭证号
i_mjahr = 物料凭证年度
i_zeile = 物料凭证行项目.
MB03
SET PARAMETER ID 'MBN' FIELD '物料凭证号'.
SET PARAMETER ID 'MJA' FIELD
'物料凭证年度'.
CALL TRANSACTION 'MB03' AND SKIP FIRST
SCREEN.
2.会计凭证显示原始凭证
REPORT ZTESTSENDER.
TABLES BKPF.
SELECT SINGLE * INTO BKPF FROM BKPF WHERE BUDAT GE '20160101'.
CALL FUNCTION 'AC_DOCUMENT_SENDER'
EXPORTING
I_AWSYS = BKPF-AWSYS
I_AWTYP = BKPF-AWTYP
I_AWREF = BKPF-AWKEY+00(10)
I_AWORG = BKPF-AWKEY+10(10) .
3.物料凭证显示会计凭证
TABLES MKPF.
SELECT SINGLE * INTO MKPF FROM MKPF WHERE BUDAT GE '20160701'.
DATA LV_AWORT TYPE AWORG.
LV_AWORT = MKPF-MJAHR.
CALL FUNCTION 'AC_DOCUMENT_RECORD'
EXPORTING
I_AWTYP
= 'MKPF'
I_AWREF
= MKPF-MBLNR
I_AWORG = LV_AWORT
I_AWSYS
= MKPF-AWSYS.
4.发票预制号码段如果和发票号码段不一致,保存时候发生号码转换,用此FM获取新老对照关系
CALL FUNCTION 'MRM_INVOICE_READ'
EXPORTING
I_BELNR = 后勤发票号
I_GJAHR = 后勤发票号年度
IMPORTING
E_RBKPV = LS_MRM_RBKPV.
IF LS_MRM_RBKPV-RBSTAT = '2' .
新后勤发票号 = LS_MRM_RBKPV-XBLNR+2(10).
新后勤发票年度= LS_MRM_RBKPV-XBLNR+12(4).
ENDIF.