Dear experts,
I'm trying to convert a generic datasource to delta following steps in the "how to generic datasource with delta queue".
When copying the sample function module in SE37: Z_WRITE_TO_QUEUE, I got some errors like:
Field "I_DATASOURCE" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement .
I tried inserting:
I_datasource type roosource-oltpsource,
but then other errors appear, lake I_T_DATA field is unknown, seems the DATA statement is not complete, what could be happening? is the source code in the "how to" paper wrong then? my abap knowledge is pretty limited.
Thanks and regards!
Ana M.
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:
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:
<i_s_data> TYPE ANY,
<e_s_data> TYPE ANY,
<e_t_data> 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 <i_s_data>.
CREATE DATA lr_es_data TYPE (l_exstruct).
ASSIGN lr_es_data->* TO <e_s_data>.
CREATE DATA lr_et_data TYPE STANDARD TABLE OF (l_exstruct).
ASSIGN lr_et_data->* TO <e_t_data>.
LOOP AT i_t_data ASSIGNING <i_s_data>.
CLEAR <e_s_data>.
MOVE-CORRESPONDING <i_s_data> TO <e_s_data>.
INSERT <e_s_data> INTO TABLE <e_t_data>.
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 = <e_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
- 15 -
i_no_flush = 'X'
IMPORTING
e_subrc = l_subrc
TABLES
i_t_data = <e_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.