Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7134028
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

2008-02-21 16:16:42

REPORT  z_barry_test_fm_fs   .

TABLES: spfli.
DATA dbcnt TYPE sy-dbcnt.
DATA: itab TYPE spfli_tab.

SELECT * FROM spfli INTO TABLE itab UP TO 2 ROWS.
dbcnt = sy-dbcnt.
CALL FUNCTION 'Z_BARRY_TEST'.

*******************************************

FUNCTION z_barry_test.
*"----------------------------------------------------------------------
*"*"Local interface:
*"----------------------------------------------------------------------

*单个变量
  DATA: field(50).
  FIELD-SYMBOLS: .
  field = '(Z_BARRY_TEST_FM_FS)dbcnt'.
  ASSIGN (field) TO .
  WRITE .

*内表
  DATA: itab TYPE spfli.
  FIELD-SYMBOLS: TYPE spfli_tab.
  field = '(Z_BARRY_TEST_FM_FS)ITAB[]'.
  ASSIGN (field) TO .
  LOOP AT INTO itab.
    WRITE: / itab-carrid, itab-connid.
  ENDLOOP.

ENDFUNCTION.

 

v41dugu  发表时间:2008-03-27 12:35:46    

我有看过你的 "隔山打牛之通过FIELD-SYMBOLS取得另一个程序数据"  这个文章.. 里面你只是把用了当前的程序名字.  我有试过我运行一个程序A, 在选择屏幕停住, 然后我在另一个程序B里也用你的方法, 通过Field-symbol来访问,但是访问不到. 只有用本程序的名字,才可以访问... 只是可以做到动态的访问本程序的变量,并不能跨程序, 不知道你试过没有.  要跨程序使用,我只知道用memory的cluster来做

Blog作者的回复:
恭喜你答对了!

 
这样用有个条件,就是必须是在一个Program group内,或者他的additional program groups之间才行,两个程序间需要有关联的。
比如用的最多的地方是增强、Smartforms等。。
 
 
附:
Program group
An organizational unit of programs in the internal session. There is always a main program group and it is possible to have several additional program groups. Each program group has a main program. If an external call of a subroutine in a program belonging to a program group causes the framework program of the subroutine to be loaded, this is added to the program group. Loading function groups and loading class pools always leads to the creation of an additional program group. All programs of a program group share the interface work areas declared with TABLES, NODES and COMMON PART. Within a program group, CALL SCREEN can only be used to call the screens of the main program.
阅读(6765) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~