2013 May 16 11:27 AM
Hello,
If I run the following select, I find 4837
---
SQL> select count(*) from (select * from zengsal minus select * from
zengsal2);
COUNT(*)
----------
4837
---
If I run the following abap code, I find 4
---
EXEC SQL.
select count(*) into :count_sal from (select * from zengsal minus
select * from zengsal2)
ENDEXEC.
count_sal_s = count_sal.
---
Would you know why count_sal_s is not equal to 4837?
Thanks in advance for your answer.
2013 May 16 12:01 PM
How is count_sal and count_sal_s declared, maybe the result is truncated, please paste the relevant code.
Thomas
2013 May 16 12:01 PM
How is count_sal and count_sal_s declared, maybe the result is truncated, please paste the relevant code.
Thomas
2013 May 16 12:32 PM
Hello,
They are declared as integer.
I paste the code.
---
* Data Declarations
DATA: lt_mailsubject TYPE sodocchgi1.
DATA: lt_mailrecipients TYPE STANDARD TABLE OF somlrec90 WITH HEADER LINE.
DATA: lt_mailtxt TYPE STANDARD TABLE OF soli WITH HEADER LINE.
DATA: count_sal, count_det type I.
DATA: count_sal_s, count_det_s TYPE STRING.
DATA: mail_string type string.
* Find the number of differences for zeng_det
EXEC SQL.
select count(*) into :count_det from (select * from zengdet minus select * from zengdet2)
ENDEXEC.
count_det_s = count_det.
* Find the number of differences for zeng_sal
EXEC SQL.
select count(*) into :count_sal from (select * from zengsal minus select * from zengsal2)
ENDEXEC.
count_sal_s = count_sal.
---
Thanks in advance for your answers.
2013 May 16 9:19 PM
Hi Benoit,
I'm suspicious that the abap query appears to return 4 which is the first integer in 4837, so like Thomas I suspect the value may be getting truncated. Try declaring your integer variables TYPE sydbcnt, which has a data type of INT4. Data element sydbcnt is the data element behind sy-dbcnt which is assigned during a select statement.
Cheers,
Amy
2013 May 18 10:09 AM
Hi,
DATA: count_sal_s
this is a char length 1!
so
count_sal_s = 4837
will be
just 4 (first character of your integer...)
Kind regards,
Hermann
2013 May 18 10:28 AM
.
DATA: count_sal, count_det type I.
DATA: count_sal_s, count_det_s TYPE STRING.
count_sal_s = count_sal.
Here you have delare count_sal and count_sal_s without any types , so it will be defaulted to char1 . that is the reason your values are truncated.