-
Notifications
You must be signed in to change notification settings - Fork 3
Source: SO10
The SO10
source type lets you fetch data from an SAP Standard text. Those maintained with transaction SO10 (thus the name).
If for some reason you don't want to store your data in a database table you can always store it in an SO10 text. This is particularly suitable for cases in which the constants will vary according to the language.
It is implemented in class ZCL_ABAK_SOURCE_SO10
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-standard_text
i_content = 'TEXT1 ST EN' ).
The content parameter contains 3 parameters: TEXT1
, TEXTID
and LANGUAGE
. Only the first one is mandatory. The other two are option and and default to ST
and SY-LANGU
respectively. So this could also do:
o_source = zcl_abak_source_factory=>get_instance(
i_source_type = zif_abak_consts=>source_type-standard_text
i_content = 'TEXT1' ).
And then you feed it to ZCL_ABAK_FACTORY=>GET_CUSTOM_INSTANCE()
together with an FORMAT
class capable of interpreting that data format.
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, 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-standard_text
i_content = 'TEXT1 ST EN' ).