03-02-2010 4:52 PM
Hi;
I´m facing this problem, is a Z development that works ok in DEV client and in PRD client doesn't.
the problem is in a select sentece, this program has been running for a long time and sudenly it fails.
this is the select code original that started failing just yesterday:
SELECT * FROM mchb
WHERE matnr = t_eban-matnr AND
werks = t_eban-reswk AND "utilzar el centro suministrador no el werks
lvorm = ' ' AND "CHAR 1 0 Petición de borrado para datos (todos) de stock lotes
sperc = ' ' AND "CHAR 1 0 Indicador de bloqueo para inventario
clabs > 0. " sacar solo los lotes que tangan saldo.
here other sentences
ENDELECT.
this select in PRD client returns sy-subrc = 4, but when i browse the mchb table with se16 tcode it has data, i put the same matnr werks lvorm = '' sperc = '' and clbas > 0 and i get data.
so i decide to change a little bit the code, because i tryed recompilng the Z report in DEV a pass it to PRD again but it didn´t work.
this is the new code tha works ok in DEV client but not in PRD client:
SELECT * INTO TABLE tmchb FROM mchb
WHERE matnr = t_eban-matnr AND
werks = t_eban-reswk AND "utilzar el centro suministrador no el werks
lvorm = '' AND "CHAR 1 0 Petición de borrado para datos (todos) de stock lotes
sperc = '' AND "CHAR 1 0 Indicador de bloqueo para inventario
clabs > 0. " sacar solo los lotes que tangan saldo.
so, as can you see i just created an internal table TMCHB just to take the data in a table, but it displays sy-subrc = 4 again.
Any help.
David Fúnez
Corp. Mandofer
03-02-2010 5:07 PM
Without the rest of the code it's dificult to see what is the problem, the coding seems ok so could you please give more details, for example, the select from EBAN.
03-02-2010 5:22 PM
The t_eban table has no problem, it has data.
before the select there is a LOOP to the t_eban table to look for tha MATNR in MCHB.
LOOP AT t_eban.
SELECT * INTO TABLE tmchb FROM mchb
WHERE matnr = t_eban-matnr AND
Thanks on advance
03-02-2010 5:26 PM
Yes, i figured that you were doing it in a loop and there would be data in it, otherwise it wouldn't reach that select. Anyway the suggestion to use for all entries instead of the select inside a loop is good and you should consider it, but still doesn't seem to be the cause of the problem. You could try changing the where clause a bit, sometimes = ' ' can be tricky, try something like
...
LVORN NE 'X' and
SPERC not in ('X','A')
...
this just to see if it returns anything. If this doesn't work, then my guess is that there is a problem with the indexes and you might want to talk to administration to recreate the indexes on that table.
Edited by: Pedro Guarita on Mar 2, 2010 5:30 PM
03-02-2010 5:26 PM
I personally dont like select * from <dbtab>
if you can use the fields you want.. that would be nice...
rather than select in side a loop, can you use for all entries of that table... that way some extent of your long run might be reduced.
03-02-2010 5:27 PM
hi,
it is a performance if we code select inside loop.
Instead of we can use forallentries.
Try to use the above code which i mentioned.
03-02-2010 5:18 PM
Hi,
Don't try to use Select and Endselect. Instead of why can not use FORALLENTRIES with SELECT Statement. It will optimize the performance.
Try the below code.
if t_eban is not initial.
SELECT * INTO TABLE tmchb FROM mchb
for all entries in t_eban
WHERE matnr = t_eban-matnr AND
werks = t_eban-reswk AND "utilzar el centro suministrador no el werks
lvorm = '' AND "CHAR 1 0 Petición de borrado para datos (todos) de stock lotes
sperc = '' AND "CHAR 1 0 Indicador de bloqueo para inventario
clabs > 0. " sacar solo los lotes que tangan saldo.
endif.
Edited by: subas Bose on Mar 2, 2010 6:18 PM
03-02-2010 5:36 PM
Hi,
Check how MATNR is stored in MCHB in production. (with/out leading zero's)
SELECT * FROM mchb
WHERE matnr = t_eban-matnr AND <-- make sure both variables are in sync If possible pad matnr with leading zeros ..
Regards,
Srini.
07-22-2010 7:45 PM