Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

problem with select statement in background mode

PS_1978
Active Participant
0 Likes
1,679

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.

11 REPLIES 11
Read only

Former Member
0 Likes
1,375

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.

Read only

0 Likes
1,375

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

Read only

0 Likes
1,375

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.

Read only

0 Likes
1,375

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

Read only

0 Likes
1,375

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.

Read only

0 Likes
1,375

if i execute the program in foreground, its working fine.

Regards,

Phani

Read only

0 Likes
1,375

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.

Read only

Former Member
0 Likes
1,375

Hi,

Could you post the code segment ?

Regards

Karthik D

Read only

Former Member
0 Likes
1,375

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

Read only

PS_1978
Active Participant
0 Likes
1,375

problem was with the where clause of the select

Read only

Former Member
0 Likes
1,375

Phani,

What as the fix to the problem? we are also having a similar problem.

Thanks,

Gopi.