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

Sql Query

Former Member
0 Likes
959

Hi guys,

I am working on query,i have not worked on query ,i have touse 2 tables and with some condition i ahve to display data...........can anyone tell me step by step procedure to create query and where to give condition in qury

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
910

hi Ankur,

First goto t.code

SQ03--->Create any name of User Group. its save and activated.

Second goto t.code.

SQ02-->Create any name of Infoset. its add table name or join two table name. its alignment of table name. click as save and red color circle which its infoset generated. goto main screen then click role/user group assignment find ur user group which t.code SQ03.

its save and activated and click as generated.

Third goto t.code,

SQ01-->Create any name of query from user group. click as next screen then u add table name which t.code SQ02. click as check box with ur table field. next then click as u want about SV or 1Z. which no intervals or no extensions. next click as basis list then click as check box with table field. u want which calculated with total formats. click as execute then see graphs which vertical or pie chat etc its good graphics.

Fourth goto t.code,

SQVI---->Create any name of Quick Viewer. its same as SQ01.which basis type. its used layout model. click as execute then see graph which vertical bar or horizontal bar or pie chat etc..

Reward if Useful,

Regards,

S.Suresh

7 REPLIES 7
Read only

Former Member
0 Likes
911

hi Ankur,

First goto t.code

SQ03--->Create any name of User Group. its save and activated.

Second goto t.code.

SQ02-->Create any name of Infoset. its add table name or join two table name. its alignment of table name. click as save and red color circle which its infoset generated. goto main screen then click role/user group assignment find ur user group which t.code SQ03.

its save and activated and click as generated.

Third goto t.code,

SQ01-->Create any name of query from user group. click as next screen then u add table name which t.code SQ02. click as check box with ur table field. next then click as u want about SV or 1Z. which no intervals or no extensions. next click as basis list then click as check box with table field. u want which calculated with total formats. click as execute then see graphs which vertical or pie chat etc its good graphics.

Fourth goto t.code,

SQVI---->Create any name of Quick Viewer. its same as SQ01.which basis type. its used layout model. click as execute then see graph which vertical bar or horizontal bar or pie chat etc..

Reward if Useful,

Regards,

S.Suresh

Read only

Former Member
0 Likes
910

Hi Ankur,

Below is the general SQL query syntax:

SELECT      <result>
    FROM      <source> 
    [WHERE    <condition>]
    [GROUP BY <fields>] 
    [HAVING   <cond>]

for more Information refer below link:

http://help.sap.com/saphelp_nw04/helpdata/en/39/d5c6f3fe40a640a7e72485f9c74052/content.htm

Regards,

Sunil

Read only

Former Member
0 Likes
910

Hi Ankur,

I have ABAP Query tutorials.

Send me ur email ID..

i will send u this file.

Regards,

S.Suresh.

Read only

Former Member
0 Likes
910

Hi Ankur,

SQL Query---Select statement.

select * from <table name> into table <internal table>.

or

Select * from <table name> into <table name>.

ABAP Query---->Development of Graphs

Reward if useful,

Regards,

S.Suresh.

Read only

Former Member
0 Likes
910

Hi,

Pls find the link to an excellent PDF document which contains everything about SAP Query._This doc was found to be very useful to me in implementing SAP Query._

http://www.scribd.com/full/2184969?access_key=key-1b22df5jwv4sgbks9p7e

Reward if found helpful.

Read only

Former Member
0 Likes
910

hi check this...

here i am using the two tables...mara and marc ...

REPORT test.

tables:mara,marc,mard,makt.

data:begin of it_mara occurs 0,

matnr like mara-matnr,

mtart like mara-mtart,

meins like mara-meins,

end of it_mara.

data:begin of it_marc occurs 0,

matnr like marc-matnr,

pstat like marc-pstat,

werks like marc-werks,

end of it_marc.

data:begin of it_mard occurs 0,

werks like mard-werks,

lgort like mard-lgort,

labst like mard-labst,

end of it_mard.

data:begin of it_final occurs 0,

matnr like mara-matnr,

mtart like mara-mtart,

meins like mara-meins,

pstat like marc-pstat,

werks like marc-werks,

lgort like mard-lgort,

labst like mard-labst,

maktx like makt-maktx,

end of it_final.

select-options:s_matnr for mara-matnr.

select matnr

mtart

meins

from mara

into table it_mara

where matnr in s_matnr.

if not it_mara[] is initial.

select matnr

pstat

werks

from marc

into table it_marc

for all entries in it_mara

where matnr = it_mara-matnr.

if not it_marc[] is initial.

select werks

lgort

labst

from mard

into table it_mard

for all entries in it_marc

where werks = it_marc-werks.

endif.

endif.

loop at it_mara.

it_final-matnr = it_mara-matnr.

it_final-mtart = it_mara-mtart.

it_final-meins = it_mara-meins.

read table it_marc with key matnr = it_mara-matnr.

it_final-werks = it_marc-werks.

it_final-pstat = it_marc-pstat.

read table it_mard with key werks = it_marc-werks.

it_final-lgort = it_mard-lgort.

it_final-labst = it_mard-labst.

if sy-subrc = 0.

select maktx from makt into it_final-maktx where matnr = it_final-matnr.

endselect.

endif.

append it_final.

endloop.

loop at it_final.

write:/ it_final-matnr under 'material',

it_final-mtart under 'material type',

it_final-meins under 'unit of measure',

it_final-werks under 'plant' ,

it_final-pstat under 'status',

it_final-lgort under 'storage loc',

it_final-labst under 'stock',

it_final-maktx.

endloop.

regards,

venkat