04-23-2009 5:41 PM
Hi.
I have a external database in which I do the next query...
()
Data: cod_campana TYPE integer,
departament TYPE STRING.
EXEC SQL.
connect to 'EX_PP' as 'ex_pp'
ENDEXEC.
EXEC SQL.
set connection 'ex_pp'
ENDEXEC.
cod_campana = 272
departament = 'BKK' "-> This data it's variable
EXEC SQL.
OPEN c1 FOR
SELECT a.cod_modelo, a.nom_modelo2, a.cod_color, b.nom_color
FROM pro_modelos a ,con_color b
WHERE a.cod_modelo = b.cod_modelo
AND a.cod_campana = b.cod_campana
AND a.cod_color = b.numero
AND a.brand = :departament
AND a.cod_campana = :cod_campana
END EXEC
I obtain a dump and the reason it's in the phrase --> AND a.brand = :departament
When I execute the same query and don't put the variable --> AND a.brand = 'BKK' like this the program run correctly... and I don't obtain dump...
EXEC SQL.
OPEN c1 FOR
SELECT a.cod_modelo, a.nom_modelo2, a.cod_color, b.nom_color
FROM pro_modelos a ,con_color b
WHERE a.cod_modelo = b.cod_modelo
AND a.cod_campana = b.cod_campana
AND a.cod_color = b.numero
AND a.brand = 'BKK'
AND a.cod_campana = :cod_campana
END EXEC
I don't know what it's the problem, and how I can solve it...,
Can you help me??
I try the next phrases and not obtain a good result:
-
AND a.brand like :departament
-
departament = '"BSK"'
and a.brand = :departament
-
Thks for your help
04-23-2009 6:07 PM
Try declaring departament as a character field with the same length as in the source table.
Rob
04-24-2009 7:33 AM
Dear Rob.
I try this..., In my external Database, the field brand it's a char 50.
I declarate in ABAP program like this --> DATA: departament(50).
But not ok yet.
Another idea???...
Thks.
04-23-2009 6:08 PM
You can put the code in TRY-ENDTRY block, and CATCH the exceptions.
If you are sure of the asignation to "department" (try to debug), you can make this:
OPEN c1 FOR
SELECT a.cod_modelo, a.nom_modelo2, a.cod_color, b.nom_color
FROM pro_modelos a ,con_color b
WHERE a.cod_modelo = b.cod_modelo
AND a.cod_campana = b.cod_campana
AND a.cod_color = b.numero
AND a.brand = :departament
Remove (AND a.cod_campana = :cod_campana).
Or
OPEN c1 FOR
SELECT a.cod_modelo, a.nom_modelo2, a.cod_color, b.nom_color
FROM pro_modelos a ,con_color b
WHERE a.cod_modelo = b.cod_modelo
AND a.cod_campana = b.cod_campana
AND a.cod_color = b.numero
AND ( a.brand = :departament )
AND a.cod_campana = :cod_campana
Remember to put department or DEPARMENT in case.
04-24-2009 7:40 AM
Dear Alex.
I try the two forms that you tell me ..., and I debug... and it's no ok.
Dump appear again.
Another idea??
thks.
07-22-2010 8:30 AM