Search code examples
abapdynpro

How to enable a row in steploop based on checkbox?


I have been working on a report for a Handheld device with Steploops. The problem I am having is that I need to disable a qty field when a checkbox is checked but enable it again when it is unchecked.

enter image description here

The main problem right now is that on my Loop at Screen, I will see one row instead of them all and if I change it to Screen-active = '0'. It disables all the qty fields.

There is any idea I will apply to fix it?

After applying Phil answer it works as expected:

enter image description here


Solution

  • The trick is to call a module from the DYNPRO inside LOOP on the screen. Here is minimum style solution, by hand to illustrate the concept.

    PROCESS BEFORE OUTPUT.
      LOOP AT DATA_AREA_TAB  CURSOR current_line INTO data_area_rec.
           MODULE LOOP_INIT.
           MODULE DATA_AREA_TAB_SHOW.
      ENDLOOP.
    

    then inside the MODULE...

    You can read the current line so you know the content and adjust the field accordingly. Since it is called per line of dynpro it updates the current line.

    MODULE DATA_AREA_TAB_SHOW OUTPUT.  
    READ TABLE data_area_tab INTO data_area_rec INDEX current_line.
    
    LOOP AT SCREEN.
    
    IF screen-name = '???'.   " your rules here
    IF data_area_rec-VALUE  = '???'
        screen-invisible = '0'.
        screen-input = '1'.
      ELSE.
        screen-invisible = '1'.
        screen-input = '0'.
      ENDIF.
    ENDIF.
    
     MODIFY SCREEN.
    ENDLOOP.
    ENDMODULE.