(1) 调用其他程序:

   * Trigger the IDOC
SUBMIT zpcppmd001_idoc AND RETURN.

(2) 调用其他程序参数传递参数:

*当被调用的程序的屏幕有输入参数时: 

       SUBMIT zreport with p_param1 = 'value1'
with p_param2 = 'value2'. *当要传递一个内表到被调用的程序时,需要用SAP MEMORY或者ABAP MEMORY: *在调用的程序中:
EXPORT it_tab TO MEMORY 'Z_MEMORY'. *在被调用的程序中:
IMPORT T_ITAB FROM MEMORY 'Z_MEMORY'.

(3) RANGE表:

*Code used to populate 'select-options' & execute report
DATA: seltab type table of rsparams,
seltab_wa like line of seltab. seltab_wa-selname = 'PNPPERNR'.
seltab_wa-sign = 'I'.
seltab_wa-option = 'EQ'. * load each personnel number accessed from the structure into
* parameters to be used in the report
loop at pnppernr.
seltab_wa-low = pnppernr-low.
append seltab_wa to seltab.
endloop.
SUBMIT zreport with selection-table seltab
via selection-screen.

(4)其他情况:

*Submit report and return to current program afterwards 

SUBMIT zreport AND RETURN. 

*Submit report via its own selection screen 

SUBMIT zreport VIA SELECTION-SCREEN. 

*Submit report using selection screen variant 

SUBMIT zreport USING SELECTION-SET 'VARIANT1'. 
REPORT ZPPR0051.

TABLES:AUFM.

DATA: IT_SELTAB TYPE TABLE OF RSPARAMS,
IW_SELTAB LIKE LINE OF IT_SELTAB. SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-.
SELECT-OPTIONS: S_WERKS FOR AUFM-WERKS OBLIGATORY NO INTERVALS,
S_AUFNR FOR AUFM-AUFNR.
SELECTION-SCREEN END OF BLOCK BLK. *----------------------------------------------------------------------*
* START-OF-SELECTION.
*----------------------------------------------------------------------* START-OF-SELECTION. LOOP AT S_WERKS.
IW_SELTAB-SELNAME = 'S_WERKS'.
IW_SELTAB-SIGN = S_WERKS-SIGN .
IW_SELTAB-OPTION = S_WERKS-OPTION.
IW_SELTAB-LOW = S_WERKS-LOW.
APPEND IW_SELTAB TO IT_SELTAB.
ENDLOOP. LOOP AT S_AUFNR .
IW_SELTAB-SELNAME = 'S_AUFNR'.
IW_SELTAB-SIGN = S_AUFNR-SIGN .
IW_SELTAB-OPTION = S_AUFNR-OPTION.
IW_SELTAB-LOW = S_AUFNR-LOW.
IW_SELTAB-HIGH = S_AUFNR-HIGH.
APPEND IW_SELTAB TO IT_SELTAB.
ENDLOOP. SUBMIT ZPPR0015 WITH SELECTION-TABLE IT_SELTAB.

*---------------------------------------------------------------------------

、最普通的用法

*Code used to execute a report
SUBMIT Zreport. 、带select-options程序的Submit的用法 *Code used to populate 'select-options' & execute report
DATA: seltab type table of rsparams,
seltab_wa like line of seltab. seltab_wa-selname = 'PNPPERNR'.
seltab_wa-sign = 'I'.
seltab_wa-option = 'EQ'. * load each personnel number accessed from the structure into
* parameters to be used in the report
loop at pnppernr.
seltab_wa-low = pnppernr-low.
append seltab_wa to seltab.
endloop.
SUBMIT zreport with selection-table seltab
via selection-screen. 、带parameters程序的Submit的用法 *Code used to populate 'parameters' & execute report SUBMIT zreport with p_param1 = 'value'
with p_param2 = 'value'. 、其他情况 *Submit report and return to current program afterwards SUBMIT zreport AND RETURN. *Submit report via its own selection screen
SUBMIT zreport VIA SELECTION-SCREEN. *Submit report using selection screen variant
SUBMIT zreport USING SELECTION-SET 'VARIANT1'. *Submit report but export resultant list to memory, rather than
*it being displayed on screen
SUBMIT zreport EXPORTING LIST TO MEMORY.
* Once report has finished and control has returned to calling
* program, use function modules LIST_FROM_MEMORY, WRITE_LIST and
* DISPLAY_LIST to retrieve and display report. *Example Code (Retrieving list from memory)
DATA BEGIN OF itab_list OCCURS .
INCLUDE STRUCTURE abaplist.
DATA END OF itab_list. DATA: BEGIN OF vlist OCCURS ,
filler1() TYPE c,
field1() TYPE c,
filler() TYPE c,
field2() TYPE c,
filler3() TYPE c,
field3() TYPE c,
filler4() TYPE c,
field4() TYPE c,
filler5() TYPE c,
field5() TYPE c,
filler6() TYPE c,
field6() TYPE c,
filler7() TYPE c,
field7() TYPE c,
END OF vlist. SUBMIT zreport EXPORTING LIST TO MEMORY. CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = itab_list
EXCEPTIONS
not_found =
OTHERS = . CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
list_index = -
TABLES
listasci = vlist
listobject = itab_list
EXCEPTIONS
empty_list =
list_index_invalid =
OTHERS = . IF sy-subrc NE ''.
WRITE:/ 'LIST_TO_ASCI error !! ', sy-subrc.
ENDIF. 、Submit为后台执行 *Submit report as job(i.e. in background) data: jobname like tbtcjob-jobname value
' TRANSFER TRANSLATION'.
data: jobcount like tbtcjob-jobcount,
host like msxxlist-host.
data: begin of starttime.
include structure tbtcstrt.
data: end of starttime.
data: starttimeimmediate like btch0000-char1. * Job open
call function 'JOB_OPEN'
exporting
delanfrep = ' '
jobgroup = ' '
jobname = jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
importing
jobcount = jobcount
exceptions
cant_create_job =
invalid_job_data =
jobname_missing = .
if sy-subrc ne .
"error processing
endif. * Insert process into job
SUBMIT zreport and return
with p_param1 = 'value'
with p_param2 = 'value'
user sy-uname
via job jobname
number jobcount.
if sy-subrc > .
"error processing
endif. * Close job
starttime-sdlstrtdt = sy-datum + .
starttime-sdlstrttm = ''.
call function 'JOB_CLOSE'
exporting
event_id = starttime-eventid
event_param = starttime-eventparm
event_periodic = starttime-periodic
jobcount = jobcount
jobname = jobname
laststrtdt = starttime-laststrtdt
laststrttm = starttime-laststrttm
prddays =
prdhours =
prdmins =
prdmonths =
prdweeks =
sdlstrtdt = starttime-sdlstrtdt
sdlstrttm = starttime-sdlstrttm
strtimmed = starttimeimmediate
targetsystem = host
exceptions
cant_start_immediate =
invalid_startdate =
jobname_missing =
job_close_failed =
job_nosteps =
job_notex =
lock_failed =
others = .
if sy-subrc eq .
"error processing
endif.
程序间获取ALV数据的两种方法:
方法1:通过修改SUBMIT的目标程序,把内表EXPORT到内存,SUBMIT后IMPORT ,该方法需要修改目标程序,可以任意设置目标程序的中断点;

方法2:SUBMIT前屏蔽ALV GRID的显示,SUBMIT,然后调用CL_SALV_BS_RUNTIME_INFO=>GET_DATA_REF方法获取数据,该方法不需要修改目标程序,但不能设置目标程序的中断点,需显示ALV的函数执行完毕方可获取到数据。
 
示例:
START-OF-SELECTION.   

PERFORM GET_DATA.
*&———————————————————————* *& Form GET_DATA *&———————————————————————* * text
*———————————————————————-* * –> p1 text * <– p2 text *———————————————————————-* FORM GET_DATA. DATA:LS_DATA TYPE REF TO DATA. FIELD-SYMBOLS: <LT_DATA> TYPE TABLE, <L_DATA> TYPE DATA.
CL_SALV_BS_RUNTIME_INFO=>SET( DISPLAY = '' METADATA = '' DATA = 'X' ). SUBMIT ZMM000000 WITH ZBUDAT IN ZBUDAT AND RETURN. 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 'UNABLE TO RETRIEVE ALV DATA' TYPE 'E'. ENDTRY. CL_SALV_BS_RUNTIME_INFO=>CLEAR_ALL( ). LOOP AT <LT_DATA> ASSIGNING <L_DATA>. MOVE-CORRESPONDING <L_DATA> TO GT_TAB. APPEND GT_TAB. ENDLOOP. ENDFORM.

ABAP程序相互调用--SUBMIT的更多相关文章

  1. ABAP程序互调用:SUBMIT、CALL TRANSACTION、LEAVE TO TRANSACTION

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  2. ABAP 程序/接口调用其他程序的数据

    在ABAP遇到的业务场景中,可能会遇到一种情况,需要调用其他报表的数据来发送或者二次加工,这个时候又不想对源程序做大的改动.有以下几种思路解决. 1.修改源程序,将需要展示的数据存储到DB中,然后主程 ...

  3. [SAP ABAP开发技术总结]ABAP程序之间数据共享与传递

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  4. C程序与Lua脚本相互调用

    Lua脚本是一种可用于C程序开发/测试的工具,本篇介绍一下C程序与Lua脚本如何进行相互调用,更加详细的操作参见<Programing in Lua>.本文分为3个部分:1.Windows ...

  5. C 程序与 C++ 程序之间的相互调用

    因为 C 编译器编译函数时不带参数的类型信息,只包含函数的符号名字.如 void foo( int x ) , C 编译器会将此函数编译成类似 _foo 的符号,C 链接器只要找到了调用函数的符号,就 ...

  6. ABAP RFC远程调用

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  7. 多个Activity相互调用和Intent

    MainActivity.java和OtherActivity.java的相互调用 首先MainActivity.java是Android程序自带的,新建一个类OtherActiviy extends ...

  8. Java(JCo3)与SAP系统相互调用

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  9. Lua与C++相互调用

    {--1.环境--} 为了快速入手,使用了小巧快速的vc++6.0编译器 以及在官网下载了Lua安装包..官网地址{--http://10.21.210.18/seeyon/index.jsp--} ...

随机推荐

  1. IOS ITunesConnect 修改开发商名称

    ItunesConnect→ManagerApps→应用→Contact Us

  2. 深度观察:腾讯收购大众点评背景下的O2O大格局

    [亿欧导读] 腾讯入股大众点评获得20%股权,详情解读:①大众点评:独立自主为底线,要钱大于要流量:②腾讯:承认原生活服务O2O失败,丰富移动支付应用场景:③美团承受压力,拉手窝窝继续苦等买家:④BA ...

  3. CF Rook, Bishop and King

    http://codeforces.com/contest/370/problem/A 题意:车是走直线的,可以走任意多个格子,象是走对角线的,也可以走任意多个格子,而国王可以走直线也可以走对角线,但 ...

  4. CF 279A. Point on Spiral

    http://codeforces.com/problemset/problem/279/A 题意 :就是给你一个螺旋形的图,然后给你一个点,问从(0,0)点到这个点需要转几次弯,当然,是按着这个螺旋 ...

  5. php smarty 缓存和配置文件的基本使用方法

    smarty高级部分包括缓存机制和配置文件的调用 下面是代码实现: 文件一,配置文件: #全局变量 title="网站主页" content="一个网站的主体部分&quo ...

  6. ASP.NET MVC 入门3、Routing

    本系列文章基于Microsoft ASP.NET MVC Beta. 在一个route中,通过在大括号中放一个占位符来定义( { and } ).当解析URL的时候,符号"/"和& ...

  7. DHTMLX 前端框架 建立你的一个应用程序 教程(五)--添加一个表格Grid

    表格例子 样本如下: 我们这篇介绍的是dhtmlxGrid  组件. 它支持4种数据格式:XML, JSON, CSV, JSArray. 添加表格到布局的单元格中去: 1.使用attachGrid( ...

  8. Ember.js demo2

    <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-1 ...

  9. SQL Server 连接字符串和身份验证详解

    SQL Server .NET Data Provider 连接字符串包含一个由一些属性名/值对组成的集合.每一个属性/值对都由分号隔开.          PropertyName1=Value1; ...

  10. Java之关键字static和final的使用

    static 在Java中声明属性.方法时,可使用关键字static来修饰. 1.static变量       按照是否静态的对类成员变量进行分类可分两种:一种是被static修饰的变量,叫静态变量或 ...