05-11-2011 1:42 PM
Hello there!
I want to manipulate Data in a SQL Statement. For instance:
SELECT
name
age
FROM pers INTO CORROSPONDING FIELDS OF it_ppl WHERE company = '01'.
The outcome would be something like
Hans 25
Sam 23
Marie 28
Julia 23
So what if I want to add an column behind the selected data, where the data output should not be variable from the database but a konstant, fix value?
I tried it like that:
SELECT
name
age
'Fix value' AS value
FROM pers INTO CORROSPONDING FIELDS OF it_ppl WHERE company = '01'.
Outcome should be like
Hans 25 Fix value
Sam 23 Fix value
Marie 28 Fix value
Julia 23 Fix value
The big question is: a) Is this possible with Open SQL and if so b) how?!
Thanks in advance,
kind regards,
Christof!
05-11-2011 2:16 PM
Its possible through Native SQL. I have done some small modification to the standard SAP help program . Please check it.
types: BEGIN OF ty,
connid TYPE spfli-connid,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
text type char03, "<---
END OF ty.
DATA c1 TYPE spfli-carrid VALUE 'LH'.
data:it type table of ty,wa type ty.
EXEC SQL PERFORMING loop_output.
SELECT connid, cityfrom, cityto, 'abc' as text "<---
INTO :wa
FROM spfli
WHERE carrid = :c1
ENDEXEC.
break-point. "Check the values in IT here
FORM loop_output.
append wa to it. "<---
ENDFORM.
05-11-2011 2:17 PM
Have you tried it? That would seem to me to be most pragmatic way of finding out.