Skip to content

Source: URL

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

The URL source type lets you fetch data from the internet via HTTP/HTTPS. You just need to provide it with an URL.

It is used for whenever your data is hosted in a remove web server.

How to use it

It is implemented in class ZCL_ABAK_SOURCE_URL 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-url
  i_content      = 'http://somewhere.com/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 CONTENT 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, 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-url
  i_content     = 'http://somewhere.com/constants.xml' ).
Clone this wiki locally