Application Development 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: 

Step loops

Former Member
0 Kudos

Hi All,

i have a requirement like the screen is made of Step loops and initially user want the step loops in the disable mode except one field and once he enter the value in that field corresponding row shold become enable, i have tried making with the loop at screen and mdify screen and if i set enable for one row its making the all rows as editable, so, please give me some remedy to avoid this problem ...

thanks,

Mahesh.

2 REPLIES 2

Former Member
0 Kudos

If I understand the requirement correctly, once the user enters a value in column 1, the remaining columns on the line should open, yes? If so, here's an example piece of code - main thing is to use the "modify screen" inside the pbo loop.

Jonathan

report zlocal_jc_step_loop_lock.                                                                                
data:                                                                
  g_col1(4)           type c,                                        
  g_col2(10)          type c,                                        
  begin of gt_data occurs 10,                                        
    col1              like g_col1,                                   
    col2              like g_col2,                                   
  end of gt_data.                                                                                
start-of-selection.                                                  
  call screen '9999'.                                                
*screen has a step loop with 2 columns, fields "g_col1" and "g_col2" 
* PROCESS BEFORE OUTPUT.                                             
*   LOOP.                                                            
*     MODULE D9999_PBO_LOOP.                                         
*   ENDLOOP.                                                         
*   MODULE D9999_PBO.                                                
*                                                                    
*PROCESS AFTER INPUT.                                                
*   LOOP.                                                            
*     MODULE D9999_PAI_LOOP.                                         
*   ENDLOOP.                                                         
*   MODULE D9999_PAI.                                                

*" PBO modules                                  
module d9999_pbo_loop output.                   
  perform d9999_pbo_loop.                       
endmodule.                                      
module d9999_pbo output.                        
  perform d9999_pbo.                            
endmodule.                                      
*" PAI modules                                  
module d9999_pai_loop input.                    
  perform d9999_pai_loop.                       
endmodule.                                      
module d9999_pai input.                         
  perform d9999_pai.                            
endmodule.                                                                                
*" Forms                                        
form d9999_pbo_loop.                            
* if the first column is empty, lock the second:
  clear: gt_data.                               
  read table gt_data index sy-stepl.            
                                                
  g_col1 = gt_data-col1.                        
  g_col2 = gt_data-col2.                        
  if g_col1 is initial.                         
    loop at screen.                                           
      if screen-name = 'G_COL2'.  "lock the second column      
        screen-input = '0'.                                   
        modify screen.                                        
      endif.                                                  
    endloop.                                                  
  endif.                                                      
endform.                                                                                
form d9999_pbo.                                               
  break-point. "just for demo                                 
endform.                                                                                
form d9999_pai_loop.                                          
*" Executed once for each row in the screen                   
  read table gt_data index sy-stepl.                                                                                
if sy-subrc is initial.                                     
    gt_data-col1 = g_col1.                                    
    gt_data-col2 = g_col2.                                    
    modify gt_data index sy-stepl.                            
  else.                                                       
    gt_data-col1 = g_col1.                                    
    gt_data-col2 = g_col2.              
    insert gt_data index sy-stepl.     
  endif.                               
                                       
endform.                               
                                       
form d9999_pai.                        
  break-point. "just for demo          
endform.                               
                 

Former Member
0 Kudos

Hi Mahesh,

Can you tell me how you fixed this issue. I am facing same problem.

I want to input enable/disable a field in step loop based on conditions.