cancel
Showing results for 
Search instead for 
Did you mean: 

How to check all mandatory fields in different UIBBs which are not active

former_member190928
Participant
0 Kudos

Hi FPM colleagues,

Thanks for your time in advance:).

We are using FPM to develop our application(Solution Manager) Now we get a requirement from user that they want fields mandatory property to be configurable according to their own business requirement.

The first idea coming up to us is that we create component configuration to change fields mandatory properties and apply them to FPM application configuration. And then check those fields validation by framework method:

    CALL METHOD cl_wd_dynamic_tool=>check_mandatory_attr_on_view

          EXPORTING

               view_controller = lo_api_controller.

Since mandatory fields are configurable and may exist in several UIBBs in different main views. The check method will not work if those UIBBs are never created(e.g. user didn't click it, then the instance will not exist and check will not work)

So the question is: how can I check all mandatory fields by this framework method(since user need it to be configurable) in a FPM application even some UIBBs are not active. Or maybe I can activate all UIBBs by code? Thanks a lot for any answer regarding this requirement:):)         

BR,

Steve

Accepted Solutions (1)

Accepted Solutions (1)

jens_boeckenhauer
Active Participant
0 Kudos

Hi Steve,

you need to distinguish between mandatory fields check on the UI (for which one can use the mentioned API or a flag in the the FPM General Settings for the Form in 7.02+) and a check in the underlying business logic.

The check on the UI can only be processed for visible views / UIBBs. So you can never rely on the UI check only, i.e. it is generally necessary that the business logic does additional checks about the data consistency. This check should be processed at least when the data shall be saved (and let it fail if required fields are not filled) The UI check can be added for the user's convenience and it works as a pre-check which also points to the void (visible) fields.

Regards

Jens

former_member190928
Participant
0 Kudos

Hi Jens,

Thanks for your reply. We totally agree your suggestion and that's what we do, for the key fields, we will check them if they are valid in the back end whatever user set it is mandatory or not.

The question is what you mentioned vibisble views/UIBBs. Does "visible" mean at least visible for once? If yes, then is there any possibility that we can create UIBBs' instance(which visible really do as per my understanding) by our code internally? Then the standard mandatory check API or setting on FPM will work of my thought.

BR,

Steve

jens_boeckenhauer
Active Participant
0 Kudos

Hi Steve,

for the WD check by API (the code example you gave above) the view must indeed by visible.

If you do the checks programmatically in the UIBBs (or feeder classes) in e.g. PROCESS_EVENT, then you could get such invisible UIBBs processed by subsequent FPM events, where you first add all the relevant UIBBs by application controller, do the checks in PROCESS_EVENT and let the event fail if the checks fail, and then remove such UIBBs in the second event. This way you could even achieve that the UIBBs with missing mandatory field input get automaitcally visible (since the event loop stops if the event fails).

So this is technically possible but I would recommend to carefully think about necessity of such a procedure as it may impact on performance if you process a larger number of UIBBs "under the carpet".

Best regards

Jens

former_member190928
Participant
0 Kudos

Hi Jens,

What do you mean add all the relevant UIBBs by application controller? How can I do that, using usage declaration and create the instance?

Maybe the word 'visible' make a little confused, sorry of that. Actually all main view are visible but some of them maybe not active in our business scenario. Look at below example:

1. User set up 2 main views(which contains a UIBB respectively) in a FPM application configuration.

2. Both two main views have a mandatory field configured by component configuration(change the field state property to 'required' and applied to FPM application configuration.

3. User open this FPM application and will be navigate to the default main view 1. He input some basic information and click save button.

4. There still a mandatory field in main view 2 but user never get into that view so the UIBB instance will never be created by FPM framework.

5. That cause the WDY check API not work in main view 2 since it is not even created. i.e. It cannot execute the implementation method of the event fired by application controller.

5. Save action will be done rather than failed.

How can I solve kind of this problem?...

BR,

Steve

jens_boeckenhauer
Active Participant
0 Kudos

Hi Steve,

By adding UIBBs I meant assigning an application controller in the floorplan config and in its implementation, calling ADD_UIBB methods in OVERRIDE_EVENT methods. Never instantiate UIBBs on your own. But for all this you can read the standard FPM cookbook documentation.

But from your last description I conclude anyway that your checks are done in the WD view, not in the FPM event loop methods. But in any case your backend should check the overall data consistency, and not only the data of the visible view 1. Hence the backend should indicate failure if mandatory fields of view 2 are not filled - no matter whether it has been visible or not. The SAVE event should fail in this case.

In any case you need mandatory checks in the business logic to be processed at least on the SAVE event. The view checks can only be in addition to it so that they can be processed quickly (without FPM roundtrip) for a visible view.

Regards

Jens


former_member190928
Participant
0 Kudos

Hi Jens,

I have tested your solution, it works well! Thanks a lot!

I am just thinking about what we both agree that backend code should also check the mandatory fields rather than rely on UI layer check by mentioned check API.

So I am thinking that if I can read the FPM application configuration and get all UIBBs' component configuration. And then find out all mandatory fields set up in all component configuration. And find out their binding properties to get all context attributes and their value to check if it is empty. If it can be done, then this issue could be perfectly solved...Do you think it is possible? I think it may doesn't relevant to FPM but Web Dynpro basis code....

BR,

Steve

jens_boeckenhauer
Active Participant
0 Kudos

Hi Steve,

I am not sure about your use case. Is the information which fields are mandatory and which are not only configured in the UI? Usually such information is derived from the backend which "knows" which input it needs to be filled. Then the UI field properties are either automatically set from the backend information or they are additionally configured. In any case the backend should be the source of truth, not the UI. What you described sounds vice versa. In thas case: It is possible to read GUIBB configurations at runtime, but I would not recommend this. If it is about freestyle WD components, this is indeed a pure WDA topic, but it will be hard to access non-instantiated components.

Regards,

Jens

former_member190928
Participant
0 Kudos

Hi Jens,

Thank you very much for your help and patience. I did some research and the main technical difficulty is that I cannot get the binding property since it is not stored in component configuration. And as per your suggestion, we will check mandatory in the backend rather than reply on the standard WDY check API on UI layer. So many thanks to you and it's really great for me to know more on FPM framework

BR,

Steve

Answers (0)