1. If the address to be displayed or changed already exists, all the you have to do as an application developer is to correctly implement the method GET_ADDRESS_KEY of class CL_BSP_MODEL_ACCESS_ADDRESS in its own subclass CL_BSP_APPLICATION_ADDRESS.
The address controller will read the address, apply all the changes, and automatically save it at the SAVE event.
If the address to be maintained does not yet exist, there is a little more you must do. Basically follow these steps:
1. Before the address controller is called with the address to be created for the first time, you must create a temporary pointer to the address in the form of an address handle and/or person handle.
The application has to provide these handle(s) in the method GET_ADDRESS_KEY. Additionally, it has to provide DIALOG_MODE = 'CREATE' and the address group (and person group) of the new address using the method SET_DIALOG_MODE of the parameter class CL_BSP_ADDRESS_PARAMETERS.
2. Once the address has been inserted into the local BAS memory for the first time, the method ADDRESS_IS_CREATED will be called to notify the application. The application should store this information for each handle.
From now on, the application can provide DIALOG_MODE = 'CHANGE' in method SET_DIALOG_MODE.
3. During the method CHECK_BEFORE_SAVE of the applications process class, the application must first determine the final key for the parent object of the address to be created (if the parent object is newly created as well).
Then, the application must obtain an address number and/or person number for each address that has been inserted successfully, as noted in the previous paragraph. The address number and/or person number is obtained with the methods GET_ADRESS_NUMBER or GET_PERSON_NUMBER respectively. This number or these numbers have to be stored in the applications database tables.
From now on, this number or these numbers must be provided in method GET_ADDRESS_KEY whenever this address should be referred to.
The methods GET_ADRESS_NUMBER and GET_PERSON_NUMBER may only be called for addresses, for which the method ADDRESS_IS_CREATED has been called.
1. To undo changes made to an address, all you have to do is to call the method INITIALIZE_ADDRESS.
This should be done during the INITIALIZE method of the application. It does not matter which instance of the class CL_BSP_APPLICATION_ADDRESS is used.
1. To delete an address, all you have to do is to call the method DELETE_ADDRESS.
This should be done during the DELETE method of the application. It does not matter which instance of the class CL_BSP_APPLICATION_ADDRESS is used.