After having read Stephen Kings “22-11-1963” on holiday, I couldn’t resist to put some “King” in the title of this blog.
Recently I’ve been working (more than I would prefer) with InfoSpokes & OpenHub’s and via this blog I want to share some of the issues I’ve tackled along the way.

Instead of using the traditional 2 step infospoke rocket:

    1. Create an APD (tcode RSANWB) to extract data via a query and populate a DSO
    2. Create an infospoke (tcode RSBO) to stage the “step 1 DSO”-data to an Open Hub target

it’s way more easier to use the OpenHub destination, as to be found in RSA1.


This OpenHub destination acts like a regular data target (Infoobject, DSO, Cube, etc) which can be populated by extracting data from a source(table) and staging it via a transformation.

Performance

For performance reasons I’ve stripped all before images from the incoming source package:

DELETE SOURCE_PACKAGE WHERE recordmode = 'X'.
CHECK NOT SOURCE_PACKAGE[] IS INITIAL.

 

Non repetitive headerlines
A header line was required for every OpenHub interface file. This header line may only occur once, even though the OpenHub processes more than 1 datapackage. The following piece of code prevents a repetitive headerline in case of multiple datapackages:


*- Within the CLASS routine DEFINITION section, place the following code:
CLASS-DATA: st_header_line TYPE c. " STATIC ATTRIBUTE

Place the following piece of code within the END-ROUTINE :

IF ST_HEADER_LINE IS INITIAL.
ST_HEADER_LINE = 'X'.
*- place headerline code here
ENDIF.

 

Non repetitive footer

A footer line was required for every OpenHub interface file. This footer line should contain the number of interfaces lines which have been processed and should only occur once, even though the OpenHub processes more than 1 datapackage. The following piece of code, which should be added to the end-routne, prevents a repetitive footerline in case of multiple datapackages:


call function 'RRSI_VAL_SID_SINGLE_CONVERT'
EXPORTING i_iobjnm = '0REQUID' i_chavl = request
IMPORTING e_sid = l_requid
EXCEPTIONS others = 9.
if sy-subrc <> 0.
message x051(rsar) with 'SID_ERROR_IN_START_ROUTINE'.
endif.


try.
data l_r_request type ref to if_rsbk_request.
l_r_request = cl_rsbk_request=>create_from_db( l_requid ).
data l_r_dp type ref to if_rsbk_dp.
l_r_dp = l_r_request->get_obj_ref_dp( datapackid ).
data l_last type rs_bool.
l_last = l_r_dp->get_last( ).


if l_last = 'X'. "rs_true.
*- Create additional TOTAL line
append wa_result to RESULT_PACKAGE.
endif.
catch cx_rs_not_found.
message x051(rsar) with 'DATAPACKAGE_ERROR_IN_START_ROUTINE'.
endtry.

 

Strip prefix of field content

When data contains prefix information (eg a source system identifier) and this prefix info needs to be ‘stripped’, the following code might be helpful:


result = SOURCE_FIELDS-CUST_SALES.
shift result left deleting leading '0'.
move result+2(10) to RESULT.