How to improve performance of the below code.
Hello.
This below code is show 80% database performance in runtime analysis ( transaction SE30). I am using view KNA1VV for retrieving data using customer and sales area from selection screen.
Please advice how can I improve the performance of below code.
Fetch the customer details from view KNA1VV
SELECT kunnr
vkorg
vtweg
spart
land1
name1
ort01
pstlz
regio
stras
INTO TABLE t_cust
FROM kna1vv
WHERE kunnr IN s_kunnr
AND vkorg IN s_vkorg
AND vtweg IN s_vtweg
AND spart IN s_spart
AND loevm = space
AND loevm_knvv = space.
IF sy-subrc EQ 0.
SORT t_cust BY kunnr.
ELSE.
w_flag = c_true_x.
ENDIF.
Fetch customers for entered company code
IF NOT t_cust[] IS INITIAL AND NOT s_bukrs IS INITIAL.
SELECT kunnr
FROM knb1
INTO TABLE lt_knb1
FOR ALL ENTRIES IN t_cust
WHERE kunnr = t_cust-kunnr
AND bukrs IN s_bukrs
AND loevm = space.
Thanks,
80% is just a relation and must not be problematic, what about the absolute runtime, is that acceptable?
Also, your range S_KUNNR could contain anything from a single value (super fast) to nothing (probably slow, depends on number of entries in KNA1VV), so what do you expect here?
Thomas
Similar Messages
-
How to improve performance of the attached query
Hi,
How to improve performance of the below query, Please help. also attached explain plan -
SELECT Camp.Id,
rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount,
(SUM(rCam.Impressions) * 0.001 + SUM(rCam.Clickthrus)) AS GR,
rCam.AccountKey as AccountKey
FROM Campaign Camp, rCamSit rCam, CamBilling, Site xSite
WHERE Camp.AccountKey = rCam.AccountKey
AND Camp.AvCampaignKey = rCam.AvCampaignKey
AND Camp.AccountKey = CamBilling.AccountKey
AND Camp.CampaignKey = CamBilling.CampaignKey
AND rCam.AccountKey = xSite.AccountKey
AND rCam.AvSiteKey = xSite.AvSiteKey
AND rCam.RmWhen BETWEEN to_date('01-01-2009', 'DD-MM-YYYY') and
to_date('01-01-2011', 'DD-MM-YYYY')
GROUP By rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount
Explain Plan :-
Description Object_owner Object_name Cost Cardinality Bytes
SELECT STATEMENT, GOAL = ALL_ROWS 14 1 13
SORT AGGREGATE 1 13
VIEW GEMINI_REPORTING 14 1 13
HASH GROUP BY 14 1 103
NESTED LOOPS 13 1 103
HASH JOIN 12 1 85
TABLE ACCESS BY INDEX ROWID GEMINI_REPORTING RCAMSIT 2 4 100
NESTED LOOPS 9 5 325
HASH JOIN 7 1 40
SORT UNIQUE 2 1 18
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY SITE 2 1 18
INDEX RANGE SCAN GEMINI_PRIMARY SITE_I0 1 1
TABLE ACCESS FULL GEMINI_PRIMARY SITE 3 27 594
INDEX RANGE SCAN GEMINI_REPORTING RCAMSIT_I 1 1 5
TABLE ACCESS FULL GEMINI_PRIMARY CAMPAIGN 3 127 2540
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY CAMBILLING 1 1 18
INDEX UNIQUE SCAN GEMINI_PRIMARY CAMBILLING_U1 0 1duplicate thread..
How to improve performance of attached query -
Performance for the below code
Can any one help me in improving the performance for the below code.
FORM RETRIEVE_DATA .
CLEAR WA_TERRINFO.
CLEAR WA_KNA1.
CLEAR WA_ADRC.
CLEAR SORT2.
*To retrieve the territory information from ZPSDSALREP
SELECT ZZTERRMG
ZZSALESREP
NAME1
ZREP_PROFILE
ZTEAM
INTO TABLE GT_TERRINFO
FROM ZPSDSALREP.
*Preparing Corporate ID from KNA1 & ADRC and storing it in SORT2 field
LOOP AT GT_TERRINFO INTO WA_TERRINFO.
SELECT SINGLE * FROM KNA1 INTO WA_KNA1
WHERE KUNNR = WA_TERRINFO-SALESREP.
SELECT SINGLE * FROM ADRC INTO WA_ADRC
WHERE ADDRNUMBER = WA_KNA1-ADRNR.
IF NOT WA_ADRC-SORT2 IS INITIAL.
CONCATENATE 'U' WA_ADRC-SORT2 INTO SORT2.
MOVE SORT2 TO WA_TERRINFO-SORT2.
MODIFY GT_TERRINFO1 FROM WA_TERRINFO.
APPEND WA_TERRINFO TO GT_TERRINFO1.
CLEAR WA_TERRINFO.
ENDIF.
CLEAR WA_KNA1.
CLEAR WA_ADRC.
ENDLOOP.
ENDFORM. " RETRIEVE_DATAHi
The code is easy so I don't think you can do nothing, only u can try to limit the reading of KNA1:
FORM RETRIEVE_DATA .
CLEAR WA_TERRINFO.
CLEAR WA_KNA1.
CLEAR WA_ADRC.
CLEAR SORT2.
*To retrieve the territory information from ZPSDSALREP
SELECT ZZTERRMG
ZZSALESREP
NAME1
ZREP_PROFILE
ZTEAM
INTO TABLE GT_TERRINFO
FROM ZPSDSALREP.
SORT GT_TERRINFO BY SALESREP.
*Preparing Corporate ID from KNA1 & ADRC and storing it in SORT2 field
LOOP AT GT_TERRINFO INTO WA_TERRINFO.
IF KNA1-KUNNR <> WA_KNA1-KUNNR.
SELECT SINGLE * FROM KNA1 INTO WA_KNA1
WHERE KUNNR = WA_TERRINFO-SALESREP.
IF SY-SUBRC <> 0.
CLEAR: WA_KNA1, WA_ADRC.
ELSE.
SELECT SINGLE * FROM ADRC INTO WA_ADRC
WHERE ADDRNUMBER = WA_KNA1-ADRNR.
IF SY-SUBRC <> 0. WA_ADRC. ENDIF.
ENDIF.
ENDIF.
IF NOT WA_ADRC-SORT2 IS INITIAL.
CONCATENATE 'U' WA_ADRC-SORT2 INTO SORT2.
MOVE SORT2 TO WA_TERRINFO-SORT2.
* MODIFY GT_TERRINFO1 FROM WA_TERRINFO.
APPEND WA_TERRINFO TO GT_TERRINFO1.
CLEAR WA_TERRINFO.
ENDIF.
ENDLOOP.
ENDFORM. " RETRIEVE_DATA
If program takes many times to upload the data from ZPSDSALREP, you can try to split in sevaral packages:
SELECT ZZTERRMG ZZSALESREP NAME1 ZREP_PROFILE ZTEAM
INTO TABLE GT_TERRINFO PACKAGE SIZE <...>
FROM ZPSDSALREP.
SORT GT_TERRINFO BY SALESREP.
*Preparing Corporate ID from KNA1 & ADRC and storing it in SORT2 field
LOOP AT GT_TERRINFO INTO WA_TERRINFO.
IF KNA1-KUNNR <> WA_KNA1-KUNNR.
SELECT SINGLE * FROM KNA1 INTO WA_KNA1
WHERE KUNNR = WA_TERRINFO-SALESREP.
IF SY-SUBRC <> 0.
CLEAR: WA_KNA1, WA_ADRC.
ELSE.
SELECT SINGLE * FROM ADRC INTO WA_ADRC
WHERE ADDRNUMBER = WA_KNA1-ADRNR.
IF SY-SUBRC <> 0. WA_ADRC. ENDIF.
ENDIF.
ENDIF.
IF NOT WA_ADRC-SORT2 IS INITIAL.
CONCATENATE 'U' WA_ADRC-SORT2 INTO SORT2.
MOVE SORT2 TO WA_TERRINFO-SORT2.
* MODIFY GT_TERRINFO1 FROM WA_TERRINFO.
APPEND WA_TERRINFO TO GT_TERRINFO1.
CLEAR WA_TERRINFO.
ENDIF.
ENDLOOP.
ENDSELECT.
Max -
How to improve Performance of the Statements.
Hi,
I am using Oracle 10g. My problem is when i am Execute & fetch the records from the database it is taking so much time. I have created Statistics also but no use. Now what i have to do to improve the Performance of the SELECT, INSERT, UPDATE, DELETE Statements.
Is it make any differents because i am using WindowsXP, 1 GB RAM in Server Machine, and WindowsXP, 512 GB RAM in Client Machine.
Pls. Give me advice for me to improve Performance.
Thank u...!What and where to change parameters and values ?Well, maybe my previous post was not clear enough, but if you want to keep your job, you shouldn't change anything else on init parameter and you shouldn't fall in the Compulsive Tuning Disorder.
Everyone who advise you to change some parameters to some value without any more info shouldn't be listen.
Nicolas. -
How to improve performance of the program
I have this program which loops 3 times and in each loop it creates differents variants and calls the program passing these variants. Now the pple who run this program say that the performance of the program decreased. They say that if this run it takes 3times more time than running individual program 3 times seperately. Any ideas on how i should go about this. Seems like with in the loop the all the information about the second program which is being called is stored.Any ideas on how to clear the program memory with in the loop.
Let me explain in little more detail. The program which i wrote create variants in a loop and passes them to the report which is also called inside the loop like.
do 3 times.
*create variant.
submit <program> X via selection-screen using tables....
enddo.
Now what this report does is it just retrieves like 500,000 records and updates them to another table. -
Improve performance of the below query
Hi Gurus,
I have following query with the plan described. I need to improve the the performance of this query as it is using full table scans.
How could achieve this.
SELECT csf.*,
NULL subject_flag,
NULL next_exp_rewards_date,
0 next_exp_rewards,
(csf.rewards_cf - csf.rewards_bf - csf.total_rewards) * -1 reward_spent
FROM crm_statement_fulfilled csf, crm_accounts ca
WHERE csf.account_id = ca.account_id
AND csf.procg_date = '01-jul-2012'
AND ca.cycle_id = '01'
AND ca.date_closed IS NULL
AND ca.account_type IN ('LTT', 'LTY', 'LYI')
ORDER BY csf.account_id
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
Connected as crm
SQL> desc crm_statement_fulfilled
Name Type Nullable Default Comments
ACCOUNT_ID NUMBER(19)
CAMPAIGN_ID NUMBER(10)
CYCLE_ID VARCHAR2(2)
CUSTOMER_ID NUMBER(14) Y
PROCG_DATE DATE
GE_FULFILLED VARCHAR2(1) Y
POINTS_DISPLAYED VARCHAR2(1) Y
REASON_ID VARCHAR2(10) Y
POINTS_BF NUMBER(10,2) Y
PROMO_POINTS NUMBER(10,2) Y
GW_ADJ_POINTS NUMBER(10,2) Y
TOTAL_REWARDS NUMBER(10,2) Y
GW_FUL_POINTS NUMBER(10,2) Y
REC_POINTS NUMBER(10,2) Y
REC_FC_POINTS NUMBER(10,2) Y
POINTS_CONVERTED NUMBER(10,2) Y
POINTS_CF NUMBER(10,2) Y
TOTAL_POINTS NUMBER(10,2) Y
TOTAL_AIR_MILES_VALUE NUMBER(10) Y
POINTS_EXPIRED NUMBER(10,2) Y
CDT_IN_STR_POINTS NUMBER(10,2) Y
CDT_OUT_STR_POINTS NUMBER(10,2) Y
ANNIVERSARY_POINTS NUMBER(10,2) Y
LOYALTY_POINTS NUMBER(10,2) Y
NEXT_EXP_POINTS NUMBER(10,2) Y
NEXT_EXP_POINTS_DATE DATE Y
REWARDS_BF NUMBER(10,2) Y
REWARDS_CF NUMBER(10,2) Y
SQL> desc crm_accounts
Name Type Nullable Default Comments
ACCOUNT_ID NUMBER(19)
CYCLE_ID VARCHAR2(2)
ACCOUNT_TYPE VARCHAR2(3)
SECURITY_PASSWORD VARCHAR2(80) Y
ACCESS_PASSWORD VARCHAR2(80) Y
AIRMILES_ID VARCHAR2(16) Y
DATE_OPENED DATE
SEED VARCHAR2(1) Y
AUTO_AIRMILES VARCHAR2(1) Y
CURRENCY VARCHAR2(3) Y
DATE_CLOSED DATE Y
STORE_OPENED VARCHAR2(4) Y
DATE_ACTIVATED DATE Y
OLD_ACCOUNT_ID NUMBER(19) Y
CARDPAC_ACCOUNT_ID NUMBER(19) Y
ORG_ID VARCHAR2(10) Y
LOGO_ID VARCHAR2(10) Y
PTS_TO_ACCOUNT_ID NUMBER(19) Y
DMW_ACCOUNT_ID VARCHAR2(19) Y
SQL>Hi,
Sid_ Z. wrote:
Hi Gurus,
I have following query with the plan described. I need to improve the the performance of this query as it is using full table scans...For all tuning requests, see the forum FAQ {message:id=9360003}
AND csf.procg_date = '01-jul-2012'Don't try to compare a DATE (such as procg_date) with as VARCHAR2 (such as '01-jul-2012'.
Use TO_DATE or a DATE literal instead. -
How to improve performance in the following PL/SQL
I'm running this PL/SQL in a Job step inside a UNIX job, is taking too long to finish and is a simple process to do but definetely there is something that I need to do.
I have to find records that are not included in my T_XREF table from my temporary table T_TEMP, identify those records and insert a new record with values located in the T_TEMP table into the T_XREF table.
T_TEMP has 2 millions records and T_XREF has 12,000 records, I have a Unique IDX in T_TEMP (claim,num_dtl) and a NON UNIQUE IDX by (7 fields).
on the T_XREF table I have 1 UNIQUE IDX (comp_key).
this is part of the PL/SQL:
DECLARE
v_rowid ROWID;
CURSOR c_FixComp1 IS
SELECT DISTINCT sak_acct,ind_split,cde_state,cde_fed,med_a,med_b,ind_cnty
FROM T_TEMP
WHERE claim >= 0;
BEGIN
FOR r_FixComp1 IN c_FixComp1 LOOP
BEGIN
SELECT ROWID
INTO v_rowid
FROM T_XREF x
WHERE x.sak_acct = r_FixComp1.sak_acct
AND x.ind_split = r_FixComp1.ind_split
AND x.cde_state = r_FixComp1.cde_state
AND x.cde_fed = r_FixComp1.cde_fed
AND x.med_a = r_FixComp1.med_a
AND x.med_b = r_FixComp1.med_b
AND x.ind_cnty = r_FixComp1.ind_cnty;
EXCEPTION
WHEN NO_DATA_FOUND THEN
INSERT INTO T_XREF
(comp_key,
sak_acct,
ind_split,
cde_state,
cde_fed,
med_a,
med_b,
ind_cnty)
VALUES
(seq_xref.Nextval,
r_FixComp1.sak_acct,
r_FixComp1.ind_split,
r_FixComp1.cde_state,
r_FixComp1.cde_fedt,
r_FixComp1.med_a,
r_FixComp1.med_b,
r_FixComp1.ind_cnty);
WHEN OTHERS THEN
cnt_notinserted := cnt_notinserted + 1;
END;
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
END;
in my Cursor's query I'm forcing to do a IDX (range scan) and the result of that query is only 1300 rec after doing the DISTINCT of those fields. When starts analyzing record by record this simple script takes more than 10 hrs to run!!!
I'll appreciate any advice you can give me. ThanksThe reason your code is slow is that you are doing something that wasn't even best practice in version 7.0.12. Chris Poole is absolutely correct: There is no reason for any procedural code.
Even if there were a valid reason for PL/SQL the row-by-row cursor fetch construct has been obsolete for 6 years.
Do what Chris is suggesting here and then put away the cursor loops and learn how to write this code:
http://www.psoug.org/reference/array_processing.html
Check out the SLOW_WAY and FAST_WAY demos. -
How to rpad spaces for the below code
begin
dbms_output.put_line(rpad(null,10,' ') ||'b');
end;
The output is not appending spaces. I have a requirement to append spaces between columns. Some times the column will be empty. In that case the space is not getting appended.Please let me know the solution.
thanks,
VinodhHi,
It is just DBMS_OUTPUT issue nothing else.
SQL> ed
Wrote file afiedt.buf
1 declare
2 a VARCHAR2(20);
3 begin
4 a:= rpad(' ',10,' ');
5 dbms_output.put_line(a||'b');
6* end;
SQL> /
b
PL/SQL procedure successfully completed.
SQL> ed
Wrote file afiedt.buf
1 declare
2 a VARCHAR2(20);
3 begin
4 a:= rpad(' ',10,' ');
5 dbms_output.put_line(LENGTH(a)||'b'); -- Tried through variable also
6* end;
SQL> /
10b
PL/SQL procedure successfully completed.
SQL> ed
Wrote file afiedt.buf
1 declare
2 a VARCHAR2(20);
3 begin
4 a:= rpad(' ',10,' ');
5 dbms_output.put_line(' '||'b'); -- Here 10 Hardcoded Blanks
6* end;
SQL> /
b
PL/SQL procedure successfully completed.
SQL> -
How to improve performance of attached query
Hi,
How to improve performance of the below query, Please help. also attached explain plan -
SELECT Camp.Id,
rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount,
(SUM(rCam.Impressions) * 0.001 + SUM(rCam.Clickthrus)) AS GR,
rCam.AccountKey as AccountKey
FROM Campaign Camp, rCamSit rCam, CamBilling, Site xSite
WHERE Camp.AccountKey = rCam.AccountKey
AND Camp.AvCampaignKey = rCam.AvCampaignKey
AND Camp.AccountKey = CamBilling.AccountKey
AND Camp.CampaignKey = CamBilling.CampaignKey
AND rCam.AccountKey = xSite.AccountKey
AND rCam.AvSiteKey = xSite.AvSiteKey
AND rCam.RmWhen BETWEEN to_date('01-01-2009', 'DD-MM-YYYY') and
to_date('01-01-2011', 'DD-MM-YYYY')
GROUP By rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount
Explain Plan :-
Description Object_owner Object_name Cost Cardinality Bytes
SELECT STATEMENT, GOAL = ALL_ROWS 14 1 13
SORT AGGREGATE 1 13
VIEW GEMINI_REPORTING 14 1 13
HASH GROUP BY 14 1 103
NESTED LOOPS 13 1 103
HASH JOIN 12 1 85
TABLE ACCESS BY INDEX ROWID GEMINI_REPORTING RCAMSIT 2 4 100
NESTED LOOPS 9 5 325
HASH JOIN 7 1 40
SORT UNIQUE 2 1 18
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY SITE 2 1 18
INDEX RANGE SCAN GEMINI_PRIMARY SITE_I0 1 1
TABLE ACCESS FULL GEMINI_PRIMARY SITE 3 27 594
INDEX RANGE SCAN GEMINI_REPORTING RCAMSIT_I 1 1 5
TABLE ACCESS FULL GEMINI_PRIMARY CAMPAIGN 3 127 2540
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY CAMBILLING 1 1 18
INDEX UNIQUE SCAN GEMINI_PRIMARY CAMBILLING_U1 0 1duplicate thread..
How to improve performance of attached query -
How can i write the below code using "For all entries"
Hi
How can we write the below code using "for all entries" and need to avoid joins...
Please help
SELECT aaufnr aobjnr aauart atxjcd a~pspel
agstrp awerks carbpl cwerks
INTO TABLE t_caufv
FROM caufv AS a
INNER JOIN afih AS b
ON aaufnr = baufnr
INNER JOIN crhd AS c
ON bgewrk = cobjid
AND c~objty = 'D'
WHERE ( a~pspel = space
OR a~txjcd = space
OR NOT a~objnr IN
( select OBJNR from COBRB AS e
WHERE objnr = a~objnr ) )
AND a~werks IN s_plant
AND a~auart IN s_wtype
AND NOT a~objnr IN
( select OBJNR from JEST AS d
WHERE objnr = a~objnr
AND ( dstat = 'A0081'OR dstat = 'A0018' )
AND d~inact 'X' ).
Reward points for all helpfull answers
Thanks
Ammi.Hi,
SELECT objnr objid aufnr
from afih
into table t_afih.
SELECT objnr
from JEST
into table t_JEST
where stat = 'A0045'
OR stat = 'A0046'
AND inact 'X'.
SELECT objnr
from COBRB
into table t_cobrb.
SELECT arbpl werks objid objty
from crhd
INTO table it_crhd
FOR ALL ENTRIES IN it_afih
WHERE objty eq 'D'
AND gewrk = it_afih-objid.
SELECT aufnr objnr auart txjcd pspel gstrp werks aufnr
FROM caufv
INTO table t_caufv
FOR ALL ENTRIES IN it_afih
WHERE aufnr = it_afih-aufnr
And pspel = ' '
AND txjcd = ' '
ANd objnr ne it_crhd-objnr
AND auart in s_wtype
AND werks in s_plant.
AND objnr ne it_jest-objnr.
dont use NE in the select statements, it may effect performance also. Instead use if statements inside
loops.
loop at t_caufv.
read table it_chrd............
if t_caufv-objnr ne it_chrd-objnr.
read table it_jest..........
if if t_caufv-objnr ne it_jest-objnr.
(proceed further).
endif.
endif.
endloop.
hope this helps.
Reward if useful.
Regards,
Anu -
Please optimize the below code!!!!urgent
friends,
i know that cluster tables cannot be joined with transparent tables....
however i need performance improvement for the following code....
if possible is there a way to join bkpf or bseg to improve performance....can we create view foe bkpf and bseg if yes then how.....
please modify the below code for improvement in performance.
START-OF-SELECTION.
SELECT bukrs belnr gjahr budat FROM bkpf INTO TABLE i_bkpf
WHERE bukrs = p_bukrs AND "COMPANY CODE
gjahr = p_gjahr AND "FISCAL YEAR
budat IN s_budat. "POSTING DATE IN DOC
IF sy-subrc = 0.
SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
i_bseg FOR ALL ENTRIES IN i_bkpf
WHERE bukrs = i_bkpf-bukrs AND "COMPANY CODE
belnr = i_bkpf-belnr AND "A/CING DOC NO
gjahr = i_bkpf-gjahr AND "FISCAL YEAR
hkont = p_hkont. "General Ledger Account"
IF sy-subrc = 0.
SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
i_bseg1 FOR ALL ENTRIES IN i_bseg
WHERE bukrs = i_bseg-bukrs AND "COMPANY CODE
belnr = i_bseg-belnr AND "A/CING DOC NO
gjahr = i_bseg-gjahr. "FISCAL YEAR
ENDIF.
ENDIF.
IF NOT i_bseg1[] IS INITIAL.
LOOP AT i_bseg1.
IF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'S'.
v_sumgl = v_sumgl + i_bseg1-dmbtr.
ELSEIF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'H'.
v_sumgl = v_sumgl - i_bseg1-dmbtr.
ELSEIF i_bseg1-hkont NE p_hkont .
IF i_bseg1-shkzg = 'H'.
i_bseg1-dmbtr = - i_bseg1-dmbtr.
ENDIF.
i_alv-hkont = i_bseg1-hkont.
i_alv-dmbtr = i_bseg1-dmbtr.
APPEND i_alv.
v_sumoffset = v_sumoffset + i_bseg1-dmbtr.
ENDIF.
ENDLOOP.
regards
Essam.([email protected])Hi ,
<b>Pls use for all entries as below to join these two tables :</b>
For pool and cluster table you can create secondary index and you can use select distinct, group for pool and cluster table. You can use native SQL statement for pool and cluster table.
see the query for Bseg table :
example :
*Code to demonstrate select command
*Code to demonstrate select into internal table command
TYPES: BEGIN OF t_bkpf,
* include structure bkpf.
bukrs LIKE bkpf-bukrs,
belnr LIKE bkpf-belnr,
gjahr LIKE bkpf-gjahr,
bldat LIKE bkpf-bldat,
monat LIKE bkpf-monat,
budat LIKE bkpf-budat,
xblnr LIKE bkpf-xblnr,
awtyp LIKE bkpf-awtyp,
awkey LIKE bkpf-awkey,
END OF t_bkpf.
DATA: it_bkpf TYPE STANDARD TABLE OF t_bkpf INITIAL SIZE 0,
wa_bkpf TYPE t_bkpf.
TYPES: BEGIN OF t_bseg,
*include structure bseg.
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
gjahr LIKE bseg-gjahr,
buzei LIKE bseg-buzei,
mwskz LIKE bseg-mwskz, "Tax code
umsks LIKE bseg-umsks, "Special G/L transaction type
prctr LIKE bseg-prctr, "Profit Centre
hkont LIKE bseg-hkont, "G/L account
xauto LIKE bseg-xauto,
koart LIKE bseg-koart,
dmbtr LIKE bseg-dmbtr,
mwart LIKE bseg-mwart,
hwbas LIKE bseg-hwbas,
aufnr LIKE bseg-aufnr,
projk LIKE bseg-projk,
shkzg LIKE bseg-shkzg,
kokrs LIKE bseg-kokrs,
END OF t_bseg.
DATA: it_bseg TYPE STANDARD TABLE OF t_bseg INITIAL SIZE 0,
wa_bseg TYPE t_bseg.
*Select FOR ALL ENTRIES command
SELECT bukrs belnr gjahr bldat monat budat xblnr awtyp awkey
UP TO 100 ROWS
FROM bkpf
INTO TABLE it_bkpf.
IF sy-subrc EQ 0.
* The FOR ALL ENTRIES comand only retrieves data which matches
* entries within a particular internal table.
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
dmbtr mwart hwbas aufnr projk shkzg kokrs
FROM bseg
INTO TABLE it_bseg
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs EQ it_bkpf-bukrs AND
belnr EQ it_bkpf-belnr AND
gjahr EQ it_bkpf-gjahr.
ENDIF.
<b>Pls reward pts if found usefull :)</b>
regards
Sathish -
How to improve performance of select query when primary key is not referred
Hi,
There is a select query where we are unable to refrence primary key of the tables:
Since, the the below code is refrensing to vgbel and vgpos fields instead of vbeln and posnr..... the performance is very slow.
select vbeln posnr into (wa-vbeln1, wa-posnr1)
from lips
where ( pstyv ne 'ZBAT'
and pstyv ne 'ZNLN' )
and vgbel = i_vbap-vbeln
and vgpos = i_vbap-posnr.
endselect.
Please le t me know if you have some tips..hi,
I hope you are using the select statement inside a loop ...endloop get that outside to improve the performance ..
if not i_vbap[] is initial.
select vbeln posnr into table it_lips
from lips
for all entries in i_vbap
where ( pstyv ne 'ZBAT'
and pstyv ne 'ZNLN' )
and vgbel = i_vbap-vbeln
and vgpos = i_vbap-posnr.
endif. -
How to improve performance of MediaPlayer?
I tried to use the MediaPlayer with a On2 VP6 flv movie.
Showing a video with a resolution of 1024x768 works.
Showing a video with a resolution of 1280x720 and a average bitrate of 1700 kb/s leads to a delay of the video signal behind the audio signal of a couple of seconds. VLC, Media Player Classic and a couple of other players have no problem with the video. Only the FX MediaPlayer shows a poor performance.
Additionally mouse events in a second stage (the first stage is used for the video) are not processed in 2 of 3 cases. If the MediaPlayer is switched off, the mouse events work reliable.
Does somebody know a solution for this problems?
Cheers
masimduplicate thread..
How to improve performance of attached query -
In application code I have the below code.
IF v_service_variant NOT IN(0,1,2,3,4) THEN --Checking whether existing service variant is applicable in 21Cn Fibre.
v_service_variant := 3; --If not making it as a standard service
UPDATE sspt_sessions_table SET service_variant = v_service_variant WHERE sess_id=v_sess_id; --Updating sspt_sessions_table
SELECT DECODE(service_variant_id, 0, 'None', 1, 'Loadbalancing', 2, 'Failover',3, 'BGP4', 4, 'Backup') INTO l_service_variant --To get the service variant name
FROM sspt_maj_resilience WHERE service_variant_id=v_service_variant;
UPDATE sspt_prquote_details SET service_variant = l_service_variant WHERE ftip=l_ftip AND sess_id=v_sess_id; --Updating sspt_prquote_details
COMMIT;
END IF;
Then the statements inside the if condition are not being executed. At the same time if I am replacing NOT IN with IN only and making changes to get if condition true then it is going inside the IF condition.... Could anyone please help me on this950474 wrote:
In application code I have the below code.
IF v_service_variant NOT IN(0,1,2,3,4) THEN --Checking whether existing service variant is applicable in 21Cn Fibre.
v_service_variant := 3; --If not making it as a standard service
UPDATE sspt_sessions_table SET service_variant = v_service_variant WHERE sess_id=v_sess_id; --Updating sspt_sessions_table
SELECT DECODE(service_variant_id, 0, 'None', 1, 'Loadbalancing', 2, 'Failover',3, 'BGP4', 4, 'Backup') INTO l_service_variant --To get the service variant name
FROM sspt_maj_resilience WHERE service_variant_id=v_service_variant;
UPDATE sspt_prquote_details SET service_variant = l_service_variant WHERE ftip=l_ftip AND sess_id=v_sess_id; --Updating sspt_prquote_details
COMMIT;
END IF;
Then the statements inside the if condition are not being executed. At the same time if I am replacing NOT IN with IN only and making changes to get if condition true then it is going inside the IF condition.... Could anyone please help me on thishow can we reproduce what you report?
while "not working" may be 100%, it is also 100% devoid of any actionable detail.
what results when it is not working?
how would working results supposedly appear?
How do I ask a question on the forums?
SQL and PL/SQL FAQ -
In Report Builder 3.0, I have the following custom code entered:
Public Function SafeDivide(Numerator as String, Denominator as String) as String
Try
If Numerator = “” or Denominator = “” then
Return “-“
End if
If Numerator = “-“ or Denominator = “-“ then
Return “-“
End If
If CDbl(Numerator) =0 or CDbl(Denominator) = 0 then
Return “-“
End if
If IsNothing(Numerator) or IsNothing(Denominator) then
Return "-"
End if
Return Val( ( (CDbl(Numerator) / CDbl(Denominator) )*100 ) )
Catch
Return "-"
End Try
End Function
I call the custom code in the cell with the following equation:
=Code.SafeDivide(sum(Fields!TY_UNITS.Value)-sum(Fields!LY_UNITS.Value),sum(Fields!LY_UNITS.Value))
I have the format for the cell set to 0.00%, but it’s not being followed.
I want the result to be formatted as a Percentage, but instead I get values like:
-78.9473684210
80
300
-100
I have the format for the cell set to 0.00%, but it’s not being followed.
How do I do use the custom code and format for a percentage with 2 decimals?Hi AngP,
After testing the issue in my local environment, I can reproduce it. Based on my research, I find this issue is caused by the type of Units_VAR_Percentage cell is string, while the type of CDbl(Parameters!Var_Threshold.Value) is double, so they cannot be
compared.
To fix this issue, we can add a hidden column (Textbox91) next to the Units_VAR_Percentage column, and type =(sum(Fields!TY_UNITS.Value)-sum(Fields!LY_UNITS.Value)) /sum(Fields!LY_UNITS.Value) as the expression. Then use the expression below to control the
BackgroundColor:
=iif(iif(reportitems!Units_VAR_Percentage.Value=CStr(format(reportitems!Textbox91.Value,"0.00%")),reportitems!Textbox91.Value,0)>CDbl(Parameters!Var_Threshold.Value),"Yellow","PaleTurquoise")
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support
Maybe you are looking for
-
Hi, We are using OHTs with destination type file. We have created a logical path.when we are trying to assign this logical path to the file,we are getting a dump. Runti.e Errors ASSI6N_SUBSTRIN6-N0L.ALL0WED Date and T1ne 06/1i812009 22:56-:350 Short
-
I forget my icloud passport. so i can't unlock my phone. how to know that passport
I forget my icloud passport. How to know that passport ?
-
How to make Columnwise total using Query in the picklist window
Hi Experts, I want to make the column wise total for the values in the field(Picked) in the Pick list window through query. How to do it? Regards, Magesh.
-
Ical does not display list format
Hi, I have just upgraded to Snow Leopard OSX, and after doing so my iPhone will no longer display my calendar in "list" format - it will only show day and month. Any suggestions as to how to get it to show calendar in list format again?
-
About Player v10.1 and v10.0 issues
HI all, I've meet this problem when coding as follows :- stop(); var pTempoNum:Number = 0; var gMcLoader1:MovieClipLoader = new MovieClipLoader(); function Load_Mc(cLoader, cFile, cObj) { cLoader.loadClip(cFile,cObj); function Unload_Mc(cLoader, cObj