sap 跨程序调用
1、abap form跨程序调用
2、submit
(1)DATA BEGIN OF LIST_TAB OCCURS 0.
INCLUDE STRUCTURE ABAPLIST.
DATA END OF LIST_TAB.
DATA: BEGIN OF T_STOCK OCCURS 0,
FIELD0(01) TYPE C,
FIELD1(03) TYPE C,
FIELD2(03) TYPE C,
FIELD3(18) TYPE C, "物料号码
FIELD4(01) TYPE C,
FIELD5(15) TYPE C, "库存数量
FIELD6(03) TYPE C, "单位
FIELD7(20) TYPE C,
END OF T_STOCK.
DATA: BEGIN OF T_LIST2 OCCURS 0,
* FIELD0(01) TYPE C,
* FIELD1(04) TYPE C, "库位
FIELD2(01) TYPE C,
FIELD3(03) TYPE C,
FIELD4(03) TYPE C,
FIELD5(10) TYPE C, "物料凭证
FIELD6(01) TYPE C,
FIELD7(04) TYPE C, "物料凭证行项目
FIELD8(01) TYPE C,
FIELD9(10) TYPE C, "过账日期
FIELD10(01) TYPE C,
FIELD11(17) TYPE C, "数量
FIELD12(01) TYPE C,
FIELD13(03) TYPE C, "单位
FIELD14(01) TYPE C,
END OF T_LIST2.
CALL FUNCTION 'LIST_FREE_MEMORY'
TABLES
LISTOBJECT = LIST_TAB.
SUBMIT RM07MLBD EXPORTING LIST TO MEMORY AND RETURN
WITH MATNR IN S_MATNR
WITH WERKS EQ P_WERKS
WITH DATUM IN S_DATUM
WITH LGBST EQ P_LGBST
WITH SOBKZ EQ P_SOBKZ "Add by Nancy Zhang 2015/02/10
WITH BWBST EQ ''
WITH SBBST EQ P_SBBST "Add by Nancy Zhang 2015/02/10
WITH XSUM EQ ''
WITH XCHRG EQ ''
WITH NOSTO EQ ''.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = LIST_TAB
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
CALL FUNCTION 'WRITE_LIST'
TABLES
LISTOBJECT = LIST_TAB.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = -1
TABLES
LISTASCI = T_STOCK
LISTOBJECT = LIST_TAB
EXCEPTIONS
EMPTY_LIST = 1
LIST_INDEX_INVALID = 2
OTHERS = 3.
DELETE T_STOCK WHERE FIELD0 = '|'.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = -1
TABLES
LISTASCI = T_LIST2
LISTOBJECT = LIST_TAB
EXCEPTIONS
EMPTY_LIST = 1
LIST_INDEX_INVALID = 2
OTHERS = 3.
(2)
EXPORT s_gstrp TO MEMORY ID 'S_GSTRP' .
SUBMIT zmes_013 AND RETURN .
IMPORT ct_dis FROM MEMORY ID 'CT_DIS'.
FREE MEMORY ID 'CT_DIS' .
(3)带select-options程序的Submit的用法
DATA:
LV_JOB_NAME LIKE TBTCO-JOBNAME VALUE 'ZMMR045', "
LV_JOB_NAME_A LIKE TBTCO-JOBNAME VALUE '', "
LV_PRJ_NAME TYPE SY-REPID VALUE 'ZMMR045',
LV_JOB_NR LIKE TBTCO-JOBCOUNT VALUE '', "
LV_JOB_RELEASED TYPE C.
DATA:LT_RSPAR TYPE TABLE OF RSPARAMS,
LS_RSPAR TYPE RSPARAMS.
CLEAR:LS_RSPAR.
LS_RSPAR-SELNAME = 'S_EBELN'.
LS_RSPAR-KIND = 'S'.
LS_RSPAR-SIGN = 'I'.
LS_RSPAR-OPTION = 'EQ'.
LS_RSPAR-LOW = RS_ITEM->EBELN.
APPEND LS_RSPAR TO LT_RSPAR.
CLEAR:LS_RSPAR.
LS_RSPAR-SELNAME = 'S_CRMNO'.
LS_RSPAR-KIND = 'S'.
LS_RSPAR-SIGN = 'I'.
LS_RSPAR-OPTION = 'EQ'.
LS_RSPAR-LOW = RS_ITEM->CRMNO.
APPEND LS_RSPAR TO LT_RSPAR.
SUBMIT (LV_PRJ_NAME) WITH SELECTION-TABLE LT_RSPAR
USER SYST-UNAME VIA JOB LV_JOB_NAME_A NUMBER LV_JOB_NR AND RETURN.
(4)带parameters程序的Submit的用法
SUBMIT zreport with p_param1 = 'value' with p_param2 = 'value'.