Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3118031
  • 博文数量: 238
  • 博客积分: 864
  • 博客等级: 军士长
  • 技术积分: 2940
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-08 23:01
个人简介

WeChat: cj_william / Mail: william.chen.cn@outlook.com

文章分类

全部博文(238)

文章存档

2018年(2)

2016年(35)

2015年(47)

2014年(104)

2013年(38)

2012年(12)

分类: IT职场

2013-02-17 11:42:45

功能代码的重用是个老生常谈的话题,ABAP代码中实现程序的调用以及调用时数据参数的传递又是怎样的呢

(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) 更复杂一点的可以用文件临时存储数据:

 带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.
 
其他情况
*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'.

 

阅读(9351) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~