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

Select single mistake

rodrigo_paisante3
Active Contributor
0 Likes
821

Hi experts,

Poccess description:

The system run a job tha read a txt file, load the data in a internal table, verify the data with a select single(this is my problem) and if the data is not correct, it will generate a log error, with the same values used in select.

My job read a txt file and update a SAP table daily. ALWAYS read the file correctly, but when i do select single (to verify if the data is true) the select not found the data in the transparent table.

If i try the same process directly (runing direct by system, not job) run normaly.

my select routine:

SELECT SINGLE * FROM ztmm_camolin

WHERE numer = vg_numer

AND linha = tg_lin_entr-l_contr.

IF sy-subrc = 0.

....

ELSE.

MOVE: sy-uname TO tg_log-usuario,

sy-datum TO tg_log-data,

p_cdbas TO tg_log-divisao,

vg_numer TO tg_log-n_contr,

vg_nfnum TO tg_log-num_nf,

tg_lin_entr-l_contr TO tg_log-l_contr,

vg_kunnr TO tg_log-cliente.

MOVE 'Amostra não encontrada' TO tg_log-msg.

APPEND tg_log.

ENDIF.

7 REPLIES 7
Read only

Former Member
0 Likes
789

hi,

Either the values read from the internal table is not availble in the table or you have not passed the key fields to the WHERE condition

Siva

Read only

0 Likes
789

Hi Siva,

thanks.

They are key fields and the data exist in the table, but,

"some times" the select single do not return '0' in the sy-subrc, but if I test the same information on se16 I found the record.

Read only

0 Likes
789

Hi Rodrigo

Please check the fields(data elements for) numer and inha and check for any conversion routines...

Regards,

Arun

Read only

Former Member
0 Likes
789

Hi,

Check whether tg_lin_entr-l_contr is empty during runtime. If yes then rectify it.

You can try below code also:

SELECT count( * ) FROM ztmm_camolin

WHERE numer = vg_numer

AND linha = tg_lin_entr-l_contr.

IF sy-subrc = 0.

.

.

.

ELSE.

.

.

.

ENDIF.

Hope it helps,

Regards,

Amit

Message was edited by:

Amit Kumar

Read only

rodrigo_paisante3
Active Contributor
0 Likes
789

The variables is initiated ok!

In my else code never errors occurs. The program get the variables used in select and the proccess flow correctly, in the else. The log file is generate ok, with the correct info.

Sometimes the select single returns <> 0 (but the data exist!). Some days the job runs ok, no errors. others, this error in select single appears.

Read only

0 Likes
789

have you also checked if there is a difference between value unconverted and value converterd of the fielddata ??

in se16n when you search thourgh the table and click on 1 record you see on the left the converted value and on the right an non converted value . sometimes (especially with PS ) there can be a difference between those and with it also the way it reacts on an select .

Read only

rodrigo_paisante3
Active Contributor
0 Likes
789

Thanks to all,

I solve the problem.

I discover another job that was runing at the same time, doing the same validations... then, sometimes the first gets the data, sometimes the second. I discover it when i stopped the job yesterday and today i see the log with the full proccess, and discover the other job.

lol!