2

I try to use SELECT FROM @itab like explained here in SAP docs.

I have never used this feature, but think this is great. You can query a internal data structure which just exists in the RAM of the interpreter like it would be a real table in the database. I am impressed.

Here is the ABAP code:

data: lt_get_auth_values TYPE STANDARD TABLE OF US335.

CALL FUNCTION 'GET_AUTH_VALUES'
     EXPORTING
            OBJECT1 = 'Z:FOO'
            USER    = sy-uname
     TABLES
            VALUES  = lt_get_auth_values.

SELECT highval from @lt_get_auth_values as mytab WHERE field = 'WERKS' 
        INTO TABLE @DATA(static_perm_filter_fields).

I can't active the function because "from @lt_get_auth_values" is a syntax error according to my system.

What's wrong with this line?

SAP Version: 740 (sorry, it first I thought it was 752)

8
  • 1
    You are missing spaces on both side of the = sign. Correct and check again.
    – András
    Dec 4, 2018 at 12:40
  • I would check this first: "Mit der Methode USE_FEATURES der Klasse CL_ABAP_DBFEATURES kann in einem ABAP-Programm festgestellt werden, ob das aktuelle Datenbanksystem oder ein Datenbanksystem, auf das über eine Sekundärverbindung zugegriffen wird, den Zugriff auf interne Tabellen unterstützt. Hierzu muss die Konstante ITABS_IN_FROM_CLAUSE dieser Klasse in einer internen Tabelle an die Methode übergeben werden." This is from the docu you provided by link, there is also a sample code to this. Dec 4, 2018 at 13:00
  • Appeared in 7.52 so it should work (if you correct the error mentioned by András). On my 7.52 system it works but you must indicate a table alias. There's an example in the ABAP doc. Doc in English Dec 4, 2018 at 13:41
  • @SandraRossi I am sorry. This is a different system, and there is only 740, not version 752. I guess this is the reason.
    – guettli
    Dec 4, 2018 at 14:00
  • 1
    if you use a literal (like 'highval') in a SELECT, you need to give it an alias ('highval' AS highval)
    – András
    Dec 4, 2018 at 14:14

1 Answer 1

5

SELECT ... FROM @itab appeared in 7.52 so it should work.

On my 7.52 system it works but you must indicate a table alias. There's an example in the ABAP documentation (cf first link above).

1
  • @guettli the last functional error is that you store literally highval into all lines of static_perm_filter_fields, instead of the value from component highvalof lt_get_auth_values ; to correct it, you should use SELECT highval FROM ... instead of SELECT 'highval' FROM ... Dec 4, 2018 at 16:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.