0

First: I'm working on a existing code and want to add some new stuff to it and I'm really new to ABAP

My goal: I want to duplicate an existing table and remove all values that occur multiple times. That - at least I think - works. Afterwards I want to INNER JOIN this new created table with another already existing table, but unfortunately I always get the following error:

Method MethodName "newCreatedTable" is not defined in the ABAP Dictionary as a table, projection view, or database view

Additional Info: As you can see I'm working inside of a method!

Here is my code what I've done so far:

creating new table and delete all duplicates

DATA newCreatedTable TYPE STANDARD TABLE OF existingTable.
SELECT columnName 
    FROM existingTable INTO TABLE newCreatedTable.
DELETE ADJACENT DUPLICATES 
    FROM newCreatedTable COMPARING columnName.

here is where the error happens

SELECT * 
FROM anotherExistingTable as p
INNER JOIN newCreatedTable as t on t~columnName = p~columnName
...

I hope someone can help me out in this case! Thank You in advance!

2
  • 1
    Joining a database table to an internal table (variable newCreatedTable) is possible only with ABAP >= 7.52 and with HANA database. What do you use? Commented Nov 17, 2021 at 18:22
  • You'd better read Sandra explanation thoroughly and re-think what you are doing, I believe joining dbtab + itab was not your original intention and you ended with this accidentally Commented Nov 18, 2021 at 15:55

1 Answer 1

0

If I'm not wrong your code looks like this:

DATA newCreatedTable TYPE STANDARD TABLE OF existingTable.

SELECT columnName FROM existingTable INTO TABLE newCreatedTable.

DELETE ADJACENT DUPLICATES
FROM newCreatedTable COMPARING columnName.

SELECT * 
FROM anotherExistingTable
INNER JOIN newCreatedTable as t on t~columnName = p~columnName

If this is the case then you cannot make a SELECT on an internal table. You can only make this operation on a table that exists in the ABAP dictionary.

Your code should look like this:

DATA newCreatedTable TYPE STANDARD TABLE OF existingTable.

SELECT columnName 
FROM existingTable INTO TABLE @newCreatedTable.

DELETE ADJACENT DUPLICATES FROM newCreatedTable COMPARING columnName.

SELECT * 
FROM anotherExistingTable
FOR ALL ENTRIES IN @newCreatedTable " <-------------- Use FOR ALL ENTRIES
WHERE columnName = @newCreatedTable-columnName. " <-- in your code
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for trying helping me out - I've tried but get another error If the new Open SQL syntax is used, it must be used throughout. This includes using @ to escape host variables. - what does this mean ?
Yeah, sorry, new syntax in ABAP requires to use @ for host variables in Open SQL. More info in help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/…. I corrected the code. Check it please.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.