Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Grouping fields

Former Member
0 Likes
346

Hi,

Why you group fields in modulepool program and how many modification is allowed per field?

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
329

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.

1 REPLY 1
Read only

Former Member
0 Likes
330

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.