‎2014 Sep 26 11:00 AM
hello,
I have developed a function module extractor but getting Zero records.
I have tried to debug the code and found out that there is record in E_T_DATA but not L_T_DATA.
what could be the reason.
E_T_DATA has 12 records and L_T_DATA has zero records. I guess the number of records should be equal based on the logic.
Thanks,
Bhat
‎2014 Sep 26 11:25 AM
Hi,
Can you provide the data types of the two structures. I think the E_T_DATA and L_T_DATA may not be the same.
‎2014 Sep 26 11:08 AM
Hi,
Why don't you use work Areas to move data?
also select single * into wa from ausp and finally append wa to lt_data.
Please try this and let me know if it helps.
Regards,
K.S
‎2014 Sep 26 11:25 AM
Hi,
Can you provide the data types of the two structures. I think the E_T_DATA and L_T_DATA may not be the same.
‎2014 Sep 29 7:51 AM
Hi,
The structures are same. below is the full code
E_T_DATA LIKE znotification.
lt_data TYPE znotification.
TABLES: znotification,
qmfe,
ausp,
qmel.
DATA: lt_data TYPE STANDARD TABLE OF znotification,
ls_data TYPE znotification.
* Auxiliary Selection criteria structure
DATA: l_s_select TYPE srsc_s_select,
l_objekt TYPE objnum.
* Maximum number of lines for DB table
STATICS: s_s_if TYPE srsc_s_if_simple,
* counter
s_counter_datapakid LIKE sy-tabix,
* cursor
s_cursor TYPE cursor.
* Select ranges
RANGES: r_qmnum FOR qmfe-qmnum.
* Initialization mode (first call by SAPI) or data transfer mode
* (following calls) ?
IF I_INITFLAG = SBIWA_C_FLAG_ON.
************************************************************************
* Initialization: check input parameters
* buffer input parameters
* prepare data selection
************************************************************************
* Check DataSource validity
CASE i_dsource.
WHEN 'ZNOT_DATASOURCE.
WHEN OTHERS.
IF 1 = 2. MESSAGE e009(r3).
ENDIF.
* this is a typical log call. Please write every error message like this
log_write 'E' "message type
'R3' "message class
'009' "message number
i_dsource "message variable 1
''. "message variable 2
* RAISE error_passed_to_mess_handler.
ENDCASE.
APPEND LINES OF i_t_select TO s_s_if-t_select.
* Fill parameter buffer for data extraction calls
s_s_if-requnr = i_requnr.
s_s_if-dsource = i_dsource.
s_s_if-maxsize = i_maxsize.
* Fill field list table for an optimized select statement
* (in case that there is no 1:1 relation between InfoSource fields
* and database table fields this may be far from beeing trivial)
APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
ELSE. "Initialization mode or data extraction ?
************************************************************************
* Data transfer: First Call OPEN CURSOR + FETCH
* Following Calls FETCH only
************************************************************************
* First data package -> OPEN CURSOR
IF S_COUNTER_DATAPAKID = 0.
* Fill range tables BW will only pass down simple selection criteria
* of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'QMNUM'.
MOVE-CORRESPONDING l_s_select TO r_qmnum.
APPEND r_qmnum.
ENDLOOP.
* Determine number of database records to be read per FETCH statement
* from input parameter I_MAXSIZE. If there is a one to one relation
* between DataSource table lines and database entries, this is trivial.
* In other cases, it may be impossible and some estimated value has to
* be determined.
OPEN CURSOR WITH HOLD s_cursor FOR
* SELECT (s_s_if-t_fields) FROM sflight
* WHERE carrid IN l_r_carrid AND
* connid IN l_r_connid.
SELECT qmel~qmnum qmel~qmart qmfe~posnr qmfe~fenum qmfe~fekat
qmfe~fegrp qmfe~otkat qmfe~otgrp qmfe~oteil qmfe~kzmla
FROM qmel
INNER JOIN qmfe ON qmel~qmnum = qmfe~qmnum
WHERE qmel~qmnum IN r_qmnum
AND ( qmel~qmart = 'A1' OR
qmel~qmart = 'A2' OR
qmel~qmart = 'A3' OR
qmel~qmart = 'A4').
ENDIF. "First data package ?
* Fetch records into interface table.
* named E_T_'Name of extract structure'.
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.
** Add object number in e_t_data.
LOOP AT e_t_data.
ls_data = e_t_data.
CONCATENATE e_t_data-qmnum e_t_data-posnr INTO ls_data-objek.
SELECT * FROM ausp INTO CORRESPONDING FIELDS OF ls_data
WHERE objek = ls_data-objek.
INSERT ls_data INTO TABLE lt_data.
ENDSELECT.
ENDLOOP.
REFRESH e_t_data.
e_t_data[] = lt_data[].
ENDIF. "Initialization mode or data extraction ?
ENDFUNCTION.
‎2014 Sep 29 8:01 AM
Hi,
Did you check whether ur select on AUSP has any data,I am not sure whether it is not appending data to ls_data and hence no data in lt_data.
Please check the same and let me know.
Regards,
K.S
‎2014 Sep 29 10:07 AM
‎2014 Sep 26 11:51 AM
Hi Bhat,
Can you tell us how you declared the two internal tables.
Regards,
Satish
‎2014 Sep 29 8:10 AM
Hi,
Don't Refresh the e_t_data(REFRESH e_t_data put in comments and check it.).
‎2014 Sep 29 8:55 AM
Did you checked what is SY- SUBRC value after INSERT command ? Here the issue is Data is not inserting into Internal table
Use below syntax -
INSERT line INTO itab1.
Thanks,
Venkatmani.
‎2014 Sep 29 10:07 AM
Hi Bhat,
In your initial post you have mentioned "E_T_DATA has 12 records and L_T_DATA has zero records". The last two lines of code deletes the data from E_T_DATA and moves the content of L_T_DATA to E_T_DATA, Please check why the L_T_DATA is not getting populated.Most probably the select from AUSP won't return any records.
Thanks,
Jino.