Application Development 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: 

problem in fetching the data for 1 plant

Former Member
0 Kudos

Hi,

I had made a report in which i am taking data from QALS table and then from QMEL. by taking common values MAWERK ,WERK,PRUEFLOS,MATNR.

The problem is this the data is coming right for the 1 plant and when i check the data for another plant it is not coming.

I checked in the SE16 the data about them by having the values of it and the data is present in that.

why the data is not coming for the other plant . here's d code :-

SELECT AMATNR AWERK APRUEFLOS APAENDTERM ALOSMENGE BMAWERK BCHARG BLGORTCHARG BMGEIN BMGEIG BQMNUM CNTGEW CMEINS CGEWEI

FROM QALS AS A

LEFT OUTER JOIN QMEL AS B ON BMATNR = AMATNR AND BPRUEFLOS = APRUEFLOS AND BMAWERK = AWERK

INNER JOIN MARA AS C ON CMATNR = AMATNR

INTO TABLE STIT WHERE AWERK = P_WERKS AND AMATNR IN P_MATNR

AND APAENDTERM IN I_DATE AND ALAGORTCHRG IN P_LGORT AND A~CHARG IN P_CHARG.

plzz provide me guidelines for solving it.

5 REPLIES 5

Former Member
0 Kudos

U should get the data correctly as far as I can see there is nothing in it(but wait for the experts to answer).I can suggest u to go for 'for all entries' rather inner join.I always do 'trial and error'.

0 Kudos

hi,

but the thing is the right data is coming for the plant only by using OUTER JOIN .even i had done a lot of study of the problem but it is displaying the dat for 1 plant accuratley ,when i enter any other plant it is not displaying the data.

0 Kudos

Hi Rock,

Could u please tell me as per performence which one is good

for all entries or joins?

regrds

Kiran

0 Kudos

hi,,

plz provide me guidelines for this problem.

P561888
Active Contributor
0 Kudos

Hi,

here is the sample code for ur problem.

SELECT MATNR WERK PRUEFLOS PAENDTERM LOSMENGE FROM QALS INTO IT_QALS WHERE WERK = P_WERKS AND MATNR IN P_MATNR.

IF NOT IT_QALS[] IS INITIAL.

SELECT MAWERK CHARG LGORTCHARG MGEIN MGEIG QMNUM FROM QMEL INTO IT_QMEL FOR ALL ENTRIES IN IT_QALS WHERE

MATNR = IT_QALS-MATNR AND PRUEFLOS = IT_QALS-PRUEFLOS AND MAWERK = IT_QALS-WERK.

IF SY-SUBRC = 0 .

SORT THE INTERNAL TABLE.

ENDIF.

ENDIF.

IF NOT IT_QALS[] IS INITIAL.

SELECT NTGEW MEINS GEWEI FROM MARA INTO TABLE IT_MARA FOR ALL ENTRIES IN IT_QALS WHERE MATNR = IT_QALS-MATNR.

IF SY-SUBRC = 0 .

SORT THE INTERNAL TABLE.

ENDIF.

ENDIF.

this is sample code only...

check it out..

Regards,

Bharani