10-15-2007 12:54 PM
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.
10-15-2007 1:02 PM
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
10-15-2007 1:14 PM
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.
10-15-2007 1:17 PM
Hi Rodrigo
Please check the fields(data elements for) numer and inha and check for any conversion routines...
Regards,
Arun
10-15-2007 1:09 PM
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
10-15-2007 1:56 PM
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.
10-15-2007 2:17 PM
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 .
10-16-2007 12:21 PM
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!