2007 Jul 08 11:46 PM
Hi,
Why you group fields in modulepool program and how many modification is allowed per field?
Thanks in advance.
2007 Jul 09 12:00 AM
Below is part of another answer I gave in another thread, plus some extra ideas.
Groups just give you a way of handling several fields at once, instead of having to specify one field at a time.
For example, rather than having to code:
loop at screen.
if screen-name = 'KNA1-KUNNR'
or screen-name = 'KNA1-NAME1'
or screen-name = 'KNA1-NAME2'
or screen-name = 'KNA1-NAME3'
or screen-name = 'KNA1-NAME4'
or screen-name = 'KNA1-ORT01'
or (etc etc etc) ....
* do something to field atttibutes
endif.
endloop.
You could set, say, group1 on all these fields to say "CUS" and code
loop at screen.
if screen-group1 = 'CUS'. "customer field
* do something to field atttibutes
endif.
endloop.
which is much more elegant.
As for the number of "modifications per field", there are four group fields but the ways you use then are only limited by your imagination e.g. you could use a separate bytes in each group to flag different things e.g.
loop at screen.
l_flag = screen-group1+0(1).
case l_flag.
when 'A'.
* do something to field atttibutes
* etc etc
endcase.
endloop.
2007 Jul 09 12:00 AM
Below is part of another answer I gave in another thread, plus some extra ideas.
Groups just give you a way of handling several fields at once, instead of having to specify one field at a time.
For example, rather than having to code:
loop at screen.
if screen-name = 'KNA1-KUNNR'
or screen-name = 'KNA1-NAME1'
or screen-name = 'KNA1-NAME2'
or screen-name = 'KNA1-NAME3'
or screen-name = 'KNA1-NAME4'
or screen-name = 'KNA1-ORT01'
or (etc etc etc) ....
* do something to field atttibutes
endif.
endloop.
You could set, say, group1 on all these fields to say "CUS" and code
loop at screen.
if screen-group1 = 'CUS'. "customer field
* do something to field atttibutes
endif.
endloop.
which is much more elegant.
As for the number of "modifications per field", there are four group fields but the ways you use then are only limited by your imagination e.g. you could use a separate bytes in each group to flag different things e.g.
loop at screen.
l_flag = screen-group1+0(1).
case l_flag.
when 'A'.
* do something to field atttibutes
* etc etc
endcase.
endloop.