It is possible in ABAP to make a select and include a hard code value and to put a value in any field.
In my exemple I have to fill a range with Company code BUKRS according to VKORG so I have to do a select on TVKO like that:
DATA : lt_rtvko TYPE RANGE OF bukrs.
SELECT 'I' as sign 'EQ' as option bukrs as low
INTO CORRESPONDING FIELDS OF TABLE lt_rtvko
FROM tvko
WHERE vkorg EQ p_vkorg.
But I have a dump.
I know a longer solution to do this, To fill manually a table of TVKO and make a LOOP to fill the range, BUT I am sure that we have a solution to do that in one operation like in my example.
Thanks, Experts.
It's actually pretty easy. Just get rid of INTO CORRESPONDING
and AS
. As long as the value order is right, you get no problem:
SELECT 'I', 'EQ', bukrs
FROM tvko
INTO TABLE @lt_rtvko
WHERE vkorg = @p_vkorg.
And I think you have a typo in your range declaration. Should be:
DATA: lt_rtvko TYPE RANGE OF bukrs.