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

Problem in select query

Former Member
0 Likes
835

hi guru's,

i have a problem when taking data in ITAB thru select query, it is not picking data as in table...

Table MSEG data :

MBLNR.........MATNR.........BWART.........LGORT.........ERFMG.........AUFNR

500012.........AAAA.............321............RECP................123............100056

500017.........AAAA.............311............RECP................123

500014.........BBBB..............321............RECP.................115...........100058

500019.........BBBB..............311............RECP.................110

i wrote select query:

select mblnr matnr bwart lgort erfmg aufnr from mseg into itab where matnr = itab2-matnr

and lgort = itab2-lgort

and bwart = in ('321' , '311')

and zeile ne '2'.

then i m getting data in itab like :

ITAB data:

MBLNR.............. MATNR ............ BWART.............. LGORT.............. ERFMG AUFNR

500017 .............. AAAA................ 311................. RECP .............. 123

500019.............. BBBB................. 311................ RECP.............. 110

500012.............. AAAA................ 321................. RECP .............. 123.............. 100056

500014.............. BBBB................ 321 ................. RECP .............. 115 .............. 100058

can anyone please tell me that how can i get the data in ITAB in same format as in table? actually i have to do calculation of quantity on behalf of moment type.

Regards.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
804

you are getting the right data, just sort by mblnr.

8 REPLIES 8
Read only

Former Member
0 Likes
805

you are getting the right data, just sort by mblnr.

Read only

Former Member
0 Likes
804

Just sort the internal table based on matnr and mblnr


sort itab by matnr mblnr.

Read only

Former Member
0 Likes
804

Sort the internal table as follows.

SORT ITAB BY MATNR MBLNR.

Read only

Former Member
0 Likes
804

Press F1 on SORT.

Read only

Former Member
0 Likes
804

hii

you are getting right data

just sort it by matnr and mblnr.

Sort itab bby matnr mblnr.

Edited by: runal kesarwani on Oct 7, 2009 12:52 PM

Read only

Former Member
0 Likes
804

@@ABAP@ - when you assign full points to an obviously incorrect answer, it raises red flags to the moderators.

Rob

Read only

0 Likes
804

Hi Rob

Would luv to know wat was so obviously wrong with the answer to that query?

Regards

Sameer

Read only

0 Likes
804

MATNR should be the first item in the sort.

Rob