Alternative for Join.
Hi friends,
I am facing problem in breaking up a select statement which contains join between 10 tables.
can you people suggest me different options for removing join in a select statements.
Hi Rob
here is the actual select statement.
have a look at it and see what can be done with this.
I tried out to break it in two parts, but was unsucessful.
SELECT AFKO~AUFNR "Order Number
AFKO~GSTRP "Order Basic start date
AFKO~GSTRS "Order Scheduled start
AFIH~PRIOK "Maint order Priority
AFIH~ILART "Maint activity type
AFIH~WARPL "Maint plan
AFIH~ABNUM "Package num
AFIH~WAPOS "Maint item
ILOA~TPLNR "Functional location
ILOA~ABCKZ "ABC indicator for technical object
AUFK~KTEXT "Order Short text
AUFK~AUART "Order type
AUFK~OBJNR "object num of order
AFVC~OBJNR "Object num of operation
AFVC~ANLZU "Task list oper's sys condition
CRHD~ARBPL "Work center
AFVV~ARBEI "Plan hours for the activity
AFVV~ISMNW "Actual hours
MPOS~WSTRA "Strategy
AFKO~PLNNR
AFKO~PLNAL
MHIS~ZAEHL "Maint package
FROM ( AFKO "afko: Order header
INNER JOIN AUFK "aufk: Order master data.
ON AUFKAUFNR = AFKOAUFNR
INNER JOIN AFIH "afih: Maint order header
ON AFIHAUFNR = AUFKAUFNR
INNER JOIN ILOA "iloa: PM Obj Loc & Acct Assgmt
ON ILOAILOAN = AFIHILOAN
INNER JOIN caufv "
ON caufvAUFNR = AFKOAUFNR
INNER JOIN AFVC "afvc: Operation within an order
ON AFVCAUFPL = CAUFVAUFPL
INNER JOIN AFVV "afvv: qty/dates in operation
ON AFVVAUFPL = AFKOAUFPL
INNER JOIN CRHD "crhd: Work Center Header
ON CRHDOBJID = AFVCARBID
INNER JOIN PLAS
ON PLASPLNTY = AFVCPLNTY
AND PLASPLNNR = AFVCPLNNR
AND PLASPLNAL = AFVCPLNAL
AND PLASZAEHL = AFVCZAEHL
INNER JOIN PLWP
ON PLWPPLNTY = AFVCPLNTY
AND PLWPPLNNR = PLASPLNNR
AND PLWPPLNAL = PLASPLNAL
INNER JOIN MHIS "mhis: Maint plan history
ON MHISZAEHL = PLWPPAKET
LEFT OUTER JOIN MPOS "mpos: Maint item
ON MPOSWAPOS = AFIHWAPOS
INTO TABLE I_CO_MH3
WHERE AFKO~GSTRS IN S_DATES "Order scheduled start date
AND AFKO~GSTRS IN R_ONE_YEAR "Restriction by year
AND ILOA~TPLNR IN S_TPLNR "func location input
AND CRHD~OBJTY = 'A' "Object types of CIM resource
Similar Messages
-
A018 Alternative for join to KONP
I currently have a join between A018 and KONP which retrieves all the data I require. I am insterested to know whether I could extract the same data with using transparent tables only?
Hi
you can use A018 and KONP itself without using joins.
if join is causing performance issue here then u can rearrange your code as follows..
SELECT ...FROM KONP INTO TABLE INT_KONP.
IF NOT INT_KONP IS INITIAL.
SELECT ..FROM A018 INTO TABLE INT_A018 FOR ALL ENTRIES IN INT_KONP WHERE <condition record number> EQ INT_KONP-<condition record number>.
ENDIF.
Cheers,
Abdul Hakim
Mark all useful answers.. -
Hi,
please check this code and suggest me of an alternative for this performance wise.
SELECT b~partner
APPENDING CORRESPONDING FIELDS OF
TABLE t_db_pos_match
FROM adrc AS a
JOIN but020 AS b
ON aaddrnumber = baddrnumber
JOIN but000 AS c
ON bpartner = cpartner
WHERE c~partner NE t_bp_obj-act-ekun-partner
AND c~mc_name1 = t_bp_obj-act-ekun-name_last
AND a~city1 = wa-city1
AND a~post_code1 = wa-post_code1
AND a~po_box = wa-po_box
AND a~street = wa-street
AND a~house_num1 = wa-house_num1
AND a~house_num2 = wa-house_num2
AND a~region = wa-region
AND a~addr_group = 'BP'.
awaiting your reply.
Binay.HI
*PARAMETERS P_CITY TYPE SPFLI-CITYFROM.
**TYPES: BEGIN OF ENTRY_TAB_TYPE,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
END OF ENTRY_TAB_TYPE.
**DATA: ENTRY_TAB TYPE TABLE OF ENTRY_TAB_TYPE,
SFLIGHT_TAB TYPE SORTED TABLE OF SFLIGHT
WITH UNIQUE KEY CARRID CONNID FLDATE.
**SELECT CARRID CONNID
FROM SPFLI
INTO CORRESPONDING FIELDS OF TABLE ENTRY_TAB
WHERE CITYFROM = P_CITY.
**SELECT CARRID CONNID FLDATE
FROM SFLIGHT
INTO CORRESPONDING FIELDS OF TABLE SFLIGHT_TAB
FOR ALL ENTRIES IN ENTRY_TAB
WHERE CARRID = ENTRY_TAB-CARRID AND
CONNID = ENTRY_TAB-CONNID.
TRY LIKE THIS
REWARD IF USEFULL -
Hi all,
Im extracting different fields from material master data into different internal tables. I need to have all the data in these internal table in one final internal table, I don't want to use inner join to get the data into the final internal table. Can you suggest any alternative for this?
Thanks.hi check this..this is the alternative for the joins..
REPORT ZZZZ000000.
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 -
Hi
I have to simple sets of query Q1 and Q2, both of them have the SUM function used, they work just fine separately, but we want the result in 1 single query.
The problem is that Q1 has a master/detail table relation in the join so whenever we join both queries together the result set is being summed incorrectly according to the number of detail records found in the detail table.
Of course the solution is to use UNION operator.
What I'm looking for is an alternative for the UNION
Are there any analytical functions where I can have the result???
Query examples:
TONY@DEV> SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QTY
5 FROM ISTD_STOCK_MOUVEMENTS_M M ,
6 ISTD_STOCK_MOUVEMENTS_D D,
7 IACD_AUXILIARIES X
8 WHERE M.TMVS_CODE = D.TMVS_CODE
9 AND M.CPNY_CODE = D.CPNY_CODE
10 AND M.BRCH_CODE = D.BRCH_CODE
11 AND M.MVTS_YEAR = D.MVTS_YEAR
12 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
13 AND X.AUXL_TYPE = M.AUXL_TYPE
14 AND X.AUXL_CODE = M.AUXL_CODE
15 AND X.AUXL_RPRSNT_TITLE = 1
16 AND M.AUXL_TYPE = 1
17 GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE;
GRP_CODE AUXL_CODE ITEM_CODE QTY
1 33405 4030010 318
1 33405 4030020 22
1 33405 4030030 22
1 33408 4030010 14
1 33408 4030020 2
1 33408 4030030 2
1 33410 4030010 992
1 33410 4030020 42
1 33410 4030030 42
1 33413 4030010 789
1 33413 4030020 38
GRP_CODE AUXL_CODE ITEM_CODE QTY
1 33413 4030030 38
1 33413 5010008 1
1 33413 5010009 1
1 33413 5010012 1
15 rows selected.
Elapsed: 00:00:00.00
TONY@DEV> SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 X.AUXL_CODE,
3 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT,
4 SUM(NVL(A.AGAC_AMT, 0)) PAID,
5 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
6 FROM IACD_PAYM_AGING A,
7 IACD_AUXILIARIES X
8 WHERE X.AUXL_TYPE = A.AUXL_TYPE
9 AND X.AUXL_CODE = A.AUXL_CODE
10 AND X.AUXL_RPRSNT_TITLE = 1
11 GROUP BY X.AUXL_RPRSNT_TITLE, X.AUXL_CODE;
GRP_CODE AUXL_CODE AMT PAID DUE
1 33405 845.248 93.34 751.908
1 33408 37.334 13.34 23.994
1 33410 2655.328 394.68 2260.648
1 33413 2103.855 293.302 1810.553
Elapsed: 00:00:00.00
TONY@DEV> SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QUANTITY,
5 NULL AMT,
6 NULL PAID,
7 NULL DUE
8 FROM ISTD_STOCK_MOUVEMENTS_M M ,
9 ISTD_STOCK_MOUVEMENTS_D D,
10 IACD_AUXILIARIES X
11 WHERE M.TMVS_CODE = D.TMVS_CODE
12 AND M.CPNY_CODE = D.CPNY_CODE
13 AND M.BRCH_CODE = D.BRCH_CODE
14 AND M.MVTS_YEAR = D.MVTS_YEAR
15 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
16 AND X.AUXL_TYPE = M.AUXL_TYPE
17 AND X.AUXL_CODE = M.AUXL_CODE
18 AND X.AUXL_RPRSNT_TITLE = 1
19 AND M.AUXL_TYPE = 1
20 GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE
21 UNION
22 SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
23 X.AUXL_CODE,
24 NULL ITEM_CODE,
25 NULL QUANTITY,
26 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT,
27 SUM(NVL(A.AGAC_AMT, 0)) PAID,
28 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
29 FROM IACD_PAYM_AGING A,
30 IACD_AUXILIARIES X
31 WHERE X.AUXL_TYPE = A.AUXL_TYPE
32 AND X.AUXL_CODE = A.AUXL_CODE
33 AND X.AUXL_RPRSNT_TITLE = 1
34 GROUP BY X.AUXL_RPRSNT_TITLE, X.AUXL_CODE;
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33405 4030010 318
1 33405 4030020 22
1 33405 4030030 22
1 33405 845.248 93.34 751.908
1 33408 4030010 14
1 33408 4030020 2
1 33408 4030030 2
1 33408 37.334 13.34 23.994
1 33410 4030010 992
1 33410 4030020 42
1 33410 4030030 42
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33410 2655.328 394.68 2260.648
1 33413 4030010 789
1 33413 4030020 38
1 33413 4030030 38
1 33413 5010008 1
1 33413 5010009 1
1 33413 5010012 1
1 33413 2103.855 293.302 1810.553
19 rows selected.
Elapsed: 00:00:05.03
TONY@DEV>Here are samples from the joined query
TONY@DEV> ed
Wrote file afiedt.buf
1 SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QUANTITY,
5 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT,
6 SUM(NVL(A.AGAC_AMT, 0)) PAID,
7 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
8 FROM ISTD_STOCK_MOUVEMENTS_M M ,
9 ISTD_STOCK_MOUVEMENTS_D D,
10 IACD_AUXILIARIES X,
11 IACD_PAYM_AGING A
12 WHERE M.TMVS_CODE = D.TMVS_CODE
13 AND M.CPNY_CODE = D.CPNY_CODE
14 AND M.BRCH_CODE = D.BRCH_CODE
15 AND M.MVTS_YEAR = D.MVTS_YEAR
16 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
17 AND X.AUXL_TYPE = M.AUXL_TYPE
18 AND X.AUXL_CODE = M.AUXL_CODE
19 AND X.AUXL_TYPE = A.AUXL_TYPE
20 AND X.AUXL_CODE = A.AUXL_CODE
21 AND X.AUXL_RPRSNT_TITLE = 1
22 AND M.AUXL_TYPE = 1
23* GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE
TONY@DEV> /
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33405 4030010 10494 30428.928 3360.24 27068.688
1 33405 4030020 726 845.248 93.34 751.908
1 33405 4030030 726 845.248 93.34 751.908
1 33408 4030010 140 373.34 133.4 239.94
1 33408 4030020 20 37.334 13.34 23.994
1 33408 4030030 20 37.334 13.34 23.994
1 33410 4030010 56544 164630.336 24470.16 140160.176
1 33410 4030020 2394 10621.312 1578.72 9042.592
1 33410 4030030 2394 13276.64 1973.4 11303.24
1 33413 4030010 56808 151477.56 21117.744 130359.816
1 33413 4030020 2736 10519.275 1466.51 9052.765
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33413 4030030 2736 10519.275 1466.51 9052.765
1 33413 5010008 72 2103.855 293.302 1810.553
1 33413 5010009 72 2103.855 293.302 1810.553
1 33413 5010012 72 2103.855 293.302 1810.553
15 rows selected.
Elapsed: 00:00:03.09
TONY@DEV> ED
Wrote file afiedt.buf
1 SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QUANTITY,
5 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT,
6 SUM(NVL(A.AGAC_AMT, 0)) PAID,
7 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
8 FROM ISTD_STOCK_MOUVEMENTS_M M ,
9 ISTD_STOCK_MOUVEMENTS_D D,
10 IACD_AUXILIARIES X,
11 IACD_PAYM_AGING A
12 WHERE M.TMVS_CODE = D.TMVS_CODE
13 AND M.CPNY_CODE = D.CPNY_CODE
14 AND M.BRCH_CODE = D.BRCH_CODE
15 AND M.MVTS_YEAR = D.MVTS_YEAR
16 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
17 AND X.AUXL_TYPE = M.AUXL_TYPE
18 AND X.AUXL_CODE = M.AUXL_CODE
19 AND X.AUXL_TYPE = A.AUXL_TYPE
20 AND X.AUXL_CODE = A.AUXL_CODE
21 AND A.AUXL_CODE = M.AUXL_CODE
22 AND A.AUXL_TYPE = M.AUXL_TYPE
23 AND X.AUXL_RPRSNT_TITLE = 1
24 AND M.AUXL_TYPE = 1
25* GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE
TONY@DEV> /
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33405 4030010 10494 30428.928 3360.24 27068.688
1 33405 4030020 726 845.248 93.34 751.908
1 33405 4030030 726 845.248 93.34 751.908
1 33408 4030010 140 373.34 133.4 239.94
1 33408 4030020 20 37.334 13.34 23.994
1 33408 4030030 20 37.334 13.34 23.994
1 33410 4030010 56544 164630.336 24470.16 140160.176
1 33410 4030020 2394 10621.312 1578.72 9042.592
1 33410 4030030 2394 13276.64 1973.4 11303.24
1 33413 4030010 56808 151477.56 21117.744 130359.816
1 33413 4030020 2736 10519.275 1466.51 9052.765
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33413 4030030 2736 10519.275 1466.51 9052.765
1 33413 5010008 72 2103.855 293.302 1810.553
1 33413 5010009 72 2103.855 293.302 1810.553
1 33413 5010012 72 2103.855 293.302 1810.553
15 rows selected.
Elapsed: 00:00:00.02
TONY@DEV>
Note: If I join the A table with D table the query's returning no rows
Any suggestions are apreciated
Tony S. GarabedianHi Laurent,
I've got the same results as the joined tables without UNION.
The AUXL_CODE column is detail in the D table and master in M table the query is counting the detail records over and over when joined with table A where the function SUM is executed against columns in this table even with grouping sets
Am I correct??
I'm sure there is (must be) another way other than UNION and all the lengthy query but I just can't figure it out.
samples
1 SELECT X.AUXL_RPRSNT_TITLE,
2 X.AUXL_CODE,
3 D.ITEM_CODE,
4 DECODE(GROUPING(X.AUXL_CODE), 1, SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R))) QTY,
5 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT, SUM(NVL(A.AGAC_AMT, 0)) PAID,
6 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
7 FROM ISTD_STOCK_MOUVEMENTS_M M ,
8 ISTD_STOCK_MOUVEMENTS_D D,
9 IACD_AUXILIARIES X,
10 IACD_PAYM_AGING A
11 WHERE M.TMVS_CODE = D.TMVS_CODE
12 AND M.CPNY_CODE = D.CPNY_CODE
13 AND M.BRCH_CODE = D.BRCH_CODE
14 AND M.MVTS_YEAR = D.MVTS_YEAR
15 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
16 AND X.AUXL_TYPE = M.AUXL_TYPE
17 AND X.AUXL_CODE = M.AUXL_CODE
18 AND X.AUXL_TYPE = A.AUXL_TYPE
19 AND X.AUXL_CODE = A.AUXL_CODE
20 AND A.AUXL_CODE = M.AUXL_CODE
21 AND A.AUXL_TYPE = M.AUXL_TYPE
22 AND X.AUXL_RPRSNT_TITLE = 1
23 AND M.AUXL_TYPE = 1
24* GROUP BY GROUPING SETS((X.AUXL_RPRSNT_TITLE), (X.AUXL_RPRSNT_TITLE, X.AUXL_CODE), (X.AUXL_RPRSNT_TITLE, X.AUXL_CODE, D.ITEM_CODE))
TONY@RIM> /
AUXL_RPRSNT_TITLE AUXL_CODE ITEM_CODE QTY AMT PAID DUE
1 33405 4030010 32162.102 3453.58 28708.522
1 33405 4030020 869.246 93.34 775.906
1 33405 4030030 869.246 93.34 775.906
1 33405 33900.594 3640.26 30260.334
1 33408 4030010 373.34 133.4 239.94
1 33408 4030020 37.334 13.34 23.994
1 33408 4030030 37.334 13.34 23.994
1 33408 448.008 160.08 287.928
1 33410 4030010 171351.747 24864.84 146486.907
1 33410 4030020 10879.476 1578.72 9300.756
1 33410 4030030 13599.345 1973.4 11625.945
AUXL_RPRSNT_TITLE AUXL_CODE ITEM_CODE QTY AMT PAID DUE
1 33410 195830.568 28416.96 167413.608
1 33413 4030010 157668.977 21411.046 136257.931
1 33413 4030020 10799.245 1466.51 9332.735
1 33413 4030030 10799.245 1466.51 9332.735
1 33413 5010008 2159.849 293.302 1866.547
1 33413 5010009 2159.849 293.302 1866.547
1 33413 5010012 2159.849 293.302 1866.547
1 33413 185747.014 25223.972 160523.042
1 141375 415926.184 57441.272 358484.912
20 rows selected.
TONY@RIM> SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QUANTITY,
5 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT,
6 SUM(NVL(A.AGAC_AMT, 0)) PAID,
7 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
8 FROM ISTD_STOCK_MOUVEMENTS_M M ,
9 ISTD_STOCK_MOUVEMENTS_D D,
10 IACD_AUXILIARIES X,
11 IACD_PAYM_AGING A
12 WHERE M.TMVS_CODE = D.TMVS_CODE
13 AND M.CPNY_CODE = D.CPNY_CODE
14 AND M.BRCH_CODE = D.BRCH_CODE
15 AND M.MVTS_YEAR = D.MVTS_YEAR
16 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
17 AND X.AUXL_TYPE = M.AUXL_TYPE
18 AND X.AUXL_CODE = M.AUXL_CODE
19 AND X.AUXL_TYPE = A.AUXL_TYPE
20 AND X.AUXL_CODE = A.AUXL_CODE
21 AND A.AUXL_CODE = M.AUXL_CODE
22 AND A.AUXL_TYPE = M.AUXL_TYPE
23 AND X.AUXL_RPRSNT_TITLE = 1
24 AND M.AUXL_TYPE = 1
25 GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE;
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33405 4030010 11118 32162.102 3453.58 28708.522
1 33405 4030020 748 869.246 93.34 775.906
1 33405 4030030 748 869.246 93.34 775.906
1 33408 4030010 140 373.34 133.4 239.94
1 33408 4030020 20 37.334 13.34 23.994
1 33408 4030030 20 37.334 13.34 23.994
1 33410 4030010 58812 171351.747 24864.84 146486.907
1 33410 4030020 2436 10879.476 1578.72 9300.756
1 33410 4030030 2436 13599.345 1973.4 11625.945
1 33413 4030010 59130 157668.977 21411.046 136257.931
1 33413 4030020 2774 10799.245 1466.51 9332.735
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33413 4030030 2774 10799.245 1466.51 9332.735
1 33413 5010008 73 2159.849 293.302 1866.547
1 33413 5010009 73 2159.849 293.302 1866.547
1 33413 5010012 73 2159.849 293.302 1866.547
15 rows selected.
TONY@RIM>This is with UNION and these are the correct results
TONY@RIM> ed
Wrote file afiedt.buf
1 SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QUANTITY,
5 NULL AMT,
6 NULL PAID,
7 NULL DUE
8 FROM ISTD_STOCK_MOUVEMENTS_M M ,
9 ISTD_STOCK_MOUVEMENTS_D D,
10 IACD_AUXILIARIES X
11 WHERE M.TMVS_CODE = D.TMVS_CODE
12 AND M.CPNY_CODE = D.CPNY_CODE
13 AND M.BRCH_CODE = D.BRCH_CODE
14 AND M.MVTS_YEAR = D.MVTS_YEAR
15 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
16 AND X.AUXL_TYPE = M.AUXL_TYPE
17 AND X.AUXL_CODE = M.AUXL_CODE
18 AND X.AUXL_RPRSNT_TITLE = 1
19 AND M.AUXL_TYPE = 1
20 GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE
21 UNION
22 SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
23 X.AUXL_CODE,
24 NULL ITEM_CODE,
25 NULL QUANTITY,
26 ROUND(SUM(NVL(A.AGAC_REV_AMT, 0)), 2) AMT,
27 ROUND(SUM(NVL(A.AGAC_AMT, 0)), 2) PAID,
28 ROUND(SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)), 2) DUE
29 FROM IACD_PAYM_AGING A,
30 IACD_AUXILIARIES X
31 WHERE X.AUXL_TYPE = A.AUXL_TYPE
32 AND X.AUXL_CODE = A.AUXL_CODE
33 AND X.AUXL_RPRSNT_TITLE = 1
34* GROUP BY X.AUXL_RPRSNT_TITLE, X.AUXL_CODE
TONY@RIM> /
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33405 4030010 327
1 33405 4030020 22
1 33405 4030030 22
1 33405 869.25 93.34 775.91
1 33408 4030010 14
1 33408 4030020 2
1 33408 4030030 2
1 33408 37.33 13.34 23.99
1 33410 4030010 1014
1 33410 4030020 42
1 33410 4030030 42
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33410 2719.87 394.68 2325.19
1 33413 4030010 810
1 33413 4030020 38
1 33413 4030030 38
1 33413 5010008 1
1 33413 5010009 1
1 33413 5010012 1
1 33413 2159.85 293.3 1866.55
19 rows selected.
TONY@RIM>Thanks again,
Tony
Message was edited by:
Tony Garabedian -
Are there any alternatives for mseg and mkpf
I had to display from table S032...following fields.
S032-LETZTABG --> Date: last (i.e. most recent) goods issue
S032-LETZTVER --> Date: last (i.e. most recent) consumption
However the data was not properly filled in s032 table. So I went for mseg and mkpf table to get budat based on moment types.
SELECT MSEG~MATNR
MSEG~WERKS
MSEG~LGORT
MSEG~BWART
MKPF~BUDAT
INTO TABLE IT_MSEG
FROM MKPF AS MKPF INNER JOIN MSEG AS MSEG
ON
MKPFMBLNR = MSEGMBLNR AND
MKPFMJAHR = MSEGMJAHR
FOR ALL ENTRIES IN T_OUT_TMP
WHERE MSEG~MATNR EQ T_OUT_TMP-MATNR
AND MSEG~WERKS EQ T_OUT_TMP-WERKS.
Are there any other alternative table for mseg and mkpf...
Because my above coding ( which includes above SELECT of mseg and mkpf )got performance issue...
Could you please suggest me anyu other alternative for mseg and mkpf ...Try to include the BUDAT in the selection of the MKPF.. if you don't have any restriction in MKPF than just pass an empty range.
RANGES: S_BUDAT FOR MKPF-BUDAT.
SELECT
MKPF~BUDAT "<<<
MSEG~MATNR
MSEG~WERKS
MSEG~LGORT
MSEG~BWART
INTO TABLE IT_MSEG
FROM MKPF AS MKPF INNER JOIN MSEG AS MSEG
ON
MKPF~MBLNR = MSEG~MBLNR AND
MKPF~MJAHR = MSEG~MJAHR
FOR ALL ENTRIES IN T_OUT_TMP
WHERE
MKPF~BUDAT IN S_BUDAT " <<<
MSEG~MATNR EQ T_OUT_TMP-MATNR
AND MSEG~WERKS EQ T_OUT_TMP-WERKS.
Regards,
Naimesh Patel -
What is the alternative for DisplayMemberPath="Value" for Windows Store applications?
I think there is a bug with Windows Store Applications when it comes to using DisplayMemberPath="Value".
Here is my code
<ComboBox Height="40" VerticalAlignment="Stretch" SelectedValuePath="Key" DisplayMemberPath="Value" x:Name="comboBox1" FontSize="25"/>
var source = new Dictionary<string, double>();
source.Add("Item1", 0.4);
source.Add("Item2", 0.3);
source.Add("Item3", 0.1);
source.Add("Item4", 0.1);
var formateDSource = new Dictionary<string, string>();
foreach (var item in source)
formateDSource.Add(string.Format("[{0}, {1}]", item.Key, item.Value), item.Key);
comboBox1.ItemsSource = source;
If you use this code in WPF in works perfectly. However if you use this code in a Windows Store Application then the Combo Box is empty and an error is thrown. So is there an alternative way to do this in Windows Store Applications and have I unearthed a
bug? Because I have researched the Web for days and found no solution to this.*please do not comment unless you have tried my code as a Windows Store App not a WPF in Visual Studios. Can Someone post an example based on my code that works in Windows Store
Apps please because this is terrible.
ThanksIt looks like you got an answer on SO:
http://stackoverflow.com/questions/29817124/what-is-the-alternative-for-displaymemberpath-value-for-windows-store-applicat
This does look like a bug.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
objects and unknown namespaces. -
What are the Flash alternatives for iphone and ipad?
Hello,
I would like to know what could be the Flash alternatives for iphone, ipod, and ipad. I would like to create iphone applications that have 3D animation I usually create with Flash.
But since Apple does not support the use of flash, I need to know what applications or programming languages I must use to create movies or animations for iphone or ipad.I would like to create iphone applications
Then you need to go here:
http://developer.apple.com/programs/iphone/ -
Can we implement the custom sql query in CR for joining the two tables
Hi All,
Is there anyway to implement the custom sql query in CR for joining the two tables?
My requirement here is I need to write sql logics for joining the two tables...
Thanks,
GanaIn the Database Expert, expand the Create New Connection folder and browse the subfolders to locate your data source.
Log on to your data source if necessary.
Under your data source, double-click the Add Command node.
In the Add Command to Report dialog box, enter an appropriate query/command for the data source you have opened.
For example:
SELECT
Customer.`Customer ID`,
Customer.`Customer Name`,
Customer.`Last Year's Sales`,
Customer.`Region`,
Customer.`Country`,
Orders.`Order Amount`,
Orders.`Customer ID`,
Orders.`Order Date`
FROM
Customer Customer INNER JOIN Orders Orders ON
Customer.`Customer ID` = Orders.`Customer ID`
WHERE
(Customer.`Country` = 'USA' OR
Customer.`Country` = 'Canada') AND
Customer.`Last Year's Sales` < 10000.
ORDER BY
Customer.`Country` ASC,
Customer.`Region` ASC
Note: The use of double or single quotes (and other SQL syntax) is determined by the database driver used by your report. You must, however, manually add the quotes and other elements of the syntax as you create the command.
Optionally, you can create a parameter for your command by clicking Create and entering information in the Command Parameter dialog box.
For more information about creating parameters, see To create a parameter for a command object.
Click OK.
You are returned to the Report Designer. In the Field Explorer, under Database Fields, a Command table appears listing the database fields you specified.
Note:
To construct the virtual table from your Command, the command must be executed once. If the command has parameters, you will be prompted to enter values for each one.
By default, your command is called Command. You can change its alias by selecting it and pressing F2. -
Alternative for AT NEW --- ENDAT
Hello experts,
I am using field-symbol as internal table. I cant use AT NEW statement inside this loop.
Can u pls provide alternative for above control break statement.
Thanks in advance.
Zak.Hi,
to use control break statement, first you should sort the internal table and then you use it.
Take one example:
data: begin of it9 occurs 4,
f1,
f2,
end of it9.
it9 = '1A'. append it9. "Fill it9 with data
it9 = '3A'. append it9.
it9 = '1B'. append it9.
it9 = '2B'. append it9.
sort it9 by f1.
loop at it9.
at new f1.
write: / 'start of:', it9-f1.
endat.
at end of f1.
write: / 'end of:', it9-f1.
endat.
endloop.
free it9.
Hope it is helpful.
Regards,
Chris Gu -
HT4597 what will be the new alternatives for iWeb publishing, Idisk & photo gallery ?
what will be the new alternatives for iWeb publishing, Idisk & photo gallery ?
Thanks for the reply that there will be 3rd party support.
One of the main reasons why I went from PC to Mac was because of all these cool features.
Am dissapointed to see them leave. ( Iweb, Photogallery, Idisk... ) -
Alternative for FM 'NAMETAB_GET'
Hi ,
Can any one suggest an alternative for the FM 'NAMETAB_GET' in 4.7.
Regards
ArunHi,
You did noyt specify why you want this alternative for.
Anyways, just check out RFC_GET_NAMETAB, which is also quite similar.
Regards,
Anand Mandalika. -
hello
In standard BOM for PP in T-code eg cs01 I can write alternative. But if I want to create WBS BOM with T-code cs71 I can't see such field for alternative. I checked in help.sap.com that alternative for WBS BOM are not used. I don't know why but there is not alternative filed in CS71.
So is there any other way to get alternatives for WBS BOM like modification, exit etc.
I checked SAP notes for this but I can't find.
Any help?hello
Thank you for your answers.
I have business process where I need WBS alternative. Why? Because of history of changes. My client wants to have 2 versions of one WBS BOM. One for history only and second for operative work. After some changes in WBS BOM and finish the project my client wants to analyse historical version which is created when project starts and the last operative version of the same WBS BOM.
@Uddhab
>If we prepare two BOM for a single WBS and attach the same in the WBS, then 2 requirement will flow and there will additional >quantity in the production.
Yes, if we attach. I want to attach only one WBS BOM so I don't multiply quantity. -
Hi
I am migrating my desktop from Windows 2000 to Redhat Linux 9.
I have been using third party tool TOAD for accessing the data from the database. As TOAD does not have a Linux setup, can any one suggest an alternative for the same.
Thanks in advance.
Manojyou are posting in the wrong forum.. this forum is for the Desktop Datacenter Oracle on Linux VMware kit..
you'll get better luck in other forums or better yet, Google.. I put toad and linux as keywords and got lots of hits on TOra.. so you might research that way..
good luck,
locking. -
Alternative for "FND FLEXSQL" in PLSQL
Hi All
I have a requirement to created a PLSQL based report for GL data, with range of GL CC as parameter. This could be achived in Oracle reports through user exit FND FLEXSQL.
But is there an alternative for FLEXSQL to be used in PLSQL. I came across a package FND_FLEX_ORACLE_REPORTS_APIS, but the no contents, it is set to return the message "'This API has not been implemented yet...';".
The version of the package is /* $Header: AFFFORAB.pls 120.1.12010000.1 2008/07/25 14:14:12 appldev ship $ */
Is there a newer version for this? or is there an alternative?Can u look into gl_flexfields_pkg and see if this helps.
Cheers,
ND
Maybe you are looking for
-
Hi, In my present project we have requirement for developing ALV tree output using ALV configuration model in WD4A. Please provide sample code or tutorial related to ALV Tree development in WebDynpro ABAP. Best regards, Alleiah
-
Can't login to client computers
Hello, I try to evaluate Leopard Server for my home network and have come to a dead end. The most important task for it would be to share user accounts among several client computers, that is to finally use portable homes. I tried to set up networked
-
Seeburger BIC Mapping Designer Documentation
Hi Seeburger users out there, Would you have any documentation on the BIC Mapping Designer? Rgds, Yves
-
Prime Infrastructure 1.3.0.20 - High CPU Load
Hi community, we have a running Prime Installation (setup a few month ago), and since the last 2-3 weeks my customers admins complain that the system´s response time is very slow, regardless which browser they use. I already did a "ncs cleanup" thro
-
Swingbench error when starting swingbench. (more like java problem)
Platform: Solari 10, Oracle 10gR2. I downloaded the swingbench for load testing from http://www.dominicgiles.com/swingbench.php for version 2.2 and 2.3. and unzip it in Solari 10 at $HOME (/export/home/oracle/swingbench). As result, it create a folde