Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

executing SQL Commands

Former Member
0 Likes
662

Hello all,

Can any one tell me how to execute Native SQL queries from ABAP.

Thanks in advance.

Best Regards,

Sasidhar Reddy Matli.

1 ACCEPTED SOLUTION
Read only

former_member222860
Active Contributor
0 Likes
633

Hi,

Write your SQL queries in between Exec Sql and EndExec.

Here's sample code:

data: begin of itab occurs 0,
          matnr like makt-matnr,
          maktx like makt-maktx,
        end of itab.

exec sql.
select matnr, maktx from makt into :itab
endexec.

loop at itab.
write:/ itab-matnr, itab-maktx.
endloop.

Check in Help/ for more info.

Cheers\

Mahesh

5 REPLIES 5
Read only

GauthamV
Active Contributor
0 Likes
633

check this.

[http://help.sap.com/saphelp_nw04/helpdata/en/51/ef9f94e4ba894d8e93b2eed7c9f82d/frameset.htm]

Read only

Former Member
0 Likes
633
Read only

Former Member
0 Likes
633

Hi,

Kindly go through these link below:

http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3b8b358411d1829f0000e829fbfe/content.htm

Hope it helps

Regrds

Mansi

Read only

former_member222860
Active Contributor
0 Likes
634

Hi,

Write your SQL queries in between Exec Sql and EndExec.

Here's sample code:

data: begin of itab occurs 0,
          matnr like makt-matnr,
          maktx like makt-maktx,
        end of itab.

exec sql.
select matnr, maktx from makt into :itab
endexec.

loop at itab.
write:/ itab-matnr, itab-maktx.
endloop.

Check in Help/ for more info.

Cheers\

Mahesh