2008 Feb 22 10:57 PM
Hi ABAP expert,
When I want to select database two tables, we just want to compare two table substring. For Example, both fields have yyyymmdd. But I have interested yyyymm. In the Oracle database and SQL server database, I can easily to use substr to achieve those goals. How in the ABAP program to archive those goals.
Thanks in advance,
Cliff Fan
Hi ABAP expert,
When I want to select database two tables, we just want to compare two table substring. For Example, both fields have yyyymmdd. But I have interested yyyymm. In the Oracle database and SQL server database, I can easily to use substr to achieve those goals. How in the ABAP program to archive those goals.
Thanks in advance,
Cliff Fan
2008 Feb 23 1:20 AM
Hi you can access substrings in ABAP the following way:
data: s type string value 'yyyymmdd'.
write: / s(6). "yyyymm
write: / s+4(4). "mmdd
so the number after '+' determines the position in the string and the number in parenthesis () determines the length of the substring.
Now you can just loop over both of your tables and perform the necessary comparison in the nested loop.
2008 Feb 25 5:26 PM
Hi Daniel,
Thanks for your input. I really like to use SQL statement to solve this problem. I understand that we can use internal table to get results. May be I will need to use EXE SQL to get my results.
Cliff
2008 Feb 25 5:30 PM
Hi Cliff
if you wan't/need to use SQL for your comparison, then you have to use native SQL since Open SQL does not offer this possibility. Keep in mind that you loose the database independcy though.
For what reason do you wan't to use SQL rather then ABAP logic?
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |