How object oriented designs was beneficial to me as well as my clients while enhancing development created in Object Oriented ABAP.
I have been fan of object oriented design and trying to use them where ever I can for a long time now. Today I will walk you through one of development which I initially developed in OO ABAP and let on was able to extend that very easily.
I developed a shop floor cockpit. This involved few screens and functionality of issuing components for serialized build and for non serialized build as well. Cockpit also allowed to confirm the operations. At last when all operations are confirmed, good receipt should take place.
Shop floor is integral part of Production Planning where raw materials are consumed (e.g. circuit boards, screens, software) to build a finished goods (iPhone, iPad, Cell Phone, Laptop, etc.). Operator on Shop floor performs operations in the sequence. Raw components are consumed based on the operations. Once FG is built, checked (QA) and tested ok, it would be issued to a different location (e.g. warehouse) to ship to Customers.
To implement this requirement, I created basically four classes:
- Static class with all methods for BAPI calls
- Order details class
- Operation class
- Serial number class
Order class would have many serial numbers and serial number would have many operations. Serial number is the inital class which would get instantiated. Based on this fact I have created my classes which are designed as per this UML:
When ever a SN is entered a new object for order and serial number would be instantiated. Based on completed Operations and current operation to be performed, SN would have Operation objects.
After this the new requirement came in to create another version of cockpit which would be used by SME to correct components, cancel operations, display all operations and so on.
The new version of the UML looks something similar to this:
Example operation cancellation
To achieve this it was so easy. I inherited a sub class for all of my existing classes. This gave me default access to all attributes of those classes. I had used Singleton Design Pattern. I changed the method GET_DATA to give me instance of the object based on the transaction type.
I added another method in the class operation to do the cancellation. I left the blank implementation. I redefined this method in the class for SME. This allowed me the flexibility to call this method without thinking which transaction is running.
When I started building the design blocks for this it was definitely challenging. I could have used FM based approach but I decided to use OO ABAP as I have been doing always. This gave me great degree of flexibility as well as I was able to minimize the impact on existing design.
I would always suggest you to leverage OO ABAP where ever you can. You never know what is in future for that development. Whoever would be touching that again would definitely appreciate all your efforts. I guarantee
More from Case Studies
Learn more from the Case Studies on OO ABAP and other technique usage: