Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

String and Split Function in ABAP

Hello,

I am working in SAP BI in Indra in Barcelona and I have a small problem. The point is that i have never programmed in ABAP so I hope someone can help me in that matter. In

the SAP Source-Sytem from where I am extracting the data there is a field with the name ZZFILE_NAME. The content of this field is for example (I post 2 Examples) is the

following data:

Example 1: u201C /home_dev/x11/Electricidad/0024/Alta/A1/0024_A1_01_01_20080522_ES0031406938784737AY0F_200800000001.xml u201D

or

Example 2: u201C /home_dev/x11/Gas/No_GND/0230/A1_SCTD_GC_0031_0230_02_20080526_100721.xml u201D

I just need to import into the Business Warehouse System the content of the data after the last slash. So in the case of the ExamplesI I just need:

Example 1:

u201C0024_A1_01_01_20080522_ES0031406938784737AY0F_200800000001.xmlu201D

or

Example 2:

u201CA1_SCTD_GC_0031_0230_02_20080526_100721.xmlu201D

Between the Data Source and the first Table of the Data Store Object in the Datawarehouse of SAP BI there is the following Transfer Routine I have to change. Anybody can

help me in that matter?

The transfer-Routine actually is like the following code. What do I have to change there? Anybody can give me some hints?

PROGRAM trans_routine.

-


CLASS routine DEFINITION

-


*

-


CLASS lcl_transform DEFINITION.

PUBLIC SECTION.

Attributs

DATA:

p_check_master_data_exist

TYPE RSODSOCHECKONLY READ-ONLY,

Instance for getting request runtime attributs;

Available information: Refer to methods of

interface 'if_rsbk_request_admintab_view'

p_r_request

TYPE REF TO if_rsbk_request_admintab_view READ-ONLY.

PRIVATE SECTION.

TYPE-POOLS: rsd, rstr.

Rule specific types

TYPES:

BEGIN OF tys_SC_1,

Field: ZZFILE_NAME File URL.

ZZFILE_NAME TYPE C LENGTH 255,

Field: RECORD.

RECORD TYPE RSARECORD,

END OF tys_SC_1.

TYPES:

BEGIN OF tys_TG_1,

InfoObject: ZCSWFILEN NOMBRE FICHERO XML MENSAJE.

/BIC/ZCSWFILEN TYPE /BIC/OIZCSWFILEN,

END OF tys_TG_1.

$$ begin of global - insert your declaration only below this line -

... "insert your code here

$$ end of global - insert your declaration only before this line -

METHODS

compute_ZCSWFILEN

IMPORTING

request type rsrequest

datapackid type rsdatapid

SOURCE_FIELDS type tys_SC_1

EXPORTING

RESULT type tys_TG_1-/BIC/ZCSWFILEN

monitor type rstr_ty_t_monitor

RAISING

cx_rsrout_abort

cx_rsrout_skip_record

cx_rsrout_skip_val.

METHODS

invert_ZCSWFILEN

IMPORTING

i_th_fields_outbound TYPE rstran_t_field_inv

i_r_selset_outbound TYPE REF TO cl_rsmds_set

i_is_main_selection TYPE rs_bool

i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set

i_r_universe_inbound TYPE REF TO cl_rsmds_universe

CHANGING

c_th_fields_inbound TYPE rstran_t_field_inv

c_r_selset_inbound TYPE REF TO cl_rsmds_set

c_exact TYPE rs_bool.

ENDCLASS. "routine DEFINITION

$$ begin of 2nd part global - insert your code only below this line *

... "insert your code here

$$ end of 2nd part global - insert your code only before this line *

-


CLASS routine IMPLEMENTATION

-


*

-


CLASS lcl_transform IMPLEMENTATION.

METHOD compute_ZCSWFILEN.

IMPORTING

request type rsrequest

datapackid type rsdatapid

SOURCE_FIELDS-ZZFILE_NAME TYPE C LENGTH 000255

EXPORTING

RESULT type tys_TG_1-/BIC/ZCSWFILEN

DATA:

MONITOR_REC TYPE rsmonitor.

$$ begin of routine - insert your code only below this line -

... "insert your code here

fill table "MONITOR" with values of structure "MONITOR_REC"

to make monitor entries

... "to cancel the update process

raise exception type CX_RSROUT_ABORT.

... "to skip a record

raise exception type CX_RSROUT_SKIP_RECORD.

... "to clear target fields

raise exception type CX_RSROUT_SKIP_VAL.

RESULT = .

$$ end of routine - insert your code only before this line -

ENDMETHOD. "compute_ZCSWFILEN

-


Method invert_ZCSWFILEN

-


*

This subroutine needs to be implemented only for direct access

(for better performance) and for the Report/Report Interface

(drill through).

The inverse routine should transform a projection and

a selection for the target to a projection and a selection

for the source, respectively.

If the implementation remains empty all fields are filled and

all values are selected.

*

-


*

-


METHOD invert_ZCSWFILEN.

$$ begin of inverse routine - insert your code only below this line-

... "insert your code here

$$ end of inverse routine - insert your code only before this line -

ENDMETHOD. "invert_ZCSWFILEN

ENDCLASS. "routine IMPLEMENTATION

Tags:
Not what you were looking for? View more on this topic or Ask a question