How to get better performance to this sql code?
Guys I need your help.
I have a master table, 80 columns, more than millions data in it.
MasterTable
PK_Column_1
PK_Column_2
Column_3
Column_4
Select column_3, column_4
from MasterTable
where PK_Column_1 = '1' and PK_Column_2 = '2';
I don't know how to create index for this table. Thank u.
I don't know how to create index for this table.If PK stands for Primary Key, there should already be an index on those columns.
What trouble are you having? Have you looked at an explain plan?
Also...
PK_Column_1 = '1' Are your primary key columns varchar2 columns?
Similar Messages
-
How to get better perform here
hi there,
bellow code is using with in the loop. how can i modify to get better performance.
SELECT knumv kposn kwert FROM konv
INTO CORRESPONDING FIELDS OF lt_konv
WHERE knumv EQ lt_output-knumv
AND kposn EQ lt_output-posnr
AND kschl EQ 'VPRS'.
COLLECT lt_konv.
ENDSELECT.
thx in adv.the better solution for the select statement whould be to use the aggreagte function sum for the field kwert:
SELECT knumv kposn sum(kwert)
FROM konv
INTO CORRESPONDING FIELDS OF table lt_konv
WHERE knumv EQ lt_output-knumv
AND kposn EQ lt_output-posnr
AND kschl EQ 'VPRS'.
The select is inside the loop an lt_output.
Aggregate functions and FOR ALL ENTRIES can not be combined, the
FOR ALL ENTRIES is a select distinct !!!
So you must leave the loop around the select and you can't use the FOR ALL ENTRIES, but this is o.k.,
Siegfried -
How to get Listener Information using PL/SQL code
How to get Listener Information using PL/SQL code
user2075318 wrote:
How to get Listener Information using PL/SQL codeThis approach (somewhat of a hack) can be used - but it does not really provide meaningful data at application layer.
SQL> create or replace function TnsPing( ipAddress varchar2, port number default 1521 ) return varchar2 is
2 type THexArray is table of varchar2(2);
3 --// tnsping packet (should be 10g and 11g listener compatible)
4 TNS_PING_PACKET constant THexArray := new THexArray(
5 '00', '57', '00', '00', '01', '00', '00', '00',
6 '01', '39', '01', '2C', '00', '00', '08', '00',
7 '7F', 'FF', '7F', '08', '00', '00', '01', '00',
8 '00', '1D', '00', '3A', '00', '00', '00', '00',
9 '00', '00', '00', '00', '00', '00', '00', '00',
10 '00', '00', '00', '00', '00', '00', '00', '00',
11 '00', '00', '00', '00', '00', '00', '00', '00',
12 '00', '00', '28', '43', '4F', '4E', '4E', '45',
13 '43', '54', '5F', '44', '41', '54', '41', '3D',
14 '28', '43', '4F', '4D', '4D', '41', '4E', '44',
15 '3D', '70', '69', '6E', '67', '29', '29'
16 );
17
18 socket UTL_TCP.connection;
19 txBytes number;
20 rxBytes number;
21 rawBuf raw(1024);
22 resp varchar2(1024);
23 begin
24 socket := UTL_TCP.open_connection(
25 remote_host => ipAddress,
26 remote_port => port,
27 tx_timeout => 10
28 );
29
30 --// convert hex array into a raw buffer
31 for i in 1..TNS_PING_PACKET.Count loop
32 rawBuf := rawBuf || HexToRaw( TNS_PING_PACKET(i) );
33 end loop;
34
35 --// send packet
36 txBytes := UTL_TCP.write_raw( socket, rawBuf, TNS_PING_PACKET.Count );
37
38 --// read response
39 rxBytes := UTL_TCP.read_raw( socket, rawBuf, 1024 );
40
41 UTL_TCP.close_connection( socket );
42
43 --// convert response to varchar2
44 resp := UTL_RAW.Cast_To_Varchar2( rawBuf );
45
46 --// strip the header from the response and return the text only
47 return( substr(resp,13) );
48 end;
49 /
Function created.
SQL>
SQL> select tnsping( '10.251.93.30' ) as TNSPING from dual;
TNSPING
(DESCRIPTION=(TMP=)(VSNNUM=169869568)(ERR=0)(ALIAS=LISTENER))
SQL> select tnsping( '10.251.95.69' ) as TNSPING from dual;
TNSPING
(DESCRIPTION=(TMP=)(VSNNUM=0)(ERR=0)(ALIAS=LISTENER))
SQL> -
How to get better performance out of iMovie?
I have a 13" MBP (2010) with 2.4GHz. I bought the machine to edit video on the road and it did great when I first bought it running Snow Leopard. After upgrading to Lion, I noticed it started to play back some choppy video clips while inside iMovie. The rendered clips play fine, so I wasn't too concerned. A bit of a hassle. Then I figured I would upgrade some RAM and am now running 8GB. I don't think the graphics card is limiting, because it used to run the clips fine. The video just doesn't run smooth and I am wondering how to fix. I played some clips while in iMovie and the app starts consuming 150% of the CPU resources from 2% when no video is playing. Is this what others get?
Thanks in advance!I found a good article on this topic here: http://helgeklein.com/blog/2014/06/customizing-installing-lenovo-w540/
Published on June 17, 2014.
"With Windows 8 the product key is not printed on a sticker on the device’s underside but stored in the BIOS instead. According to the rare information to be found on this topic a plain vanilla version of Windows may or may not accept that key. In some cases additional certificates have been added to the vendor images without which the BIOS key cannot be used. Long story short: I had to try it out and had to be prepared to supply my own product key."
He doesn't comment on if he was actually successful retreiving the Key from BIOS. Does the last sentence imply that he actually had to get another product key?
BTW: just worked with the TrackPad and yes it's very noisy and clunky to click. Luckily I always use a mouse with my laptop. -
How to setup airport time capsule to get better performance?
I need to set up my wireless system with my new Airport time capsule 3T as primary base station to get better performance, and If I have a cable modem as primary device to get the signal (5MB) from the ISP then my network has one, Macbook pro, Macbook air, mac mini, 2 ipad's, 2 iphones, but neither of them is connected all time.
What is the best way to do that?
What wifi channel need choose to?What is the best way to do that?
Use ethernet.. performance of wireless is never as good as ethernet.
What wifi channel need choose to?
There is no such thing as the best channel..
Leave everything auto.. and see if it gives you full download speed.
Use 5ghz.. and keep everything up close to the TC for the best wireless speed.
If you are far away it will drop back to 2.4ghz which is slower.
Once you reach the internet speed nothing is going to help it go faster so you are worrying about nothing. -
How to get better resolution on graphical borders in Pages?
When using the «line effect» on a picture frame and choose a «image border», these borders a very pixelated and low resoltion when i.e. printing on a quality printer. Seems to be only screen resolution (100-150 dpi)? Is this a bug in Pages – how to get better resolution for these borders when exporting for example to PDF?
Here you see the issue. The Document's size is A6 landscape, means 14.8x10.5 cm, and it prints and shows really pixelated
-
Please help me how to improve the performance of this query further.
Hi All,
Please help me how to improve the performance of this query further.
Thanks.Hi,
this is not your first SQL tuning request in this community -- you really should learn how to obtain performance diagnostics.
The information you posted is not nearly enough to even start troubleshooting the query -- you haven't specified elapsed time, I/O, or the actual number of rows the query returns.
The only piece of information we have is saying that your query executes within a second. If we believe this, then your query doesn't need tuning. If we don't, then we throw it away
and we're left with nothing.
Start by reading this blog post: Kyle Hailey » Power of DISPLAY_CURSOR
and applying this knowledge to your case.
Best regards,
Nikolay -
My iphone 5 broke so had to get a sim card and put it in my husbands old iphone 4. i can not figure out how to get my imformation on this his old phone; contacts, apps ect. i have switched my icloud account and apple id on the phone but nothing has changed. please HELP!
You do a restore as new to wipe the iPhone then at the end of restore you will be asked to restore from backup. Choose your iPhone backup.
Note you cannot restore an IOS newer than the IOS on iPhone, you need to update iPhone first. -
How to get a performing equalizer in iTunes
Hello
How to get a performing equalizer in iTunes?Try downloading and reinstalling the latest version of iTunes.
If that doesn't help, give us a little more information about the tracks that are having the problem and what you are seeing. -
Anyone know how I get charged a late this month?
anyone know how I get charged a late this month?
Creative Cloud chat support (all Creative Cloud customer service issues)
http://helpx.adobe.com/x-productkb/global/service-ccm.html -
HT4623 i have iOS 4.2.1 in 3G old one. how to get the applications for this iOS
i have iOS 4.2.1 in 3G old one. how to get the applications for this iOS
look at this thread
https://discussions.apple.com/message/22837309#22837309 -
Which one will get better performance when traversing an ArrayList, iterat
hi, everyone,
Which one will get better performance when traversing an ArrayList, iterators, or index(get(i))?
Any reply would be valuable.
Thank you in advance.Use the iterator, or a foreach loop, which is just syntactic sugar over an iterator. The cases where there is a noticeable difference will be extremely rare. You would only use get() if you actually measured a bottleneck, changed it, re-tested, and found significant improvement. An iterator will give O(n) time for iterating over any collection. Using get() only works on Lists, and for a LinkedList, gives O(n^2).
-
How to get af:commandbutton id in java code when it is triggered?
Hi All
In my application's homepage, I am using 2 af:commandbuttons and each using action attribute to call a method. Both are calling the same method, and based on its id, it should perform different operations. Could anyone please tell me how to get command buttons id in java code, when it is triggered.
Regards
VenkatVenkat,
why not call different methods from each button?
public String actionButton1()
return doAction("button1");
public String actionButton2()
return doAction("button2");
public String doAction(String aBuuton)
if ("button1".equalsIgnoreCase(aButton))
// do work for button 1
return "abc";
}else {
// do work for button 2
return "abc";
}Now you user actionbutton1 for the first button and actionButton2 for the second.
Or you directly implement two different methods in the bean and call each one directly from the button.
Timo -
Is there any way to get a better performance with this Xquery ?
I created two tables.
One has XBRL docoument with XMLType based on Clob and I'm going to select several columns from it and insert them into the other table.
I used this SQL using XMLTable.
INSERT INTO SV_XBRL_ELEMENT
SELECT r.finance_cd,r.base_month,xt.context_id,xt.ns,xt.name,nvl(xt.lang,'na')
as lang,xt.unit,xt.decimals,xt.value
FROM SV_XBRL_DOC r,
XMLTABLE(
XMLNAMESPACES(
'http://www.w3.org/1999/xlink' AS "xlink",
'http://www.xbrl.org/2003/linkbase' AS "link",
'http://www.xbrl.org/2003/instance' AS "xbrli",
'http://www.xbrl.org/2003/iso4217' AS "iso4217",
'http://www.xbrlkorea.com/kr/kisinfo/fr/gaap/ci/2007-02-09' AS "kisinfo-ci",
'http://www.xbrlkorea.com/kr/kisinfo/fr/gcd/2007-02-09' AS "kisinfo-gcd",
'http://www.xbrlkorea.com/kr/kisinfo/fr/profile/2007-02-09' AS "kisinfo-profile",
'http://www.xbrlkorea.com/kr/kisinfo/fr/ratio/2007-02-09' AS "kisinfo-ratio",
'http://www.xbrlkorea.com/kr/kisinfo/fr/common/scenario' AS "kisinfo-scenario",
'http://www.xbrl.or.kr/kr/fr/gaap/ci/2006-05-31' AS "kr-gaap-ci",
'http://www.xbrl.or.kr/kr/fr/common/pte/2006-05-31' AS "krfr-pte",
'http://www.xbrl.or.kr/kr/fr/common/ptr/2006-05-31' AS "krfr-ptr",
'http://www.xbrl.or.kr/2006/role/subitem-notes' AS "p0",
'http://xmlns.oracle.com/xdb' AS "ora"),
for $item in
$doc/xbrli:xbrl/*[not(starts-with(name(),"xbrli:")) and
not(starts-with(name(),"link:"))]
where $item/@contextRef
return <item contextRef="{$item/@contextRef}" xml:lang="{$item/@xml:lang}"
unitRef="{$item/@unitRef}" name="{local-name($item)}" ns="{namespace-uri($item)}">{$item}</item>'
PASSING r.xbrl as "doc"
COLUMNS context_id varchar2(128) PATH '@contextRef',
ns varchar2(128) PATH '@ns',
name varchar2(128) PATH '@name',
lang varchar2(2) PATH '@xml:lang',
unit varchar2(16) PATH '@unitRef',
decimals varchar2(64) PATH '@decimals',
value varchar(256) PATH '.'
) xt
SV_XBRL_DOC has 1450 records(1450 documents).
SV_XBRL_ELEMENT has more than 110,280 record (110,280 elements)
the sql above takes more than 6000 seconds with my machine (10g,sun5.8 4 cpus), I admit it's a big number of records, I'm looking for more efficient way to do.
Is there any point to boost the sql ?
here is the part of the xbrl document sample.
<?xml version="1.0"?>
<xbrli:xbrl xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fines-b-ot="http://fss.xbrl.or.kr/kr/br/b/ot/2007-06-30" xmlns:fines-aa001="http://fss.xbrl.or.kr/kr/br/gaap/aa001/2007-06-30" xmlns:xbrldt="http://xbrl.org/2005/xbrldt" xmlns:ref="http://www.xbrl.org/2004/ref" xmlns:xbrldi="http://xbrl.org/2006/xbrldi" xmlns:iso4217="http://www.xbrl.org/2003/iso4217">
<link:schemaRef xlink:type="simple" xlink:href="http://fss.xbrl.or.kr/kr/br/fines/aa001/2007-06-30/fines-aa001-2007-06-30.xsd"/>
<xbrli:context id="ctx_AAA001C">
<xbrli:entity>
<xbrli:identifier scheme="http://fss.xbrl.or.kr">0010002</xbrli:identifier>
<xbrli:segment>
<xbrldi:explicitMember dimension="fines-b-ot:newItemDimension">fines-b-ot:AAA001C</xbrldi:explicitMember>
</xbrli:segment>
</xbrli:entity>
<xbrli:period>
<xbrli:instant>1999-03-31</xbrli:instant>
</xbrli:period>
</xbrli:context>
<xbrli:context id="ctx_BAA001C">
<xbrli:entity>
<xbrli:identifier scheme="http://fss.xbrl.or.kr">0010002</xbrli:identifier>
<xbrli:segment>
<xbrldi:explicitMember dimension="fines-b-ot:newItemDimension">fines-b-ot:BAA001C</xbrldi:explicitMember>
</xbrli:segment>
</xbrli:entity>
<xbrli:period>
<xbrli:instant>1999-03-31</xbrli:instant>
</xbrli:period>
</xbrli:context>
<xbrli:context id="ctx_CAA001C">
<xbrli:entity>
<xbrli:identifier scheme="http://fss.xbrl.or.kr">0010002</xbrli:identifier>
<xbrli:segment>
<xbrldi:explicitMember dimension="fines-b-ot:newItemDimension">fines-b-ot:CAA001C</xbrldi:explicitMember>
</xbrli:segment>
</xbrli:entity>
<xbrli:period>
<xbrli:instant>1999-03-31</xbrli:instant>
</xbrli:period>
</xbrli:context>
<xbrli:context id="ctx_DAA001C">
<xbrli:entity>
<xbrli:identifier scheme="http://fss.xbrl.or.kr">0010002</xbrli:identifier>
<xbrli:segment>
<xbrldi:explicitMember dimension="fines-b-ot:newItemDimension">fines-b-ot:DAA001C</xbrldi:explicitMember>
</xbrli:segment>
</xbrli:entity>
<xbrli:period>
<xbrli:instant>1999-03-31</xbrli:instant>
</xbrli:period>
</xbrli:context>
<xbrli:unit id="KRW">
<xbrli:measure>iso4217:KRW</xbrli:measure>
</xbrli:unit>
<fines-b-ot:AAA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">14</fines-b-ot:AAA001R>
<fines-b-ot:AAA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">0</fines-b-ot:AAA001R>
<fines-b-ot:AAA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">14</fines-b-ot:AAA001R>
<fines-b-ot:AAA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:AAA001R>
<fines-b-ot:A1AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">7</fines-b-ot:A1AA001R>
<fines-b-ot:A1AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">0</fines-b-ot:A1AA001R>
<fines-b-ot:A1AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">7</fines-b-ot:A1AA001R>
<fines-b-ot:A1AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:A1AA001R>
<fines-b-ot:A2AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">7</fines-b-ot:A2AA001R>
<fines-b-ot:A2AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">0</fines-b-ot:A2AA001R>
<fines-b-ot:A2AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">7</fines-b-ot:A2AA001R>
<fines-b-ot:A2AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:A2AA001R>
<fines-b-ot:BAA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">4788</fines-b-ot:BAA001R>
<fines-b-ot:BAA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">49</fines-b-ot:BAA001R>
<fines-b-ot:BAA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">4837</fines-b-ot:BAA001R>
<fines-b-ot:BAA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">30</fines-b-ot:BAA001R>
<fines-b-ot:B1AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">4788</fines-b-ot:B1AA001R>
<fines-b-ot:B1AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">48</fines-b-ot:B1AA001R>
<fines-b-ot:B1AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">4836</fines-b-ot:B1AA001R>
<fines-b-ot:B1AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">29</fines-b-ot:B1AA001R>
<fines-b-ot:B11AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">2317</fines-b-ot:B11AA001R>
<fines-b-ot:B11AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">21</fines-b-ot:B11AA001R>
<fines-b-ot:B11AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">2338</fines-b-ot:B11AA001R>
<fines-b-ot:B11AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">2</fines-b-ot:B11AA001R>
<fines-b-ot:B111AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">0</fines-b-ot:B111AA001R>
<fines-b-ot:B111AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">0</fines-b-ot:B111AA001R>
<fines-b-ot:B111AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">0</fines-b-ot:B111AA001R>
<fines-b-ot:B111AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:B111AA001R>
<fines-b-ot:B112AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">60</fines-b-ot:B112AA001R>
<fines-b-ot:B112AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">2</fines-b-ot:B112AA001R>
<fines-b-ot:B112AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">62</fines-b-ot:B112AA001R>
<fines-b-ot:B112AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:B112AA001R>
<fines-b-ot:B113AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">185</fines-b-ot:B113AA001R>
<fines-b-ot:B113AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">1</fines-b-ot:B113AA001R>
<fines-b-ot:B113AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">186</fines-b-ot:B113AA001R>
<fines-b-ot:B113AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:B113AA001R>
<fines-b-ot:B114AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">408</fines-b-ot:B114AA001R>
<fines-b-ot:B114AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">5</fines-b-ot:B114AA001R>
<fines-b-ot:B114AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">413</fines-b-ot:B114AA001R>
<fines-b-ot:B114AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:B114AA001R>
<fines-b-ot:B115AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">1664</fines-b-ot:B115AA001R>
<fines-b-ot:B115AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">13</fines-b-ot:B115AA001R>
<fines-b-ot:B115AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">1677</fines-b-ot:B115AA001R>
<fines-b-ot:B115AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">2</fines-b-ot:B115AA001R>
<fines-b-ot:B12AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">2471</fines-b-ot:B12AA001R>
<fines-b-ot:B12AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">27</fines-b-ot:B12AA001R>
<fines-b-ot:B12AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">2498</fines-b-ot:B12AA001R>
<fines-b-ot:B12AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">27</fines-b-ot:B12AA001R>
<fines-b-ot:B2AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">0</fines-b-ot:B2AA001R>
<fines-b-ot:B2AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">0</fines-b-ot:B2AA001R>
<fines-b-ot:B2AA001R decimals="0" contextRef="ctx_CAA001C" unitRef="KRW">0</fines-b-ot:B2AA001R>
<fines-b-ot:B2AA001R decimals="0" contextRef="ctx_DAA001C" unitRef="KRW">0</fines-b-ot:B2AA001R>
<fines-b-ot:B3AA001R decimals="0" contextRef="ctx_AAA001C" unitRef="KRW">0</fines-b-ot:B3AA001R>
<fines-b-ot:B3AA001R decimals="0" contextRef="ctx_BAA001C" unitRef="KRW">1</fines-b-ot:B3AA001R>
</xbrli:xbrl>Using 11g along XML indexes can greatly improve this XQuery. We can discuss further offline.
Regards,
Geoff -
How to improve the performance of this code
Hi gurus
code is given below with LDB
this code look big but most of lines are commented
plz help its urgent
thanks in advance
*& Report ZSALES_RECON
REPORT ZSALES_RECON.
TYPE-POOLS : SLIS.
nodes: bseg , bkpf.
data : begin of zbseg occurs 0,
kunnr like bseg-kunnr,
*lifnr like bseg-lifnr,
dmbtr like bseg-dmbtr,
*shkzg like bseg-shkzg,
*gsber like bseg-gsber,
bschl like bseg-bschl,
*sgtxt like bseg-sgtxt,
total like bseg-dmbtr,
hkont like bseg-hkont,
BUDAT LIKE Bkpf-BUDAT,
belnr LIKE BSEG-belnr,
cash like bseg-dmbtr,
credit like bseg-dmbtr,
abn_voucher like bseg-dmbtr,
barista_voucher like bseg-dmbtr,
accor like bseg-dmbtr,
sodexho like bseg-dmbtr,
gift like bseg-dmbtr,
corp like bseg-dmbtr,
card like bseg-dmbtr,
miscellaneous like bseg-dmbtr,
werks like bseg-werks,
gjahr like bseg-gjahr,
SR_NO TYPE I,
shkzg like bseg-shkzg,
end of zbseg,
TP_TBL_DATA like ZBSEG.
DATA : idx TYPE sy-tabix.
Report data to be shown.
data: it_data like ZBSEG.
Heading of the report.
data: t_heading type slis_t_listheader.
AT SELECTION-SCREEN.
get bkpf.
START-OF-SELECTION.
data : sum_mis like bseg-dmbtr,
sum_abn like bseg-dmbtr,
sum_cash like bseg-dmbtr,
sum_credit like bseg-dmbtr,
sum_card like bseg-dmbtr,
sum_barista_voucher like bseg-dmbtr,
sum_accor like bseg-dmbtr,
sum_sodexho like bseg-dmbtr,
sum_gift like bseg-dmbtr,
sum_corp like bseg-dmbtr.
data : wa1_total like bseg-dmbtr.
data : wa_belnr like bseg-belnr,
wa_kunnr like bseg-kunnr,
wa_werks like bseg-werks,
belnr1 like bseg-belnr,
wa_sr_no type i.
GET BSEG.
data : wa like line of zbseg.
data : count type i,
count1 type i.
move-corresponding bseg to zbseg.
*idx = sy-tabix.
on change of zbseg-belnr.
wa_kunnr = zbseg-kunnr.
wa_kunnr = wa_kunnr+6(4).
select single werks into wa_werks from bseg where belnr = zbseg-belnr
and kunnr = '' and gjahr = zbseg-gjahr.
if wa_kunnr = wa_werks.
if zbseg-bschl <> '01'.
clear: sum_mis,wa1_total,sum_abn,sum_cash,sum_credit,sum_card,
sum_barista_voucher,sum_accor,sum_sodexho,sum_gift,sum_corp.
wa-BUDAT = BKPF-BUDAT.
wa-bschl = zbseg-bschl.
wa-hkont = zbseg-hkont.
wa-belnr = zbseg-belnr.
wa_belnr = wa-belnr.
wa-shkzg = zbseg-shkzg.
wa-kunnr = zbseg-kunnr.
count = wa-sr_no.
*wa-sr_no = count + 1.
idx = idx + 1.
append wa to zbseg.
**count = wa-sr_no.
*wa-sr_no = wa-sr_no + 1.
clear wa-total.
endif.
endif.
endon.
*clear : wa1_total.
if wa_belnr = zbseg-belnr.
loop at zbseg into wa.
wa-total = wa1_total.
wa-bschl = zbseg-bschl.
wa-hkont = zbseg-hkont.
count = sy-tabix.
wa-sr_no = count.
count1 = count.
*wa_sr_no = count.
modify zbseg from wa transporting sr_no.
IF wa-bschl eq '40' and wa-hkont eq '0024013020'.
if sy-tabix = 1.
wa-cash = zbseg-dmbtr.
sum_cash = sum_cash + wa-cash.
wa-cash = sum_cash.
modify zbseg index idx from wa transporting cash.
endif.
endif.
IF wa-bschl eq '40' and wa-hkont eq '0026060010'.
if sy-tabix = 1.
wa-credit = zbseg-dmbtr.
sum_credit = sum_credit + wa-credit.
wa-credit = sum_credit.
modify zbseg index idx from wa transporting credit.
endif.
endif.
IF wa-bschl eq '40' and wa-hkont eq '0026060015'.
if sy-tabix = 1.
wa-abn_voucher = zbseg-dmbtr.
sum_abn = sum_abn + wa-abn_voucher.
wa-abn_voucher = sum_abn.
modify zbseg index idx from wa transporting abn_voucher.
endif.
endif.
IF wa-bschl eq '40' and wa-hkont eq '0026060017'.
if sy-tabix = 1.
wa-barista_voucher = zbseg-dmbtr.
sum_barista_voucher = sum_barista_voucher + wa-barista_voucher.
wa-barista_voucher = sum_barista_voucher.
modify zbseg index idx from wa transporting barista_voucher.
endif.
endif.
IF wa-bschl eq '40' and wa-hkont eq '0026060020'.
if sy-tabix = 1.
wa-sodexho = zbseg-dmbtr.
sum_sodexho = sum_sodexho + wa-sodexho.
wa-sodexho = sum_sodexho.
modify zbseg index idx from wa transporting sodexho.
endif.
endif.
IF wa-bschl eq '40' AND wa-hkont eq '0026060030'.
if sy-tabix = 1.
wa-accor = zbseg-dmbtr.
sum_accor = sum_accor + wa-accor.
wa-accor = sum_accor.
modify zbseg index idx from wa transporting accor.
endif.
endif.
IF wa-bschl eq '40' AND wa-hkont eq '0026070040'.
if sy-tabix = 1.
wa-gift = zbseg-dmbtr.
sum_gift = sum_gift + wa-gift.
wa-gift = sum_gift.
modify zbseg index idx from wa transporting gift.
endif.
endif.
IF wa-bschl eq '40' AND wa-hkont eq '0026060070'.
if sy-tabix = 1.
wa-card = zbseg-dmbtr.
sum_card = sum_card + wa-card.
wa-card = sum_card.
modify zbseg index idx from wa transporting card.
endif.
endif.
IF wa-bschl eq '40' AND wa-hkont eq '0026060018'.
if sy-tabix = 1.
wa-corp = zbseg-dmbtr.
sum_corp = sum_corp + wa-corp.
wa-corp = sum_corp.
modify zbseg index idx from wa transporting corp.
endif.
endif.
*IF wa-bschl eq '11' .
*wa-total = zbseg-dmbtr.
*modify zbseg index idx from wa transporting total.
*endif.
IF wa-bschl EQ '40' or wa-bschl = '01' .
if sy-tabix = 1.
wa-total = zbseg-dmbtr.
wa1_total = wa1_total + wa-total.
wa-total = wa1_total.
*if idx = 2.
*modify zbseg index 1 from wa transporting total.
*else.
modify zbseg index idx from wa transporting total.
*endif.
endif.
endif.
*IF zbseg-TOTAL NE zbseg-DMBTR.
IF wa-BSCHL NE '11' AND wa-BSCHL NE '40'. "AND wa-BSCHL NE '01'.
if sy-tabix = 1.
if wa-shkzg = 'S'.
wa-miscellaneous = - wa-miscellaneous.
endif.
wa-miscellaneous = ZBSEG-DMBTR.
sum_mis = sum_mis + wa-miscellaneous.
wa-miscellaneous = sum_mis.
modify zbseg index idx from wa transporting miscellaneous.
endif.
ENDIF.
*wa1-miscellaneous = wa-miscellaneous.
*modify zbseg index idx from wa.
*ENDIF.
*append wa to zbseg.
*clear:zbseg-dmbtr.
endloop.
endif.
*****endif.
*****endon.
*ENDFORM.
*append zbseg.
*endloop.
End-of-selection.
perform build_alv using zbseg t_heading.
*& Form build_alv
Builds and display the ALV Grid.
form build_alv using t_data
*tp_tbl_data
t_heading type slis_t_listheader.
ALV required data objects.
data: w_title type lvc_title,
w_repid type syrepid,
w_comm type slis_formname,
w_status type slis_formname,
x_layout type slis_layout_alv,
t_event type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv,
t_sort type slis_t_sortinfo_alv.
refresh t_fieldcat.
refresh t_event.
refresh t_sort.
clear x_layout.
clear w_title.
Field Catalog
perform set_fieldcat2 using:
1 'SR_NO' 'SR_NO' 'BKPF' '5' space space 'SR NO' space space space
space space space space space t_fieldcat ,
2 'BELNR' 'BELNR' 'BKPF' '10' space space 'Document No' space space
space space space space space space t_fieldcat ,
3 'BUDAT' 'BUDAT' 'BKPF' '10' space space 'Document Date' space
space space space space space space space t_fieldcat ,
4 'KUNNR' space space space space space 'Site' space space
space space space space space space t_fieldcat ,
5 'TOTAL' space 'BSEG' space space space 'Total' space space space
space space space space 'X' t_fieldcat ,
6 'CASH' 'CASH' 'BSEG' space space space 'Cash Sales'
space space space space space space space 'X' t_fieldcat ,
7 'CREDIT' 'CREDIT' 'BSEG' space space space 'Credit Card'
space space space space space space space 'X' t_fieldcat ,
8 'ABN_VOUCHER' space 'BSEG' space space space 'ABN Voucher' space
space
space space space space space 'X' t_fieldcat ,
9 'BARISTA_VOUCHER' space 'BSEG' '15' space space 'BARISTA Voucher'
space space
space space space space space 'X' t_fieldcat ,
10 'CORP' 'CORP' 'BSEG' space space space 'ABN Corp' space space
space space space space space 'X' t_fieldcat ,
11 'SODEXHO' 'SODEXHO' 'BSEG' space space space 'Sodexho' space
space space space space space space 'X' t_fieldcat ,
12 'ACCOR' 'ACCOR' 'BSEG' space space space 'Accor'
space space space space space space space 'X' t_fieldcat ,
13 'GIFT' 'GIFT' 'BSEG' space space space 'Gift Coupon'
space space space space space space space 'X' t_fieldcat ,
14 'CARD' 'CARD' 'BSEG' space space space 'Diners Card' space
space space space space space space 'X' t_fieldcat ,
15 'MISCELLANEOUS' space 'BKPF' '18' space space
'Miscellaneous Income' space space space space space space space 'X'
t_fieldcat .
*14 'KBETR' 'KBETR' 'KONP' '10' space space 'Tax %age' space space
*space space space space space space t_fieldcat ,
*15 'MWSKZ1' 'MWSKZ1' 'RBKP' space space space 'Tax Type' space
*space
space space space space space space t_fieldcat ,
*16 'AMT' 'AMT' 'RBKP' space space space 'Amount Payable' space
*space
space space space space space 'X' t_fieldcat ,
*17 'WERKS' 'SITE' 'RSEG' space space space 'State' space space
*space space space space space space t_fieldcat .
*18 'GSBER' 'GSBER' 'RBKP' space space space 'Business Area' space
*space space space space space space space t_fieldcat .
Layout
x_layout-zebra = 'X'.
Top of page heading
perform set_top_page_heading using t_heading t_event.
Events
perform set_events using t_event.
GUI Status
w_status = ''.
w_repid = sy-repid.
Title
w_title = <<If you want to set a title for
the ALV, please, uncomment and edit this line>>.
User commands
w_comm = 'USER_COMMAND'.
Order
Example
PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
Displays the ALV grid
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = w_repid
it_fieldcat = t_fieldcat
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
tables
t_outtab = zbseg
t_data
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " build_alv.
*& Form set_top_page_heading
Creates the report headings.
form set_top_page_heading using t_heading type slis_t_listheader
t_events type slis_t_event.
data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = 'SALES RECONCILIATION REPORT'(001).
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
endform.
*& Form set_events
Sets the events for ALV.
The TOP_OF_PAGE event is alredy being registered in
the set_top_page_heading subroutine.
form set_events using t_events type slis_t_event.
data: x_event type line of slis_t_event.
Example
clear x_event.
x_event-name = .
x_event-form = .
append x_event to t_event.
endform.
*& Form set_order
Adds an entry to the order table.
FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
t_sort TYPE slis_t_sortinfo_alv.
DATA: x_sort TYPE slis_sortinfo_alv.
CLEAR x_sort.
x_sort-fieldname = p_fieldname.
x_sort-tabname = p_tabname.
x_sort-up = p_up.
x_sort-down = p_down.
x_sort-subtot = p_subtot.
APPEND x_sort TO t_sort.
ENDFORM. "set_order
*& Form set_fieldcat2
Adds an entry to the field catalog.
p_colpos: Column position.
p_fieldname: Field of internal table which is being described by
* this record of the field catalog.
p_ref_fieldname: (Optional) Table field / data element which
* describes the properties of the field.
* If this field is not given, it is copied from
* the fieldname.
p_ref_tabname: (Optional) Table which holds the field referenced
* by <<p_ref_fieldname>>.
If this is not given, the parameter
<<p_ref_fieldname>> references a data element.
p_outputlen: (Optional) Column width.
p_noout: (Optional) If set to 'X', states that the field is not
* showed initially. If so, the field has to be
included in the report at runtime using the display
options.
p_seltext_m: (Optional) Medium label to be used as column header.
p_seltext_l: (Optional) Long label to be used as column header.
p_seltext_s: (Optional) Small label to be used as column header.
p_reptext_ddic: (Optional) Extra small (heading) label to be
* used as column header.
p_ddictxt: (Optional) Set to 'L', 'M', 'S' or 'R' to select
whether to use SELTEXT_L, SELTEXT_M, SELTEXT_S,
or REPTEXT_DDIC as text for column header.
p_hotspot: (Optional) If set to 'X', this field will be used
* as a hotspot area for cursor, alolowing the user
* to click on the field.
p_showasicon: (Optional) If set to 'X', this field will be shown
as an icon and the contents of the field will set
* which icon to show.
p_checkbox: (Optional) If set to 'X', this field will be shown
as a checkbox.
p_edit: (Optional) If set to 'X', this field will be editable.
p_dosum: (Optional) If set to 'X', this field will be summed
(aggregation function) according to the grouping set
by the order functions.
t_fieldcat: Table which contains the whole fieldcat.
FORM set_fieldcat2 USING
p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-hotspot = p_hotspot.
wa_fieldcat-checkbox = p_checkbox.
wa_fieldcat-icon = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set reference fieldname, tablenam and rollname.
If p_ref_tabname is not given, the ref_fieldname given
is a data element.
If p_ref_tabname is given, the ref_fieldname given is a
field of a table.
In case ref_fieldname is not given,
it is copied from the fieldname.
IF p_ref_tabname IS INITIAL.
wa_fieldcat-rollname = p_ref_fieldname.
ELSE.
wa_fieldcat-ref_tabname = p_ref_tabname.
IF p_ref_fieldname EQ space.
wa_fieldcat-ref_fieldname = wa_fieldcat-fieldname.
ELSE.
wa_fieldcat-ref_fieldname = p_ref_fieldname.
ENDIF.
ENDIF.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
Set as editable or not.
IF NOT p_edit IS INITIAL.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
======================== Subroutines called by ALV ================
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = <<If you want to set a logo, please,
uncomment and edit this line>>
it_list_commentary = t_heading.
endform. " alv_top_of_page
*& Form user_command
Called on user_command ALV event.
Executes custom commands.
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
Example Code
Executes a command considering the sy-ucomm.
CASE r_ucomm.
WHEN '&IC1'.
Set your "double click action" response here.
Example code: Create and display a status message.
DATA: w_msg TYPE string,
w_row(4) TYPE n.
w_row = rs_selfield-tabindex.
CONCATENATE 'You have clicked row' w_row
'field' rs_selfield-fieldname
'with value' rs_selfield-value
INTO w_msg SEPARATED BY space.
MESSAGE w_msg TYPE 'S'.
ENDCASE.
End of example code.
endform. "user_command
*********************************ldb code start from here *************************************************************
DATABASE PROGRAM OF LOGICAL DATABASE ZBRM_3
top-include and nxxx-include are generated automatically
Do NOT change their names manually!!!
*include DBZBRM_3TOP . " header
*include DBZBRM_3NXXX . " all system routines
include DBZBRM_3F001 . " user defined include
PROGRAM SAPDBZBRM_3 DEFINING DATABASE ZBRM_3.
TABLES:
BKPF,
BSEG.
Hilfsfelder
DATA:
BR_SBUKRS LIKE BKPF-BUKRS,
BR_SBELNR LIKE BKPF-BELNR,
BR_SGJAHR LIKE BKPF-GJAHR,
BR_SBUDAT LIKE BKPF-BUDAT,
BR_SGSBER LIKE BSEG-GSBER.
BR_SBUZEI LIKE BSEG-BUZEI,
BR_SEBELN LIKE BSEG-EBELN,
BR_SEBELP LIKE BSEG-EBELP,
BR_SZEKKN LIKE BSEG-ZEKKN.
working areas for the authority check "n435991
for the company code "n435991
*TYPES : BEGIN OF STYPE_BUKRS, "n435991
BUKRS LIKE T001-BUKRS, "n435991
WAERS LIKE T001-WAERS, "n435991
RETCODE TYPE N, "n435991
END OF STYPE_BUKRS. "n435991
"n435991
*DATA : G_S_BUKRS TYPE STYPE_BUKRS, "n435991
G_T_BUKRS TYPE STYPE_BUKRS OCCURS 0. "n435991
"n435991
for the document type "n435991
*TYPES : BEGIN OF STYPE_BLART, "n435991
BLART LIKE BKPF-BLART, "n435991
RETCODE TYPE N, "n435991
END OF STYPE_BLART. "n435991
"n435991
*DATA : G_S_BLART TYPE STYPE_BLART, "n435991
G_T_BLART TYPE STYPE_BLART OCCURS 0. "n435991
"n435991
for the business area "n435991
*TYPES : BEGIN OF STYPE_GSBER, "n435991
GSBER LIKE BSEG-GSBER, "n435991
RETCODE TYPE N, "n435991
END OF STYPE_GSBER. "n435991
"n435991
*DATA : G_S_GSBER TYPE STYPE_GSBER, "n435991
G_T_GSBER TYPE STYPE_GSBER OCCURS 0. "n435991
"n435991
for the purchasing organization "n435991
*TYPES : BEGIN OF STYPE_EKORG, "n435991
EKORG LIKE EKKO-EKORG, "n435991
RETCODE TYPE N, "n435991
END OF STYPE_EKORG. "n435991
"n435991
*DATA : G_S_EKORG TYPE STYPE_EKORG, "n435991
G_T_EKORG TYPE STYPE_EKORG OCCURS 0. "n435991
"n435991
for the plant "n435991
*TYPES : BEGIN OF STYPE_WERKS, "n435991
WERKS LIKE EKPO-WERKS, "n435991
RETCODE TYPE N, "n435991
END OF STYPE_WERKS. "n435991
"n435991
*DATA : G_S_WERKS TYPE STYPE_WERKS, "n435991
G_T_WERKS TYPE STYPE_WERKS OCCURS 0. "n435991
"n435991
*DATA : G_F_TABIX LIKE SY-TABIX. "n435991
"n435991
working tables for array database access "n934526
*types : begin of stype_key, "n934526
bukrs type bkpf-bukrs, "n934526
belnr type bkpf-belnr, "n934526
gjahr type bkpf-gjahr, "n934526
end of stype_key, "n934526
"n934526
stab_key type standard table of "n934526
stype_key "n934526
with default key. "n934526
Initialwerte setzen
FORM INIT.
ENDFORM.
Selection Screen: Process before output
FORM PBO.
ENDFORM.
Selection Screen: Process after input
FORM PAI USING FNAME MARK.
CHECK MARK = SPACE.
ENDFORM.
Lesen BKPF und Uebergabe an den Selektionsreport
FORM PUT_BKPF.
define locla working areas "n934526
data : l_t_key type stab_key, "n934526
l_t_key_block type stab_key, "n934526
l_t_bkpf type standard table of bkpf. "n934526
"n934526
----------------------------------------------------------"n934526
"n934526
database seletion improved "n934526
at first read all FI doc keys into a lean table "n934526
data: wa like bkpf-belnr.
SELECT * FROM BKPF
where budat in br_budat
AND GJAHR EQ BR_GJAHR-LOW
AND BLART = 'RV'.
AND BLART IN BR_BLAR "n934526
"n934526
check sy-subrc is initial. "n934526
"n934526
then process the found FI doc keys in small blocks "n934526
do. "n934526
if l_t_key[] is initial. "n934526
exit. " no more keys -> leave this DO loop "n934526
endif. "n934526
"n934526
form small blocks with 100 FI docs each "n934526
refresh l_t_key_block. "n934526
append lines of l_t_key from 1 to 100 "n934526
to l_t_key_block. "n934526
delete l_t_key from 1 to 100. "n934526
"n934526
read the complete FI doc headers for the block "n934526
SELECT * FROM BKPF "n934526
into corresponding fields of table l_t_bkpf "n934526
for all entries in l_t_key_block "n934526
WHERE BUKRS = l_t_key_block-BUKRS "n934526
AND BELNR = l_t_key_block-BELNR "n934526
AND GJAHR = l_t_key_block-GJAHR. "n934526
"n934526
provide the complete structure for the PUT "n934526
loop at l_t_bkpf into bkpf. "n934526
process this company code : authority and read T001 "n934526
PERFORM F1000_COMPANY_CODE. "n934526
"n934526
go on if the first authority check was successful "n934526
CHECK : G_S_BUKRS-RETCODE IS INITIAL. "n934526
"n934526
set the currency key and save the keys "n934526
MOVE : G_S_BUKRS-WAERS TO T001-WAERS, "n934526
BKPF-BUKRS TO BR_SBUKRS, "n934526
MOVE BKPF-BELNR TO BR_SBELNR.
MOVE BKPF-GJAHR TO BR_SGJAHR . "n934526
BKPF-GJAHR TO BR_SGJAHR. "n934526
PUT BKPF. "n934526
endloop. "n934526
enddo. "n934526
ENDSELECT.
ENDFORM.
Lesen BSEG und Uebergabe an den Selektionsreport
FORM PUT_BSEG.
define local working areas "n934526
data : l_t_bseg type standard table of bseg. "n934526
"n934526
----------------------------------------------------------"n934526
BR_SGSBER = BR_GSBER-LOW.
"n934526
SELECT * FROM BSEG "n934526
WHERE BELNR EQ BR_SBELNR
AND GJAHR EQ BR_SGJAHR
AND GSBER EQ BR_SGSBER.
check sy-subrc is initial. "n934526
"n934526
loop at l_t_bseg into bseg. "n934526
MOVE BSEG-BUZEI TO BR_SBUZEI.
MOVE BSEG-EBELN TO BR_SEBELN.
MOVE BSEG-EBELP TO BR_SEBELP.
MOVE BSEG-ZEKKN TO BR_SZEKKN.
PUT BSEG.
endSELECT. "n934526
ENDFORM.
"n435991
FORM AUTHORITYCHECK_BKPF "n435991
"n435991
"n435991
*FORM AUTHORITYCHECK_BKPF. "n435991
"n435991
the authority-check for the company code was successful; "n435991
check authority for the document type here "n435991
"n435991
does the buffer contain this document type ? "n435991
READ TABLE G_T_BLART INTO G_S_BLART "n435991
WITH KEY BLART = BKPF-BLART BINARY SEARCH. "n435991
"n435991
CASE SY-SUBRC. "n435991
WHEN 0. "document type is known "n435991
"n435991
WHEN 4. "docment type is new --> insert "n435991
MOVE SY-TABIX TO G_F_TABIX. "n435991
PERFORM F1200_CREATE_BLART_ENTRY. "n435991
INSERT G_S_BLART INTO G_T_BLART "n435991
INDEX G_F_TABIX. "n435991
"n435991
WHEN 8. "document type is new --> append "n435991
PERFORM F1200_CREATE_BLART_ENTRY. "n435991
APPEND G_S_BLART TO G_T_BLART. "n435991
ENDCASE. "n435991
"n435991
set the return code "n435991
MOVE G_S_BLART-RETCODE TO SY-SUBRC. "n435991
"n435991
*ENDFORM. "authoritycheck_bkpf "n435991
"n435991
"n435991
FORM AUTHORITYCHECK_BSEG "n435991
"n435991
"n435991
*FORM AUTHORITYCHECK_BSEG. "n435991
"n435991
does the buffer contain this document type ? "n435991
READ TABLE G_T_GSBER INTO G_S_GSBER "n435991
WITH KEY GSBER = BSEG-GSBER BINARY SEARCH. "n435991
"n435991
CASE SY-SUBRC. "n435991
WHEN 0. "business area is known "n435991
"n435991
WHEN 4. "business area is new --> insert "n435991
MOVE SY-TABIX TO G_F_TABIX. "n435991
PERFORM F1300_CREATE_GSBER_ENTRY. "n435991
INSERT G_S_GSBER INTO G_T_GSBER "n435991
INDEX G_F_TABIX. "n435991
"n435991
WHEN 8. "business area is new --> append "n435991
PERFORM F1300_CREATE_GSBER_ENTRY. "n435991
APPEND G_S_GSBER TO G_T_GSBER. "n435991
ENDCASE. "n435991
"n435991
set the return code "n435991
MOVE G_S_GSBER-RETCODE TO SY-SUBRC. "n435991
"n435991
*ENDFORM. "authoritycheck_bseg "n435991
"n435991ABAP provides few tools to analyse the perfomance of the objects, which was developed by us.
Run time analysis transaction SE30
This transaction gives all the analysis of an ABAP program with respect to the database and the non-database processing.
SQL Trace transaction ST05
by using this tool we can analyse the perfomance issues related to DATABASE calls.
Perfomance Techniques for improve the perfomance of the object.
1) ABAP/4 programs can take a very long time to execute, and can make other processes have to wait before executing. Here are some tips to speed up your programs and reduce the load your programs put on the system:
2) Use the GET RUN TIME command to help evaluate performance. It's hard to know whether that optimization technique REALLY helps unless you test it out.
3) Using this tool can help you know what is effective, under what kinds of conditions. The GET RUN TIME has problems under multiple CPUs, so you should use it to test small pieces of your program, rather than the whole program.
4) Generally, try to reduce I/O first, then memory, then CPU activity. I/O operations that read/write to hard disk are always the most expensive operations. Memory, if not controlled, may have to be written to swap space on the hard disk, which therefore increases your I/O read/writes to disk. CPU activity can be reduced by careful program design, and by using commands such as SUM (SQL) and COLLECT (ABAP/4).
5) Avoid 'SELECT *', especially in tables that have a lot of fields. Use SELECT A B C INTO instead, so that fields are only read if they are used. This can make a very big difference.
6) Field-groups can be useful for multi-level sorting and displaying. However, they write their data to the system's paging space, rather than to memory (internal tables use memory). For this reason, field-groups are only appropriate for processing large lists (e.g. over 50,000 records). If you have large lists, you should work with the systems administrator to decide the maximum amount of RAM your program should use, and from that, calculate how much space your lists will use. Then you can decide whether to write the data to memory or swap space.
Use as many table keys as possible in the WHERE part of your select statements.
7)Whenever possible, design the program to access a relatively constant number of records (for instance, if you only access the transactions for one month, then there probably will be a reasonable range, like 1200-1800, for the number of transactions inputted within that month). Then use a SELECT A B C INTO TABLE ITAB statement.
8) Get a good idea of how many records you will be accessing. Log into your productive system, and use SE80 -> Dictionary Objects (press Edit), enter the table name you want to see, and press Display. Go To Utilities -> Table Contents to query the table contents and see the number of records. This is extremely useful in optimizing a program's memory allocation.
9) Try to make the user interface such that the program gradually unfolds more information to the user, rather than giving a huge list of information all at once to the user.
10) Declare your internal tables using OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to be accessing. If the number of records exceeds NUM_RECS, the data will be kept in swap space (not memory).
11) Use SELECT A B C INTO TABLE ITAB whenever possible. This will read all of the records into the itab in one operation, rather than repeated operations that result from a SELECT A B C INTO ITAB... ENDSELECT statement. Make sure that ITAB is declared with OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to access.
12) If the number of records you are reading is constantly growing, you may be able to break it into chunks of relatively constant size. For instance, if you have to read all records from 1991 to present, you can break it into quarters, and read all records one quarter at a time. This will reduce I/O operations. Test extensively with GET RUN TIME when using this method.
13) Know how to use the 'collect' command. It can be very efficient.
14) Use the SELECT SINGLE command whenever possible.
15) Many tables contain totals fields (such as monthly expense totals). Use these avoid wasting resources by calculating a total that has already been calculated and stored.
Some tips:
1) Use joins where possible as redundant data is not fetched.
2) Use select single where ever possible.
3) Calling methods of a global class is faster than calling function modules.
4) Use constants instead of literals
5) Use WHILE instead of a DO-EXIT-ENDDO.
6) Unnecessary MOVEs should be avoided by using the explicit work area operations
see the follwing links for a brief insifght into performance tuning,
http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_Introduction.asp
1. Debuggerhttp://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
2. Run Time Analyser
http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm
3. SQL trace
http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm
4. CATT - Computer Aided Testing Too
http://help.sap.com/saphelp_47x200/helpdata/en/b3/410b37233f7c6fe10000009b38f936/frameset.htm
5. Test Workbench
http://help.sap.com/saphelp_47x200/helpdata/en/a8/157235d0fa8742e10000009b38f889/frameset.htm
6. Coverage Analyser
http://help.sap.com/saphelp_47x200/helpdata/en/c7/af9a79061a11d4b3d4080009b43351/content.htm
7. Runtime Monitor
http://help.sap.com/saphelp_47x200/helpdata/en/b5/fa121cc15911d5993d00508b6b8b11/content.htm
8. Memory Inspector
http://help.sap.com/saphelp_47x200/helpdata/en/a2/e5fc84cc87964cb2c29f584152d74e/content.htm
9. ECATT - Extended Computer Aided testing tool.
http://help.sap.com/saphelp_47x200/helpdata/en/20/e81c3b84e65e7be10000000a11402f/frameset.htm
Performance tuning for Data Selection Statement
http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
Maybe you are looking for
-
Datagrid Column Ordering from Recordset?
I often populate my datagrids with a recordset, an array of record objects, by passing the recordset in the dataprovider constructor. However, this results in unpredictable column ordering i.e. it doesn't correspond to the order of the fields in the
-
Database migration from US7ASCII to UTF8
Hi All, As a part of Data migration we need to change the existing database character set from US7ASCII to UTF8. My Database is running on Oracle 9.2.0.6. In my database I have 5 schemas. 1) Can any body suggest how to migrate the character set from
-
Adobe Software keeps "not responding"
Hello, Within the past 2 months all of my Adobe software keeps going into "not responding" mode. This happens daily with ALL of my design software. Illustrator, InDesign and Photoshop. Sometimes it happens multiple times in an hour. I try and save of
-
Win 8.1 Pro I had to replace my hard drive in my laptop. I chose a larger SSD drive as its replacement. System Image backup worked and restored the old disk onto the new one. The laptop (Lenovo) has a hidden partition at the end of the old drive (Len
-
OMS, Repository, Agent Grid upgrade
Newbie here and will try to explain as best as I can. So I installed Grid 10.2.0.2 on Windows XP system. I have used the patchset 12.0.4.0 to upgrade OMS, repository and agent. I have followed the documentation on how to do this. First I patched OMS