abapdynpro

How to change input fields disregard of mandatory fields?


I have a dynpro with several mandatory fields. Now, I want to implement a button that prefills those fields with suggested values. Further, another button should deactive certain input fields.

My problem is that the button actions are stopped by the empty mandatory fields. Is there a way to skip those validations, if a certain button has been pressend and acces the PAI - PBO handling?


Solution

  • You must execute your action before the mandatory checks bloc other changes.

    Instead of

    MODULE ... INPUT
    

    you can try

    MODULE ... AT EXIT-COMMAND
    

    Normally the AT EXIT-COMMAND allows you to leave the screen, even if the values are missing. But you can use it also to fill mandatory fields.

    After filling the mandatory field I would call again the screen to process PBO/PAI again. So the user can see the new changed values.


    One question: Could you also fill the values during PBO?

    Something like:

    MODULE ... OUTPUT.
     IF field is initial.
       field = default_value.
     ENDIF.