Skip to Content

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

function module on KONV

Hi there

Table konv is a cluster table.

I have already created a datasource on this table with an infoset linking it with ekko, but I expect to face performance issues as the table konv has many records.

Therefore I would like to create a function module linking knumv from ekko and konv.

Here is what i have done but when create the datasource i am getting an error. Could you please provide your help in solving this issue. Thanks in advance.

TABLES: konv.

DATA: l_s_select TYPE srsc_s_select.

STATICS: s_s_if TYPE srsc_s_if_simple,

s_counter_datapakid LIKE sy-tabix,

s_cursor TYPE cursor.

RANGES: l_r_knumv FOR konv-knumv,

l_r_kposn FOR konv-kposn,

l_r_kschl FOR konv-kschl,

l_r_waers FOR konv-waers.

l_r_kntyp for konv-kntyp.

l_r_kruek for konv-kruek.

l_r_kwert for konv-kwert.

IF i_initflag = sbiwa_c_flag_on.

IF NOT g_flag_interface_initialized IS INITIAL.

IF 1 = 2. MESSAGE e008(r3). ENDIF.

log_write 'E' "message type

'R3' "message class

'008' "message number

' ' "message variable 1

' '. "message variable 2

RAISE error_passed_to_mess_handler.

ENDIF.

APPEND LINES OF i_t_select TO s_s_if-t_select.

s_s_if-requnr = i_requnr.

s_s_if-dsource = i_isource.

s_s_if-maxsize = i_maxsize.

g_s_interface-initflag = i_initflag.

g_s_interface-updmode = i_updmode.

g_s_interface-datapakid = i_datapakid.

g_flag_interface_initialized = sbiwa_c_flag_on.

APPEND LINES OF i_t_fields TO s_s_if-t_fields.

ELSE.

IF s_counter_datapakid = 0.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = ' KNUMV'.

MOVE-CORRESPONDING l_s_select TO l_r_knumv.

APPEND l_r_knumv.

ENDLOOP.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'KPOSN'.

MOVE-CORRESPONDING l_s_select TO l_r_kposn.

APPEND l_r_kposn.

ENDLOOP.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'KSCHL'.

MOVE-CORRESPONDING l_s_select TO l_r_kschl.

APPEND l_r_kschl.

ENDLOOP.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'WAERS'.

MOVE-CORRESPONDING l_s_select TO l_r_waers.

APPEND l_r_waers.

ENDLOOP.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'kntyp'.

MOVE-CORRESPONDING l_s_select TO l_r_kntyp.

APPEND l_r_kntyp.

ENDLOOP.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'kRUEK'.

MOVE-CORRESPONDING l_s_select TO l_r_kruek.

APPEND l_r_kruek.

ENDLOOP.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'kWERT'.

MOVE-CORRESPONDING l_s_select TO l_r_kwert.

APPEND l_r_kwert.

ENDLOOP.

OPEN CURSOR WITH HOLD s_cursor FOR

SELECT (s_s_if-t_fields) FROM konv

WHERE knumv IN l_r_knumv AND

kposn IN l_r_kposn AND

kschl IN l_r_kschl AND

waers IN l_r_waers AND

kntyp IN l_r_kntyp AND

kruek IN l_r_kruek AND

kwert IN l_r_kwert.

ENDIF.

FETCH NEXT CURSOR s_cursor

APPENDING CORRESPONDING FIELDS

OF TABLE e_t_data

PACKAGE SIZE s_s_if-maxsize.

IF sy-subrc <> 0.

CLOSE CURSOR s_cursor.

RAISE no_more_data.

ENDIF.

s_counter_datapakid = s_counter_datapakid + 1.

ENDIF.

ENDFUNCTION.

Regards

Boujema

Former Member

Helpful Answer

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