Chinaunix首页 | 论坛 | 博客
  • 博客访问: 176937
  • 博文数量: 31
  • 博客积分: 3000
  • 博客等级: 中校
  • 技术积分: 585
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-17 23:11
文章分类

全部博文(31)

文章存档

2011年(1)

2009年(18)

2008年(12)

我的朋友

分类:

2009-05-19 14:01:16

process web alv control more times in one view ( ONLY FOR DYNAMIC CONTENT )

you may met some problems at web alv when you click 'view' or 'edit' in one web alv several times .
when the columns changed at the next time, you will find, the alv appearance doesn't change !
the problem is from the dynamic node. when you process next time,the system still use the original node to do this.
so the appearance dont's change.I give a solution, which seems to be stupid, but it does work!
  1. we create a static function to create a number in one program sequence,like below:
---------------------------------------------------code----------------------------------------------
FUNCTION ZGET_NEXT_NUMBER_IN_ONE_APP.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  CHANGING
*"     REFERENCE(RANDOM) TYPE  N
*"----------------------------------------------------------------------

  STATICS R1(3) TYPE N.

  R1 = R1 + 1.
  RANDOM = R1 .
ENDFUNCTION.
-------------------------------------------------------------------------------------------------------
    2. in your application,create dynamic node name
-------------------------
  data: nname type string.
  DATA: RANDOM_NUMBER(3) TYPE N.
  CALL FUNCTION 'ZGET_NEXT_NUMBER_IN_ONE_APP'
    CHANGING
      RANDOM = RANDOM_NUMBER.
  CONCATENATE 'DTABLE' RANDOM_NUMBER INTO nname.
----------------------------------------
then create the dynamic table again! this is very important !
  ZCL_WD_ALV_DYNAMIC=>CREATE_NODEINFO_FROM_STRUCT(
      PARENT_INFO         = rootnode_info
      IS_MULTIPLE         = abap_true
      NODE_NAME           = nname
      STATIC_ELEMENT_RTTI = STATIC_ELEMENT_RTTI ).

* get instance of new node
  WD_COMP_CONTROLLER->MAIN_DYN_NODE = wd_context->get_child_node( name = nname ).
this node is the latest node for your processing .



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