ITPub博客

首页 > 应用开发 > IT综合 > 怎样将一般datasource delta

怎样将一般datasource delta

原创 IT综合 作者:hyacintlqf 时间:2007-01-03 11:28:25 0 删除 编辑

这里说的一般数据源是能够在TCODE:FINF 中找到事件的,这是我的理解,比如说采购申请中的AA table.自己建的表是否能够建立自己的事件,这个还不知道,我在测试的时候没有测试成功.

1.1 Find a BTE to use for delta capture

1.2 Find a function module sample to copy

1.3 copy the function module

1.4 creat a datasource (RSO2),base on the db table ,example EBKN.

1.5modify the delta process type of the newly created dataSource to one that uses the delta queue.example.(report z_change_delta_process .


*P_DATAS DataSource
*P_DELTAP Delta Process for DataSource
parameters:
p_datas type roosource-oltpsource,
p_deltap type roosource-delta.
tables:
roosource.
data:
ls_roosource type roosource.
if p_datas(2) ne 'Z_'.
message 'The DataSource needs to begin with ''Z_''.' type 'E'.
endif.
select single * from roosource into ls_roosource
where oltpsource = p_datas
and objvers = 'A'.
if sy-subrc eq 0.
ls_roosource-delta = p_deltap.
update roosource from ls_roosource.
message 'The DataSource has been updated successfully.' type 'I'.
else.
message 'The DataSource entered is not valid, try again.' type 'E'.

endif ).

1.6 test the function.

Appendix:

function write to the queue .

Z_WRITE_TO_QUEUE
FUNCTION z_write_to_queue.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(I_DATASOURCE) TYPE ROOSOURCE-OLTPSOURCE
*" TABLES
*" I_T_DATA OPTIONAL
*"----------------------------------------------------------------------
* Developed by: Scott Cairncross
TYPE-POOLS:
sbiwa.
DATA:
- 15 -
l_exstruct TYPE roosource-exstruct,
l_initflag TYPE roosprmsc-initstate,
l_subrc TYPE sy-subrc,
lr_is_data TYPE REF TO data,
lr_es_data TYPE REF TO data,
lr_et_data TYPE REF TO data,
l_t_fields TYPE sbiwa_t_fields,
l_t_select TYPE sbiwa_t_select.
FIELD-SYMBOLS:
TYPE ANY,
TYPE ANY,
TYPE STANDARD TABLE.
* Check to see if Delta initialization has been performed.
SELECT SINGLE initstate FROM roosprmsc INTO l_initflag
WHERE oltpsource = i_datasource
AND rlogsys NE space
AND slogsys NE space
AND initrnr NE space.
* If initialization has taken place continue
IF sy-subrc EQ 0 AND l_initflag EQ 'X'.
* grab the extraction structure from roosource based on the
* datasource parameter input.
SELECT SINGLE exstruct FROM roosource INTO l_exstruct
WHERE oltpsource = i_datasource
AND objvers = 'A'.
CHECK sy-subrc = 0.
CREATE DATA lr_is_data LIKE LINE OF i_t_data.
ASSIGN lr_is_data->* TO .
CREATE DATA lr_es_data TYPE (l_exstruct).
ASSIGN lr_es_data->* TO .
CREATE DATA lr_et_data TYPE STANDARD TABLE OF (l_exstruct).
ASSIGN lr_et_data->* TO .
LOOP AT i_t_data ASSIGNING .
CLEAR .
MOVE-CORRESPONDING TO .
INSERT INTO TABLE .
ENDLOOP.
CALL FUNCTION 'EXIT_SAPLRSAP_001'
EXPORTING
i_datasource = i_datasource
i_isource = ''
i_updmode = ''
TABLES
i_t_select = l_t_select
i_t_fields = l_t_fields
c_t_data =
EXCEPTIONS
rsap_customer_exit_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'RSC1_TRFC_QUEUE_WRITE'
EXPORTING
i_isource = i_datasource
- 16 -
i_no_flush = 'X'
IMPORTING
e_subrc = l_subrc
TABLES
i_t_data =
EXCEPTIONS
name_too_long = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFUNCTION.
*---------------------------------------------------------------------*
* FORM abs_type_to_rel_type *
*---------------------------------------------------------------------*
* The purpose of this subroutine is to convert an absolute type *
* name into a relative type name. *
* *
*---------------------------------------------------------------------*
* --> TYPE_NAME *
*---------------------------------------------------------------------*
form abs_type_to_rel_type changing type_name.
data junk(100) type c.
split type_name at 'TYPE=' into junk type_name.

endform.

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/154907/viewspace-888055/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 小猪
请登录后发表评论 登录
全部评论
  • 博文量
    8
  • 访问量
    301710