Beruflich Dokumente
Kultur Dokumente
view
Delegation:
Delegation allows a subtype to use its own defined methods as well as the original inherited methods from the standard
business object.
This is very important in terms of business aspect as it allows us to customize our standard business applications
effectively and improves the performance by means of re-usability.
In large business applications this concept of delegation plays a vital role considering its high level of re-usability brings
reduction in coding procedures as well as in testing or maintenance and in turn increases savings.
Redefinition:
Redefinition deals with customization of the standard business object methods by modifying / extending the subtype
methods.
Delegation is a pre-requisite for redefinition.
After entering into the delegation table menu "TOJTD", click on Edit and then on "New entries" push button.
This is the screen where the delegation has to be made. Note that the required business objects to be delegated must
be filled in the below manner.
Now, go back to the business object "ZDAVE_OBJT". Travel down the method node and check the two methods we are
concerned about.
After doing that, we can see the entries are transferred at the end of the list and the "tick mark" symbol disappears.
Go, step by step in redefining. Select one entry (method) at a time and click on the redefine button as shown below.
Check below.
Now, double-click the method (say) "delete" and travel to the "ABAP" window, where we get to know the function
module called by this method.
It's a standard one which we do not want to change. Hence, we use our custom BAPI
Before quitting the function group, properly activate it by making sure it is error free.
Confirm with the declarations that are generated automatically in the source code window of the function module.
These are the declarations in the "include" for global data in the function group.
Here is the BDC program. Observe the indications in the below code.
FUNCTION zdave_material_delete.
*"---------------------------------------------------------------------*"*"Local Interface:
*" IMPORTING
*" VALUE(MATERIAL) TYPE BAPIMATALL-MATERIAL
*" VALUE(MATERIAL_EVG) TYPE BAPIMGVMATNR OPTIONAL
*" VALUE(SALESORGANIZATION) TYPE VBAK-VKORG
*" VALUE(DISTRIBUTIONCHANNEL) TYPE VBAK-VTWEG
*" VALUE(FLAG) TYPE BAPIMATALL-DEL_FLAG
*" EXPORTING
*" VALUE(DELETION_FLAG) TYPE BAPIMATALL-DEL_FLAG
*" TABLES
*" RETURN STRUCTURE BAPIRET2
*"----------------------------------------------------------------------
'0100'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RM03G-VTWEG'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'RM03G-MATNR'
material.
PERFORM bdc_field
USING 'RM03G-VKORG'
salesorganization.
PERFORM bdc_field
USING 'RM03G-VTWEG'
distributionchannel.
'0111'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RM03G-LVOMA'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field
'0100'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RM03G-VTWEG'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'RM03G-MATNR'
material.
PERFORM bdc_field
USING 'RM03G-VKORG'
salesorganization.
PERFORM bdc_field
USING 'RM03G-VTWEG'
distributionchannel.
PERFORM bdc_dynpro
USING 'SAPMM03G'
'0111'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RM03G-LVOMA'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field
Here, we call the sub-routines (performs) for the BDC in the function module. The above sub-programs located in
To release the function module enter the RFC function module name in SE37.
Click on Function module > Release --> Release
6. Creating parameters for methods
Go back to our custom business object and create the parameters for the method.
It can be observed that it contains the parameters of the standard business object. But, to access the functionality
provided in the function module created, we need to add those parameters here. Follow the steps below.
Enter the table name and select the two entries (Sales Organization and Distribution Channel) which are mentioned in
the list and "OK".
Then we are prompted to enter the creation details, where it is needed to enable "Import" attribute and click "OK".
Similarly it is necessary for Distribution channel. Follow same step.
Check for the entries that have been created. These entries are just created but not linked with the parameters in the
function module. Follow the below step by entering the name of the parameter in the function module we have used.
We need to double-click the entry.
But, here we want the value to be exported, so check the export option.
Here, there is no need to modify any code, but check for errors, in case if any. Don't forget to save
Go back and Implement the method "Delete" as prompted by dialog click on "Yes" for generating automatic template
,
Confirm with the declarations mentioned below as well as the parameters in the calling of the function module. If any
missing ones, please include them manually. Check for errors (Syntax check) and finally save
Now, we need to "implement" the methods which we have "Redefined" as well as the key field. In general, it is
recommended to follow a particular convention while implementing the components of a business object.
Now, to implement a business object type completely we need to "Implement" in the below way.
Edit > Change Release Status > Object Component > To Implemented
9. Release Convention (Releasing object type and Methods)
Similarly, for "releasing" the components it is necessary to follow the convention below.
Edit > Change Release Status > Object Component > To Released
After "releasing" the object type as well as the object component, make sure that released "symbol" is there.
At the end after the object is ensured "error free", don't forget to "Generate" the object.
.....