SELECT A~FTRMI
A~AUFNR
B~MATNR
D~MAKTX
B~PSMNG
B~WEMNG
C~MTART
E~CHARG
C~MATKL
C~SPART
R~BWART
R~CHARG
R~MATNR
E~BWART
R~BDMNG
INTO TABLE ITAB
FROM AFKO AS A INNER JOIN AFPO AS B ON A~AUFNR = B~AUFNR
* INNER JOIN AFVC AS A1 ON A~AUFPL = A1~AUFPL AND B~DWERK =
A1~WERKS
INNER JOIN MARA AS C ON B~MATNR = C~MATNR
INNER JOIN MAKT AS D ON C~MATNR = D~MATNR
INNER JOIN MSEG AS E ON B~MATNR = E~MATNR AND A~AUFNR =
E~AUFNR AND B~DWERK = E~WERKS
INNER JOIN RESB AS R ON A~AUFNR = R~AUFNR AND E~AUFNR =
R~AUFNR AND R~RSNUM = A~RSNUM
AND R~WERKS = E~WERKS AND R~BAUGR = E~MATNR
INNER JOIN MARA AS C1 ON R~MATNR = C1~MATNR
WHERE A~FTRMI IN S_DATE AND A~AUFNR IN S_AUFNR AND C~MTART
IN S_TYPE AND C~MATKL = 'T'
AND R~BWART ='261' AND E~BWART = '101'
AND R~XWAOK ='X' AND B~DWERK = '2000'
AND R~XLOEK EQ SPACE AND E~KZBEW ='F' AND D~SPRAS = 'E' AND
R~KZEAR = 'X' AND C~MATNR IN S_MATNR.
This query gives repetative records from RESB.There must be
some common field which i am not taking thats why its
giving repetative records. If u find any solution pls lety
me know ASAP.
Thanks
Swati Ghadge
Answer Posted / Pankaj Verma
The issue with the given query is that it's joining the 'RESB' table multiple times, causing duplicate records. To fix this, you should remove one of the inner joins involving the 'RESB' table or use a GROUP BY clause to group by the common field(s) that cause the duplicates.nnHere's an example of using a GROUP BY clause:n```sqlnSELECT A~FTRMI A~AUFNR B~MATNR D~MAKTX B~PSMNG B~WEMNG C~MTART E~CHARG C~MATKL C~SPART R~BWART R~CHARG R~MATNR E~BWART R~MDMGN R~BDMNG INTO TABLE ITAB FROM AFKO AS A INNER JOIN AFPO AS B ON A~AUFNR = B~AUFNR * INNER JOIN AFVC AS A1 ON A~AUFPL = A1~AUFPL AND B~DWERK = A1~WERKS INNER JOIN MARA AS C ON B~MATNR = C~MATNR INNER JOIN MAKT AS D ON C~MATNR = D~MATNR INNER JOIN MSEG AS E ON B~MATNR = E~MATNR AND A~AUFNR = E~AUFNR AND B~DWERK = E~WERKSnINNER JOIN RESB AS R ON A~AUFNR = R~AUFNR AND E~AUFNR = R~AUFNR AND R~RSNUM = A~RSNUM AND R~WERKS = E~WERKS AND R~BAUGR = E~MATNR INNER JOIN MARA AS C1 ON R~MATNR = C1~MATNR WHERE A~FTRMI IN S_DATE AND A~AUFNR IN S_AUFNR AND C~MTART IN S_TYPE AND C~MATKL = 'T' AND R~BWART ='261' AND E~BWART = '101' AND R~XWAOK ='X' AND B~DWERK = '2000' AND R~XLOEK EQ SPACE AND E~KZBEW ='F' AND D~SPRAS = 'E' AND R~KZEAR = 'X' AND C~MATNR IN S_MATNRnGROUP BY A~AUFNR, B~MATNR, R~BWART, R~CHARG, R~MATNR, E~BWART, R~MDMGN, R~BDMNG;```
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
I want sample papers for NIC Examination. Plz send them to my mail Id das.neelam@gmail.com . Plz send it today, tomorrow i've the exam.
Mainly Related to Oracle, DBMS , Oracle Stored Procedures, Functions, Oracle 9i Architecture, Redo logs..., Views,
hi This is radhika.Can anyone help me to know the question papers of NATIONAL INFORMATICS CENTRE for the post of scientific officer/engineer? if anyone know plz tell me question paper pattern
Bonjour, svp je veut voir comment envoyer un mail en java et comment changer le droit d'accé d'un fichier en java: de lecture en lecture/écriture et merci d'avance ;)
How to get the index of the clicked field in reports in ABAP?
Hi Guys, This is Rama, right now I am working as a Software Test Engineer in Gurgoan and I have over all 3 years of testing expoeriance. Right now I am looking for a change. Can any body help me out to find a job in south india. Thanks in Advance
Give examples of macro quoting function?
Please forward important interview and basic questions in VB6 on my email id: usneha_16@yahoo.co.in
what is the diff bw sql direct and jdbc update can't we do select and updating operation in sql direct
I am taking the bmc control m/enterprise manager 7.0 scheduling test and just wanted to see what kind of questions they would ask or if anyone has taken the test and how long it is for how many questions?
hi, all this is shoba m.c.a . i have learned abap but no oppurtunities right now as fresher , right now i want to learn any course on demand any one pls suggest me good course and institute in hyderabad
can we extend a class having only one parameterised constructor.Suggest the process to do it.
Explain the types of operations? Draw the figure for shift and rotate operations?
what is class module in vb6? what it's use? with example..
Compare any 4 software development life cycle paradigms with each other. Indicate at least one application for each of the paradigms that are suitable to developed using that paradigm.