2006 May 16 11:11 PM
In SQL I can use a constant in my selection parameters. Is it possible to do this in ABAP as well? For instance is there a similar way to do the following in ABAP (obviously the following will not compile just an example of what I'm trying to do)?
data: begin of g_itab occurs 0,
order_no like vbap-vbeln,
line_no like vbap-posnr.
data: end of g_itab.
select vbeln '000010' into table g_itab.
2006 May 16 11:37 PM
Hi Shaun,
No.. you cannot use constants in the field list..You can revise it as follows..
select vbeln posnr into table g_tab
from vbap
where posnr eq '000010'.
Regards,
Suresh Datti
In SQL I can use a constant in my selection parameters. Is it possible to do this in ABAP as well? For instance is there a similar way to do the following in ABAP (obviously the following will not compile just an example of what I'm trying to do)?
data: begin of g_itab occurs 0,
order_no like vbap-vbeln,
line_no like vbap-posnr.
data: end of g_itab.
select vbeln '000010' into table g_itab.
2006 May 16 11:37 PM
Hi Shaun,
No.. you cannot use constants in the field list..You can revise it as follows..
select vbeln posnr into table g_tab
from vbap
where posnr eq '000010'.
Regards,
Suresh Datti
2006 May 16 11:41 PM
Thanks for your reply Suresh. I have a way around it but it requires an additional step that I was hoping to avoid. The example you provide below changes actually what I'm trying to do so it wouldn't work. Hopefully SAP supports this in the future.
2006 May 16 11:44 PM
2006 May 17 12:12 AM
Suresh.... there are several ways to solve my issue and I've chosen one. You've answered my question and I won't bore you with the details of what I'm trying to do. It was more curiosity than anything. Basically I knew what I was trying to do could be done in standard ANSII SQL but wasn't sure if and how ABAP supported it. I had tried various methods but none worked. Last resort was to post the question here. Thanks again for your follow-up.
2006 May 17 12:16 AM
I think you could do this in native sql.
exec sql.
select blah '0001' from xyz etc.
ENDEXEC.
eg,
DATA: BEGIN OF wa,
connid TYPE spfli-connid,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
END OF wa.
DATA c1 TYPE spfli-carrid VALUE 'LH'.
EXEC SQL.
SELECT '0001', cityfrom, cityto
INTO :wa
FROM spfli
WHERE carrid = :c1
ENDEXEC.
WRITE: / wa-connid, wa-cityfrom, wa-cityto.
By the way, Shaun the details won't bore us... your problem and solution may help others with similar issues, please share it if you can.
2006 May 17 12:16 AM
Have you explored the option of using native SQL in ABAP ie EXEC..ENDEXEC stuff?
Regards,
Suresh Datti
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |