Skip to content

Source: File

Nuno Godinho edited this page May 20, 2019 · 1 revision

The FILE source type lets you fetch data from a file stored in the application server. You just need to provide it with an file path.

How to use it

It is implemented in class ZCL_ABAK_SOURCE_FILE but you probably won't ever need to know this.

DATA o_source TYPE REF TO zif_abak_source.

o_source = zcl_abak_source_factory=>get_instance(
  i_source_type = zif_abak_consts=>source_type-file
  i_content     = '/data/proj1/constants.txt' ).

And then you feed it to ZCL_ABAK_FACTORY=>GET_CUSTOM_INSTANCE() together with a FORMAT capable of interpreting that data format.

Use GET_CUSTOM_INSTANCE() only if really needed

Using custom components is the only situation in which you need to explicitly instantiate these classes. If you're using built-in SOURCE and FORMAT types, this will be automatically done for you by the other factory static methods.

Bear in mind that, if the data is in XML or CSV format then abaK built-in components are already compatible with it. In that case it will be much easier to do this:

DATA: o_abak TYPE REF TO ZIF_ABAK.

o_abak = zcl_abak_factory=>get_instance(
  i_format_type = zif_abak_consts=>format_type-xml
  i_source_type = zif_abak_consts=>source_type-file
  i_content     = '/data/proj1/constants.xml' ).
Clone this wiki locally