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!
- 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) |