10-21-2008 6:32 AM
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.
10-21-2008 6:38 AM
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'.
10-21-2008 6:40 AM
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.
10-21-2008 6:55 AM
Hi Rock,
Could u please tell me as per performence which one is good
for all entries or joins?
regrds
Kiran
10-21-2008 7:23 AM
10-21-2008 6:49 AM
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