FUNCTION zvs_bapi_stxl.
*"----------------------------------------------------------------------
*"*"Interface local:
*" IMPORTING
*" VALUE(IV_INITIAL_LOAD) TYPE XFELD OPTIONAL
*" VALUE(IV_DATE_INITIAL) TYPE DATUM OPTIONAL
*" VALUE(IV_DATE_END) TYPE DATUM OPTIONAL
*" EXPORTING
*" VALUE(ET_STXL_BAPI) TYPE ZVS_STXL_BAPI_T
*"----------------------------------------------------------------------
TYPES: BEGIN OF ty_stxh,
tdobject TYPE stxh-tdobject,
tdname TYPE stxh-tdname,
tdid TYPE stxh-tdid,
tdspras TYPE stxh-tdspras,
tdldate TYPE stxh-tdldate,
tdltime TYPE stxh-tdltime,
END OF ty_stxh.
TYPES: BEGIN OF ty_stxl_raw,
clustr TYPE stxl-clustr,
clustd TYPE stxl-clustd,
END OF ty_stxl_raw.
DATA lt_stxl_raw TYPE STANDARD TABLE OF ty_stxl_raw.
DATA lt_stxh TYPE TABLE OF ty_stxh.
DATA lt_stxl TYPE TABLE OF stxl.
DATA lt_tline TYPE STANDARD TABLE OF tline.
FIELD-SYMBOLS: <stxl> TYPE stxl.
FIELD-SYMBOLS: <tline> TYPE tline.
DATA r_object TYPE RANGE OF tdobject.
DATA r_tdid TYPE RANGE OF tdid.
DATA r_date TYPE RANGE OF tdldate.
DATA ls_stxh LIKE LINE OF lt_stxh.
DATA ls_stxl_raw TYPE ty_stxl_raw.
DATA ls_stxl_bapi LIKE LINE OF et_stxl_bapi.
DATA ls_date LIKE LINE OF r_date.
"Select TVARV ranges
select_tvarv 'ZVSSTXL'.
get_tvarv_range 'TDOBJECT' r_object.
get_tvarv_range 'TDID' r_tdid.
"Check if TVARV is filled
CHECK r_object[] IS NOT INITIAL.
CHECK r_tdid[] IS NOT INITIAL.
IF iv_initial_load EQ 'X'.
SELECT tdobject
tdname
tdid
tdspras
tdldate
tdltime
INTO TABLE lt_stxh
FROM stxh
WHERE tdobject IN r_object
AND tdid IN r_tdid.
ELSE.
CHECK iv_date_initial IS NOT INITIAL.
IF iv_date_initial EQ iv_date_end.
ls_date-sign = 'I'.
ls_date-option = 'EQ'.
ls_date-low = iv_date_initial.
APPEND ls_date TO r_date.
ELSE.
ls_date-sign = 'I'.
ls_date-option = 'BT'.
ls_date-low = iv_date_initial.
ls_date-high = iv_date_end.
APPEND ls_date TO r_date.
ENDIF.
SELECT tdobject
tdname
tdid
tdspras
tdldate
tdltime
INTO TABLE lt_stxh
FROM stxh
WHERE tdobject IN r_object
AND tdid IN r_tdid
AND tdldate IN r_date.
"AND tdldate => iv_date_initial
"AND tdldate =< iv_date_end.
ENDIF.
"Check if there is at least one record
CHECK lt_stxh[] IS NOT INITIAL.
SORT lt_stxh BY tdobject tdname tdid tdspras.
SELECT *
INTO TABLE lt_stxl
FROM stxl
"PACKAGE SIZE 3000 "Verificar se esta clausula é necessária
FOR ALL ENTRIES IN lt_stxh
WHERE relid = 'TX'
AND tdobject = lt_stxh-tdobject
AND tdname = lt_stxh-tdname
AND tdid = lt_stxh-tdid
AND tdspras = lt_stxh-tdspras
AND srtf2 = '0'.
"ENDSELECT.
LOOP AT lt_stxl ASSIGNING <stxl>.
CLEAR ls_stxh.
READ TABLE lt_stxh INTO ls_stxh WITH KEY tdobject = <stxl>-tdobject
tdname = <stxl>-tdname
tdid = <stxl>-tdid
tdspras = <stxl>-tdspras BINARY SEARCH.
"Decompress text
CLEAR: lt_stxl_raw[], lt_tline[].
ls_stxl_raw-clustr = <stxl>-clustr.
ls_stxl_raw-clustd = <stxl>-clustd.
APPEND ls_stxl_raw TO lt_stxl_raw.
IMPORT tline = lt_tline FROM INTERNAL TABLE lt_stxl_raw.
CLEAR ls_stxl_bapi.
ls_stxl_bapi-tdobject = <stxl>-tdobject.
ls_stxl_bapi-tdname = <stxl>-tdname.
ls_stxl_bapi-tdid = <stxl>-tdid.
ls_stxl_bapi-tdspras = <stxl>-tdspras.
ls_stxl_bapi-srtf2 = <stxl>-srtf2.
ls_stxl_bapi-tdldate = ls_stxh-tdldate.
ls_stxl_bapi-tdltime = ls_stxh-tdltime.
CALL FUNCTION 'IDMX_DI_TLINE_INTO_STRING'
EXPORTING
it_tline = lt_tline
IMPORTING
ev_text_string = ls_stxl_bapi-longtext.
APPEND ls_stxl_bapi TO et_stxl_bapi.
ENDLOOP.
FREE lt_stxl.
ENDFUNCTION.
CALL "PUBLIC"."GET_REMOTE_SOURCE_FUNCTION_DEFINITION" ('<REMOTE SOURCER NAME>','BAPI.ZVS_BAPI_STXL',?,?,?);
CREATE VIRTUAL PROCEDURE ZVS_BAPI_STXL (
IN IV_DATE_END VARCHAR(8),
IN IV_DATE_INITIAL VARCHAR(8),
IN IV_INITIAL_LOAD NVARCHAR(1),
OUT ET_STXL_BAPI TABLE (
TDOBJECT NVARCHAR(10),
TDNAME NVARCHAR(70),
TDID NVARCHAR(4),
TDSPRAS NVARCHAR(1),
SRTF2 SMALLINT,
TDLDATE VARCHAR(8),
TDLTIME VARCHAR(6),
LONGTEXT NCLOB
)
) CONFIGURATION '
{
"__DP_UNIQUE_NAME__": "ZVS_BAPI_STXL",
"__DP_HAS_NESTED_PARAMETERS__": false,
"__DP_USER_DEFINED_PROPERTIES__": {},
"__DP_INPUT_PARAMETER_PROPERTIES_": [],
"__DP_RETURN_PARAMETER_PROPERTIES_": [],
"__DP_VIRTUAL_PROCEDURE__": true,
"__DP_HAS_INTERNAL_OUTPUT_PARMETER__": false,
"__DP_DEFAULT_OUTPUT_PARAMETER_INDEX__": 0
}' AT "<REMOTE SOURCE NAME>";
context ECCReplication {
entity ZSTXL {
key TDOBJECT: String(10);
key TDNAME_KEY1: String(70);
key TDNAME_KEY2: String(70);
key TDID: String(4);
key TDSPRAS: String(1);
key SRTF2: Integer;
TDLDATE: String(8);
TDLTIME: String(6);
LONGTEXT: LargeString;
} technical configuration {
fulltext index ZSTXL_LONGTEXT ON (LONGTEXT) FUZZY SEARCH INDEX ON SYNC;
};
};
CASE WHEN "TDOBJECT"='EKPO' OR "TDOBJECT"='ESLL' THEN LEFT("TDNAME",10) ELSE "TDNAME" END
CASE WHEN "TDOBJECT"='EKPO' OR "TDOBJECT"='ESLL' THEN SUBSTRING("TDNAME",11) ELSE '' END
START TASK "ESTACIOSCH"."FG_STXL" ("IV_DATE_INITIAL" => START_DATE, "IV_DATE_END" => END_DATE, "IV_INITIAL_LOAD" => IS_INITIAL_LOAD)
CALL "<SCHEMA NAME>"."FG_STXL_SP"(
IV_DATE_END => ''/*<NVARCHAR(8)>*/,
IV_DATE_INITIAL => ''/*<NVARCHAR(8)>*/,
IV_INITIAL_LOAD => ''/*<NVARCHAR(1)>*/
);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |