‎2009 Jul 01 6:19 AM
Hi,
I am facing a strange problem with one of the select statements in a report. If the report is executed in foreground, the program is running succesfully, but if we schedule the same in background mode, the select statement is failed and no records are selected. But if we debug the background job, we see that the select works fine. I am facing problem only when executing the report completely in background.
Could some one help me in solving this problem?
Regards,
Phani.
‎2009 Jul 01 6:23 AM
How you drawn the conclusion that select statement is not working in background..??
Don't debug, just create some error log using messages if the select fails. I hope the issue is not select , it is something else.
‎2009 Jul 01 6:52 AM
Hi All,
Thanks for your replies.
If the select is failed, an error message is written to log.
Please find the select statement below:
SELECT cli_sincro FROM zeiwt121 INTO lv_cli_sincro
UP TO 1 ROWS
WHERE bukrs EQ f_dati-bukrs
AND vkorg EQ f_dati-vkorg
AND logsys EQ 'SINCRO'
AND kunnr EQ f_dati-kunnr.
EXIT.
ENDSELECT.
IF sy-subrc NE 0.
wa_ziv_wt_cust_data-cliente = '0000000'.
st_err_msg-cust_nbr = .
st_err_msg-msg_num = ca_047.
st_err_msg-msg_cls = ca_cls.
st_err_msg-var1 = 'KNB1'.
st_err_msg-var2 = f_kna1-kunnr.
st_err_msg-var3 = f_dati-bukrs.
APPEND st_err_msg TO tb_err_msg.
ENDIF.
Best Regards,
Phani
‎2009 Jul 01 6:59 AM
first thing : why are you using that 'EXIT' statement?
second thing: you can use select single if u are passing key fields to where clause in place of up to 1 rows.
‎2009 Jul 01 7:00 AM
that code was already developed by some one else and so i have not removed the exit statement.
I can not use select single as i am not using all the primary key fields.
Regards,
Phani
‎2009 Jul 01 7:03 AM
check if any fields have conversion routines added to it as addnumber or some fields, because u might be passing the values without preceding zeros and data base might not have zeros. vice-versa.
‎2009 Jul 01 7:41 AM
if i execute the program in foreground, its working fine.
Regards,
Phani
‎2009 Aug 12 1:08 AM
Hi Phani,
As per your all comments, there are no primary keys in the where clause. So, we should not use Select and Endselect. Use Select into table itab. based on any other fields we can filter retrieved data to single record whichever we want. If where clause fields are not Primary we can't tell how many times it is hitting on the database. In additional, as per code, EXIT statement also there. In background that may cause problems i think. Please go through the total code. Try to understand the complete functionality. If possible try to remove SELECT and ENDSELECT.
Thank you,
Balaji Peethani,
TANUKU.
‎2009 Jul 01 6:25 AM
‎2009 Jul 01 6:40 AM
Hi Sivapuram,
what error you are getting ?? Check out ST22 if you are getting any dump..
Some time if you are trying to select very large number of records then you may get dump for the select statment like DBIF_RSQL_INVALID_RSQL...
Provide more information about what error/dump you are getting..
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
ilesh Nandaniya
‎2009 Jul 21 6:23 PM
‎2009 Aug 11 10:14 PM
Phani,
What as the fix to the problem? we are also having a similar problem.
Thanks,
Gopi.