With the Custom Reusable Elements app, you can modularize your custom code and thus structure your custom code according to your requirements. The app is specifically designed for custom code reuse and supports your productivity and efficiency.

You can use the Custom Reusable Elements app to:
- Create and edit custom libraries
- Create and edit methods, along with the corresponding parameters
- Create structures
You can create structures to make your data management and access more efficient. To be able to work with structured data it is possible to define structures for a custom library which can then be used in the definition of method parameters.
- Create tables
You can create definitions of tables (like an ABAP table types for internal tables). They can be used for method parameters' typing.
- Create data objects (variables)
You create definitions of variables. These variables can be addressed in implementations. So there is not the need to define them repeatedly.
- Create custom code lists
To create custom libraries and methods proceed as follows:
- Open the Custom Reusable Elements app.
- Choose + (Add) to create a new custom library.
- Define a library name and a library ID for your new custom library. If not changed manually, the library ID will be derived from the custom library name. Then select Create.
- Choose + (Add) in the METHODS section to create a new method within your previously created custom library.
- Define a method ID and if required a description for your method. Proceed to the method details by selecting the method.
- Choose + (Add) to add parameters for your method.
- Define a parameter ID and, if required, a name for the parameter. Choose a parameter type that fits your method. Then select a technical type and define length and decimals if required.
- You can save the method as a draft or publish it. A method has to be published to enable you to proceed to the editor and enter custom code.
- Return to the Library Details and select the method ID to proceed to the editor.
- Choose Edit and enter your custom code.
- Choose Test to check your custom code for functional correctness.
Note
You cannot save or publish your custom code if it contains errors. - Publish your custom code and your method.

In the example shown, the method calc_discount_amount, from the custom library zz1_customer_functions_10, is called in a custom business object. The method parameters amount and discount are supplied with appropriate values. The returning parameter of the method is assigned to the variable customerinvoice10-discountamount_v.