06-20-2019 6:21 PM
Hello! i'm triying to make a query from a different schema from default like this:
My class
definition of the method:
methods BUSCA_BUKRS
importing
VALUE(I_FILTRO) type string " MANDT = '110' and BWKEY = '1000'
VALUE(I_SCHEMA) type string "SLT_S4R
exporting
VALUE(O_BUKRS) type ZCL_TT_BUKRS .
implementation:
method BUSCA_BUKRS BY DATABASE PROCEDURE
FOR HDB
LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY.
* SQL script
it_data = SELECT T001K.MANDT, T001K.BUKRS, T001K.BWKEY
FROM "i_schema"."T001K";
it_query = SELECT * FROM
:it_data AS A;
O_BUKRS = APPLY_FILTER(:it_query, :I_FILTRO);
endmethod.
as you can see i'm using i_schema to assing my schema but i get thie error:
So i can't activate my class, i tried to activate obligatory this and run my program but i get a dump
And if i try to write my query like this it works (hard code)
it_data = SELECT T001K.MANDT, T001K.BUKRS, T001K.BWKEY
FROM "SLT_S4R"."T001K";
if i debbug in my scenario where i'm facing the error: i_schema = SLT_S4R so it's the same but i don't know why i'm getting an error :c . I am specifying the schema be cause those tables are not in the default schema that's why and i noticed this when i transported to QAS the schema there it's like SLT_S4Q. Any idea or different way to do this ???
06-24-2019 2:43 PM
I currently don't have a system to test, but I would try the following:
it_data = SELECT T001K.MANDT, T001K.BUKRS, T001K.BWKEY
FROM :i_schema."T001K";
07-05-2019 8:08 PM
Yes i tried like that but i get this error in this line:
FROM :i_schema."T001K";
07-08-2019 4:25 AM