-
Notifications
You must be signed in to change notification settings - Fork 3
Format: Custom
Nuno Godinho edited this page May 20, 2019
·
3 revisions
Although abaK
already has several built-in formats, sometimes you may need to deal with constant data in a different format, like an existing legacy table. In order to accomplish that, you can implement new custom FORMAT
classes.
- Create a new class implementing interface
ZIF_ABAK_FORMAT
and implement both methodsCONVERT()
andGET_TYPE()
. - Use
ZCL_ABAK_FACTORY=>GET_CUSTOM_INSTANCE()
to get anabaK
instance with your new custom format.
(TODO)
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:
DATA: o_abak TYPE zif_abak,
o_format_custom TYPE REF TO zcl_my_custom_abak_format,
o_source TYPE REF TO zcl_abak_source_inline.
CREATE OBJECT o_source
EXPORTING
i_content = '[data goes here]'.
CREATE OBJECT o_format_custom.
o_abak = zcl_abak_factory=>get_custom_instance( io_format = o_format_custom
io_source = o_source ).
If you believe your format is generic and can be used by others, please consider contributing by proposing that your custom format is added to the abaK
repository.