abap程序之间调用
1、submit方式-标准
FIELD-SYMBOLS : <LT_PAY_DATA> TYPE ANY TABLE . FIELD-SYMBOLS : <LT_TEST> TYPE ANY . "LIKE LINE OF it_tab . DATA LR_PAY_DATA TYPE REF TO DATA. CL_SALV_BS_RUNTIME_INFO=>SET( EXPORTING DISPLAY = ABAP_FALSE METADATA = ABAP_FALSE DATA = ABAP_TRUE ). SUBMIT ZMMRP070 WITH P_IMPORT = '' "radiobutton 传参要用‘’ WITH P_QUERY = '' WITH P_DATA = 'X' WITH S_MATNR IN S_MATNR EXPORTING LIST TO MEMORY AND RETURN. IF SY-SUBRC = 0. TRY. CL_SALV_BS_RUNTIME_INFO=>GET_DATA_REF( IMPORTING R_DATA = LR_PAY_DATA ). ASSIGN LR_PAY_DATA->* TO <LT_PAY_DATA>. CATCH CX_SALV_BS_SC_RUNTIME_INFO. MESSAGE `Unable to retrieve ALV data` TYPE 'E'. ENDTRY. ENDIF. CL_SALV_BS_RUNTIME_INFO=>CLEAR_ALL( ). CL_DEMO_OUTPUT=>DISPLAY_DATA( <LT_PAY_DATA> ).
2、使用memory
FIELD-SYMBOLS: <LT_DATA> TYPE TABLE, <L_DATA> TYPE DATA. DATA BEGIN OF ITAB_LIST OCCURS 0. INCLUDE STRUCTURE ABAPLIST. DATA END OF ITAB_LIST. DATA:BEGIN OF T_STR OCCURS 0, STR(20) TYPE C, END OF T_STR. DATA: BEGIN OF VLIST OCCURS 0, "这个调用程序ALV输出的长度要根据实际长度来确认 FILLER1(100) TYPE C, FIELD1(50) TYPE C, FILLER(50) TYPE C, FIELD2(50) TYPE C, FILLER3(50) TYPE C, END OF VLIST. DATA: STR1(100) TYPE C, STR2(100) TYPE C. CL_SALV_BS_RUNTIME_INFO=>SET( DISPLAY = ABAP_FALSE METADATA = ABAP_FALSE DATA = ABAP_TRUE ). SUBMIT RM07MLBD WITH WERKS IN S_WERKS WITH MATNR IN S_MATNR WITH DATUM IN S_BUDAT WITH LGBST = 'X' AND RETURN EXPORTING LIST TO MEMORY."TCODE:MB5B CALL FUNCTION 'LIST_FROM_MEMORY' TABLES LISTOBJECT = ITAB_LIST EXCEPTIONS NOT_FOUND = 4 OTHERS = 8. CALL FUNCTION 'LIST_TO_ASCI' EXPORTING LIST_INDEX = -1 TABLES LISTASCI = VLIST LISTOBJECT = ITAB_LIST EXCEPTIONS EMPTY_LIST = 1 LIST_INDEX_INVALID = 2 OTHERS = 3. IF SY-SUBRC = 0. READ TABLE VLIST INDEX 5. IF SY-SUBRC = 0 . SPLIT VLIST-FILLER1 AT '' INTO TABLE T_STR . "根据空格拆分 ENDIF. ENDIF. DELETE T_STR WHERE STR = ''. "删除空行 READ TABLE T_STR INDEX 3. IF SY-SUBRC = 0. WRITE: T_STR-STR. ENDIF. * TRY. * cl_salv_bs_runtime_info=>get_data_ref( * IMPORTING r_data = ls_data ). * ASSIGN ls_data->* TO <lt_data>. * CATCH cx_salv_bs_sc_runtime_info. * MESSAGE '无法读取ALV数据' TYPE 'E'. * ENDTRY. * cl_salv_bs_runtime_info=>clear_all( ). * IF <lt_data> IS ASSIGNED. * LOOP AT <lt_data> ASSIGNING <l_data>. ** MOVE-CORRESPONDING <l_data> TO gt_tab. ** APPEND gt_tab. * ENDLOOP. * ENDIF.
3、perform调用
待续。。。