ABAP 实现新会话新窗口方法
方法一:
WRITE 'This is the main ABAP program'.
DATA :
LV_SKIP(1) TYPE C VALUE 'X',
LV_VBELN LIKE VBAK-VBELN VALUE '20000190',
L_ST_PARAM TYPE TPARA,
L_IT_PARAMS TYPE TABLE OF TPARA.
CLEAR L_ST_PARAM.
CLEAR L_IT_PARAMS[].
L_ST_PARAM-PARAMID = 'AUN'.
L_ST_PARAM-PARTEXT = LV_VBELN.
APPEND L_ST_PARAM TO L_IT_PARAMS.
CALL FUNCTION 'CC_CALL_TRANSACTION_NEW_TASK'
STARTING NEW TASK 'VA03'
DESTINATION 'NONE'
EXPORTING
TRANSACTION = 'VA03'
SKIP_FIRST_SCREEN = 'X'
TABLES
PARAMTAB = L_IT_PARAMS
EXCEPTIONS
COMMUNICATION_FAILURE = 97
SYSTEM_FAILURE = 98
OTHERS = 99.
IF SY-SUBRC = 0.
" Success
ELSEIF SY-SUBRC = 97.
" Communication Failure
EXIT.
ELSEIF SY-SUBRC = 98.
" System Failure
EXIT.
ELSE.
EXIT.
ENDIF.
方法二:
WRITE 'This is the main ABAP report calling the SAP Transaction VA03 in a new session or in a new window'.
DATA : WA_SPA TYPE RFC_SPAGPA,
ITAB_SPA TYPE TABLE OF RFC_SPAGPA.
WA_SPA-PARID = 'AUN'.
WA_SPA-PARVAL = '20000190'.
APPEND WA_SPA TO ITAB_SPA.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
STARTING NEW TASK 'VA03'
DESTINATION 'NONE'
EXPORTING
TCODE = 'VA03'
SKIP_SCREEN = 'X'
TABLES
SPAGPA_TAB = ITAB_SPA
EXCEPTIONS
COMMUNICATION_FAILURE = 1
SYSTEM_FAILURE = 2.
IF SY-SUBRC <> 0.
" ERROR
ENDIF.
————————————————
版权声明:本文为CSDN博主「SAP剑客」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zhongguomao/article/details/70228500