form 参数 传值 例子

来源:互联网 发布:神州数码 广州 知乎 编辑:程序博客网 时间:2024/06/10 03:00
 

1.传递一个内表到另一个form中

data: begin of  i_tab occurs 0,
      c1(10) type c,
      c2(10) type c,
 end of i_tab.

data: itb like i_tab,
      itae like i_tab occurs 0 with header line.
start-of-selection.
data itae2 like i_tab occurs 0 with header line.
  itb-c1 = '我是中国人'.
  itb-c2 = '我是美国人'.
  append itb to itae.

  itb-c1 = '1'.
  itb-c2 = '2'.
  append itb to itae.
  write: / '这是新的'.
  loop at itae.
    write:/ itae-c1,itae-c2.
  endloop.

  itb-c1 = '2'.
  itb-c2 = '2'.
  append itb to itae2.
  skip.
  data: p1 type String value '只是字符串',
        p2 type string value '还是字符串'.
  perform f_disdata tables itae[] itae2[] using p1 p2.
  perform f_ds tables itae[].

*&---------------------------------------------------------------------*
*&      Form  f_disdata
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->ITABLE     text
*----------------------------------------------------------------------*
form f_disdata tables fb like i_tab[] pb like i_tab[] using p1 p2.
  data p_t like i_tab occurs 0 with header line.
uline at /(146).
  write:/ '第一个内表的值'.
  loop at fb.
    write: / fb-c1,fb-c2.
  endloop.
  uline at /(146).
  write:/ '第二个内表的值'.
  loop at pb.
    modify pb.
    write: / pb-c1,pb-c2.
  endloop.
  uline at /(146).
  write:/ p1,p2.
endform.                    "f_disdata

form f_ds tables es like i_tab[].
skip.
uline at /(146).
write: / '另一个方法中的显示'.
loop at es.
  write:/ es-c1,es-c2.
endloop.
endform.

不全,还在更新中.