ABAP Call Transaction功能大全
在ABAP程序中,可以使用CALL TRANSACTION语句调用其他事务代码。这种方式可以用于启动SAP中的标准或自定义事务代码。
以下是一些使用CALL TRANSACTION的常见方法:
- 直接调用事务代码:
CALL TRANSACTION 'FB01'.
- 使用参数传递:
DATA: BEGIN OF it_selection,
vbeln TYPE vbak-vbeln,
END OF it_selection.
it_selection-vbeln = '0016410006'.
CALL TRANSACTION 'VL02N' USING it_selection.
- 使用选择屏幕参数:
DATA: it_selection_parameter TYPE TABLE OF bapiparms,
wa_selection_parameter LIKE LINE OF it_selection_parameter.
wa_selection_parameter-selname = 'VBAK-VBELN'.
wa_selection_parameter-sign = 'I'.
wa_selection_parameter-option = 'EQ'.
wa_selection_parameter-low = '0016410006'.
APPEND wa_selection_parameter TO it_selection_parameter.
CALL TRANSACTION 'VL02N' PARAMETERS FROM it_selection_parameter.
- 使用选择屏幕参数并带有回调函数:
DATA: it_selection_parameter TYPE TABLE OF bapiparms,
wa_selection_parameter LIKE LINE OF it_selection_parameter.
wa_selection_parameter-selname = 'VBAK-VBELN'.
wa_selection_parameter-sign = 'I'.
wa_selection_parameter-option = 'EQ'.
wa_selection_parameter-low = '0016410006'.
APPEND wa_selection_parameter TO it_selection_parameter.
CALL TRANSACTION 'VL02N'
PARAMETERS FROM it_selection_parameter
MODE 'E'
UPDATE 'S'.
- 使用回调函数并获取返回的数据:
DATA: it_selection_parameter TYPE TABLE OF bapiparms,
wa_selection_parameter LIKE LINE OF it_selection_parameter.
wa_selection_parameter-selname = 'VBAK-VBELN'.
wa_selection_parameter-sign = 'I'.
wa_selection_parameter-option = 'EQ'.
wa_selection_parameter-low = '0016410006'.
APPEND wa_selection_parameter TO it_selection_parameter.
DATA: it_return TYPE TABLE OF bapiret2.
CALL TRANSACTION 'VL02N'
PARAMETERS FROM it_selection_parameter
MODE 'E'
UPDATE 'S'
USING it_return.
- 使用回调函数并获取返回的数据,并进行处理:
DATA: it_selection_parameter TYPE TABLE OF bapiparms,
wa_selection_parameter LIKE LINE OF it_selection_parameter.
wa_selection_parameter-selname = 'VBAK-VBELN'.
wa_selection_parameter-sign = 'I'.
wa_selection_parameter-option = 'EQ'.
wa_selection_parameter-low = '0016410006'.
APPEND wa_select
评论已关闭