-
Notifications
You must be signed in to change notification settings - Fork 3
Source: Custom
Nuno Godinho edited this page May 20, 2019
·
2 revisions
Although abaK
already has several built-in sources, sometimes you may need to fetch your constants data from a different place. In order to accomplish that, you can implement new custom SOURCE
classes.
- Create a new class inheriting from
ZCL_ABAK_SOURCE
and implement the following methods:-
CONSTRUCTOR
with the specific parameters and logic it may require (if needed); - Protected method
LOAD()
which should produce the data and return it inR_CONTENT
as aSTRING
; -
GET_TYPE()
.
-
- Use
ZCL_ABAK_FACTORY=>GET_CUSTOM_INSTANCE()
to get anabaK
instance with your new custom content.
Get a reference to a ZIF_ABAK
instance using the factory's method specific for custom objects GET_CUSTOM_INSTANCE()
. Check Instantiating abaK to learn more about this. Here's an example for a custom ZCL_XYZ_ABAK_SOURCE
which returns XML data:
DATA: o_abak TYPE zif_abak,
o_xyz_source TYPE REF TO zcl_xyz_abak_source,
o_format TYPE REF TO zif_abak_format.
CREATE OBJECT o_xyz_source
EXPORTING
i_param1 = '1'. " Random example for demonstration purposes
o_format = zcl_abak_format_factory=>get_instance( zif_abak_consts=>format_type-xml ).
o_abak = zcl_abak_factory=>get_custom_instance( io_format = o_format
io_content = o_xyz_source ).