I’ve had a problem assigning a newly created rental space (cut out of a poolspace) to an object group.
I solved it and want to blog it to prevent other real estate developers from running into this mess with assigning rental objects to an object group.
At first, I was trying my luck with CL_REBD_OBJ_ASSIGN_MNGR_BO. But due to the fact, that there is only a interface available with OBJASSTYPE = ’10’ (Contract=>Object Group),
OBJASSTYPE IMPLIFNAME GUIFMPBO XOBJASSTYPE
10 IF_REBD_OBJ_ASSIGN_MNGR_BO REBD_GUI_OBJASS_BO_PBO Vertrag => Objekt(gruppe)
11 REBD_GUI_OBJASS_BO_PBO Objektgruppe => Objekt (Object Group => Rental Object)
Later I discovered, that the GUI is using using the class CL_RECN_OBJ_ASSIGN_MNGR_CN to accomplish what I wanted to do.
At first, I was not able to apply a method to do just that with objasstype 11.
As you can see in the table, type 11 can only be handled in the GUI PBO Module. That’s why I wrote nearly a copy of the code I found there when I debugged the ‘+’ Button to add an object to the object group in the GUI.
Surprisingly there’s this simple insert_bus_object-method at the end of the code snippet that does the job.
Everything works fine in the insert_bus_object-method, it quits with sy-subrc = 0:
* I. Which object will be added?
* II. get allowed object information
* set valid from and valid to of assignment
* III. check if object already is present
*–> no entries in this table!
* delete generated entries
* if yes use current date for insertion…
* => it’s not true in my case, scroll down!
* MAIN RUN STARTS HERE *
lf_assignonlyinfo = abap_false.
* Insert Rental Space to Object Group
Checking the resulting contract with this rental space delivers in tab Objects the wanted hierarchy Object Group -> Rental Space.
Don’t forget to check_all, store and commit your data of the created contract object!
P.S.: I would have expected a method in the Object Group-Interface IF_REBD_OBJECT_GROUP or an Interface in TIVBDOBJASSTYPE like IF_REBD_OBJ_ASSIGN_MNGR_BO with OBJASSTYPE = 11 which does the job!