Additional Blogs by Members
Showing results for 
Search instead for 
Did you mean: 
Former Member

Dos and Don'ts in ABAP Webdynpro

  • Where to Store business logic?
  • How to simplify context reading / writing?
  • Use structure vs fields
  • Handle dropdown by key
  • Delete unwanted components

Where to Store business logic?

  • As beginners we do coding inside the respective controllers. We should be aware that it is wrong practice of coding . Webdynpro framework is based on  MVC (Model View Controller) architecture.
  • Model is the area to store the business logic which indicates separation of business logic and user view.
  • Assistance class represents the best example for model. We can put our business logic inside the assistance class and by attaching the assistance class , we can access those methods.
  • One more advantage would be reusability.


  • This way we can use business routines again or even change / copy assistance class for another purpose.


•  Instead of specifying the methods in view as shown below,


we could implement the assistance class and deploy methods through assistance class.

  • How to simplify context reading / writing?


  • About 60% or more of software costs is maintenance. The more code lines we have, the more maintenance costs are. Henceforth we need to reduce the lines of coding.
  • Mostly developers ignores the above fact by following standard way of generating code through code wizard.


  • In real time applications, we need to build multiple views and each view has to read ‘n’ number of context and nodes. Rather using 14 lines of code to read the context and nodes, we can achieve the same in 2 lines of code as given below.


  • This is achieved by integrating a helper class and using it to read the context.

  • We need to initialize the helper class in WDDOINIT method as given below.


  •   Use structure vs fields


  • It is simpler to use complex structure instead of using individual fields.




  • Without Structure, it took 15 lines and with structure the same will take only 3 lines as shown below.



  • Handle dropdown by key


  • Experts advice not to use drop down by key. In unavoidable scenarios, we can handle the dropdown by key through optimization.
  • WD4A engines fills automatically the dropdown by key fields whose domain values are directly associated.
  • If domain values are not directly associated with the field, then WD4A does not fill dropdown by key field values automatically.
  • We have to call set_attribute_value_set of if_wd_context_node_info what we find by calling get_node_info


  • We can further optimize the code by using helper class as given below.


  • Delete unwanted components


  • Delete the webdynpro components which are no longer required.
  • IF_wd_component_usage=>delete_component.
  • Unwanted nodes can be deactivated by using <node_name>->invalidate().


1 Comment