In Part III, we displayed a simple output with multiple lines as output. If you check the initial screen, it has the input fields, dates, execute button and the output table structure. In acutal project, user would not like to see the blank output table structure. Also, user would like to get an error message if the mandatory fields are missing. Let’s move on to the Web Dynpro. Part IV.
In this post, Web Dynpro. Part IV, we would show, how to declare the UI elements as mandatory and also how to show the output elements (in this case the output table) only when it is needed, dynamically.
On your mark, get set, go….
A) Output table visibility to be dynamically controlled.
Check the blank output table with SO, Created no/by and SO Type. If you are the user, you would NOT like to see these structure, when you are in the initial screen.
Why is it displaying?
Because, we have hardcoded the UI element to be always visible (as shown in screen shot).
Arrangement:
Rather than hard coding it to noticeable, we ought to guide it toward a variable, which ought to be clear (bogus) when the client first enters the screen. When the client stirs things up around town button, that variable ought to be hailed (consistent with) demonstrate the perceivability.
How to do control the perceivability?
Stage 1: Characterize a setting hub (cardinality 1:1 ought to be sufficient) and characterize a property (say set_table_visible). This characteristic is our variable, which we would tie with the result table perceivability boundary.
Stage 2: Tie the perceivability property with set_table_visible trait as displayed in figure. Done!! The result design wouldn’t be noticeable at this point.
Stage 3: However, it wouldn’t be noticeable regardless of whether you hit execute. Since, you have not composed the rationale to set the trait to valid, when execute button is hit. In the strategy which is approached execute button, set the quality to valid, involving the enchanted wand as displayed in the screen capture.
Subsequent to eliminating the remarked lines, your code ought to look like beneath. You simply have to set the variable to ‘X’ or ABAP_TRUE. Just a single line of code must be composed as displayed in line 43 of screen capture.
Stage 4: Test it. Your result is noticeable just when you hit the Execute button.
B) Error message should be displayed if mandatory fields are not entered
Stage 1: Make the State property of the info field to “required”. This would put a little red bullet (*).
Start a designer, we expect our work is finished. Presently Web Dynpro. Part IV structure ought to deal with it consequently. However, we want to execute another step.
Stage 2: In the occasion controller technique which is set off by your button (ONACTIONEXECUTE for this model), we want to compose the beneath piece of code. Essentially, it calls standard strategy check_mandatory_attr_on_view and give the missing required fields message.
Web Dynpro. Part IV would show the message in default region. We can characterize our message region and show the message where we need in the screen.
Really take a look at the result.
Connect for code bit for Part III and Part IV in the Execute button strategy: OnActionExecute
To some degree V, we would perceive how we can show the equivalent plain result in ALV with Part Utilization.
Kindly let us know, assuming you face any issue in any of the means. We would love to expand them.
Many thanks for your time!!
YOU MAY BE INTERESTED IN
How to Create RAP business events in SAP BTP ABAP Environment ?
Epic Evolution of ABAP Programming