ABAP4_CALL_TRANSACTION

此函数是在程序中调用一个事物代码,跳转或者执行事物代码的程序。

参数说明:

Import

TCODE 执行的事物代码

SKIP_SCREEN 跳转事务代码的初始屏幕,只在跳转时用

MODE_VAL BDC时使用,对应 默认A:前台,显示屏幕 E:遇到错误停止并显示 N:后台模式

UPDATE_VAL BDC时使用,对应 默认A:异步 S:同步 L:本地模式,LOCAL UPDATE

Export

SUBRC SY-SUBRC 返回值

Table

USING_TAB DBC DATA TABLE 如果调用BDC事务,BDC DATA的内容通过此表传值

SPAGPA_TAB Parameter 一般做跳转的参数设置 SET PARAMETER ID

MESS_TAB Message Table BDC 返回消息内表
"
REPORT ZABAP4_CALL_TRANSACTION.
"事务界面跳转
CALL FUNCTION ‘ABAP4_CALL_TRANSACTION’
EXPORTING
TCODE = ‘SE11’
EXCEPTIONS
CALL_TRANSACTION_DENIED = 1
TCODE_INVALID = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.

"功能跳转
DATA:GT_RFC_SPAGPA TYPE TABLE OF RFC_SPAGPA,
GW_RFC_SPAGPA LIKE LINE OF GT_RFC_SPAGPA.
GW_RFC_SPAGPA-PARID = ‘AUN’.
GW_RFC_SPAGPA-PARVAL = ‘10000140’.
APPEND GW_RFC_SPAGPA TO GT_RFC_SPAGPA.
CALL FUNCTION ‘ABAP4_CALL_TRANSACTION’
EXPORTING
TCODE = ‘VA03’
SKIP_SCREEN = ‘X’ "SKIP FIRST SCREEN
TABLES
SPAGPA_TAB = GT_RFC_SPAGPA
EXCEPTIONS
CALL_TRANSACTION_DENIED = 1
TCODE_INVALID = 2
OTHERS = 3.
IF SY-SUBRC <> 0.

  • Implement suitable error handling here
    ENDIF.

在这里插入图片描述

"BDC
DATA:BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA:MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

PERFORM BDC_DYNPRO USING ‘SAPMV45A’ ‘0102’.
PERFORM BDC_FIELD USING ‘BDC_CURSOR’
‘VBAK-VBELN’.
PERFORM BDC_FIELD USING ‘BDC_OKCODE’
‘/00’.
PERFORM BDC_FIELD USING ‘VBAK-VBELN’
‘10000141’.
PERFORM BDC_DYNPRO USING ‘SAPMV45A’ ‘4001’.
CALL FUNCTION ‘ABAP4_CALL_TRANSACTION’
EXPORTING
TCODE = ‘VA03’
MODE_VAL = ‘A’
UPDATE_VAL = ‘S’
TABLES
USING_TAB = BDCDATA
MESS_TAB = MESSTAB
EXCEPTIONS
CALL_TRANSACTION_DENIED = 1
TCODE_INVALID = 2.

----------------------------------------------------------------------

  •    Start new screen                                              *
    

----------------------------------------------------------------------
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = ‘X’.
APPEND BDCDATA.
ENDFORM.

----------------------------------------------------------------------

  •    Insert field                                                  *
    

----------------------------------------------------------------------
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDFORM.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值