How to Reduce Clusetering Factor on Table?
I am seeing a very high clustering factor on an SDO geometry table in our 10g RAC DB on our Linux boxes. This slow performance is repeateable on othe r Linux as well as Solaris DBs for the same table. Inserts go in at a rate of 44 milliseconds per insert and we only have about 27000 rows in the table. After viewing a VERY slow insert of about 600 records into this same table, I saw the clustering factor in OEM. The clustering factor is nearly identical to the # rows in the table indicating that useability of the index is fairly low now. I have referenced Metalink Tech Note 223117.1 and, while it affirms what I've seen, I am still trying to determine how to reduce the Clustering Factor. The excerpt on how to do this is below:
"The only method to affect the clustering factor is to sort and then store the rows in the table in the same order as in they appear in the index. Exporting rows and putting them back in the same order that they appeared originally will have no affect. Remember that ordering the rows to suit one index may have detrimental effects on the choice of other indexes."
Sounds great, but how does one actually go about storing the rows in the table in the same order as they appear in the index?
We have tried placing our commits after the last insert as well as after every insert and the results are fairly neglible. We also have a column of type SDE.ST_GEOMETRY in the table and are wondering if this might also be an issue. Thanks in advance for any help.
Matt Sauter
Joel is right that the clustering factor is going to have absolutely no effect on the speed of inserts. The clustering factor is merely one, purely statistical, factor the optimiser makes use of to determine how to perform a SELECT statement (i.e., do I bother to use this index or not for row retrieval). It's got nothing to do with the efficiency of inserts.
If I were you, I'd be looking at factors such as excessive disk I/O taking place for other reasons, inadequate buffer cache and/or enqueue and locking issues instead.
If you're committing after every insert, for example, then redo will have to be flushed (a commit is about the only foreground wait event -i.e., one that you get to experience in real time- that Oracle has, so a commit after every insert's really not a smart idea). If your redo logs are stored on, say, the worst-performing disk you could buy that's also doing duty as a fileserver's main hard disk, then LGWR will be twiddling its thumbs a lot! You say you've tested this, and that's fine... I'm just saying, it's one theoretical possibility in these sorts of situations. You still want to make sure you're not suffering any log writer-related waits, all the same.
Similarly, if you're performing huge reads on a (perhaps completely separate) table that is causing the buffer cache to be wiped every second or so, then getting access to your table so your inserts can take place could be problematic. Check if you've got any database writer waits, for example: they are usally a good sign of general I/O bottlenecks.
Finally, you're on a RAC... so if the blocks of the table you're writing to are in memory over on another instance, and they have to be shipped to your instance, you could have high enqueue waits whilst that shipment is taking place. Maybe your interconnect is not up to the job? Maybe it's faulty, even, with significant packet loss along the way? Even worse if someone's decided to switch off cache fusion transfer for the datafiles invoved (for then block shipment happens by writing them to disk in one instance and reading from disk in the other). RAC adds a whole new level of complexity to things, so good luck tracking that lot down!!
Also, maybe you're using Freelists and Freelist groups rather than ASSM, so perhaps you're fighting for access to the freelist with whatever else is happening on your database at the time...
You get the idea: this could be a result of activity taking place on the server for reasons completely unconnected with your insert. It could be a feature of Spatial (with which not many people will be familiar, so good luck if so!) It could be a result of the way your RAC is configured. It could be any number of things... but I'd be willing to bet quite a bit that it's got sod-all to do with the clustering factor!
You'll need to monitor the insert using a tool like Insider or Toad so you can see if waits and so on happen, more or less in real time -or start using the built-in tools like Statspack or AWR to analyze your workload after it's completed- to work out what your best fix is likely to be.
Similar Messages
-
How to Reduce cost of full table scan or remove full table scan while execu
Dear Experts
need your help.
I execute a query and create a explain plan in that plan i found cost of a table is very high (2777) and it was full table scan.
Please guide me How to Reduce cost of full table scan or remove full table scan while execute the query.
ThanksNeed your help to tune this query..
SELECT DISTINCT ool.org_id, ool.header_id, ooh.order_number, ool.line_id,
ool.line_number, ool.shipment_number,
NVL (ool.option_number, -99) option_number, xcl.GROUP_ID,
xcl.attribute3, xcl.attribute4
FROM oe_order_headers ooh,
xxcn_comp_header xch,
xxcn_comp_lines xcl,
fnd_lookup_values_vl fvl,
oe_order_lines ool
WHERE 1 = 1
AND ooh.org_id = 1524
AND xch.src_ref_no = TO_CHAR (ooh.order_number)
AND xch.src_ref_id = ooh.header_id
AND xch.org_id = 1524
AND xcl.header_id = xch.header_id
AND ool.line_id = xcl.oe_line_id
AND ool.flow_status_code IN
('WWD_SHIPPED',
'FULFILLED',
'SHIPPED',
'CLOSED',
'RETURNED'
AND ool.org_id = 1524
AND ool.header_id = ooh.header_id
AND xch.org_id = 1524
AND fvl.lookup_type = 'EMR OIC SOURCE FOR OU'
AND fvl.tag = '1524'
AND fvl.description = xch.SOURCE
AND EXISTS (
SELECT 1
FROM oe_order_lines oe
WHERE oe.header_id = ool.header_id
AND oe.org_id = 1524
AND oe.line_number = ool.line_number
AND oe.ordered_item = ool.ordered_item
AND oe.shipment_number > ool.shipment_number
AND NVL (oe.option_number, -99) =
NVL (ool.option_number,
-99)
AND NOT EXISTS (
SELECT 1
FROM xxcn_comp_lines xcl2
WHERE xcl.GROUP_ID = xcl2.GROUP_ID
AND oe.line_id = oe_line_id))
call count cpu elapsed disk query current rows
Parse 1 0.07 0.12 12 25 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 103.03 852.42 176206 4997766 0 12
total 4 103.10 852.55 176218 4997791 0 12
In this LIO is very high...can u please help in resolving this performance issue -
How to reduce downtime for setup table
Scenario u2013According to system data, Setup table will normally take 5 days to fill but client agreed only for max 2 days downtime. User can do change only last 3 month documents not before that. For filling 3 month data in set up table 1 day required so I have to mange options accordingly.
Datasource u2013 2LIS_13_VDITM -> DSO u2013 ZBIllIG ->Info cube
I have to Reduce Downtime for Setup table so planning following optionsu2013
1. First run the info package for Initialization without data transfer. Then start filling setup table without blocking the User. In case Users changes any document at the time of filling setup table then these changes will move to delta queue. Once setup table filled then execute full repair request and then Delta info package.
2. Early delta initialization u2013 no idea how to perform steps.
Please share your views with detail steps.
OLI*BW doesnu2019t have any date range in selection criteria so manually I will find out document for particular dates and use these document range.
Checked lot of post in SDN but still expecting final answer to go ahead in Production.Hi ,
Your requirement is Billing ODS and Cube - Reset up in R/3 SYSTEM & Initialization in BW SYSTEM .
Before starting find the previous data load volume and size.
1.Go to LBWG application value=13 (Always Schedule the job in the back-ground mode)
2.Verify using tcode u2018SE16u2019 that there are NO records in u2018MC13VD0ITMSETUPu2019 table after above delete job is complete.
3.Suspend the process chain job in BW.This is to avoid it getting kicked off while the reload process is still in progress.
4.Need to check LBWQ in R/3 system for MCEX13, unprocessed Outbound queue (records). This should be empty as the last delta would have processed all.
5.Delete the initflag in BW.
6.Need to check RSA7 in R/3 SYSTEM to verify that there is NO record for 2LIS_13_VDITM (to be done right before the Setup job).
7.Create New Info Package for Info Source '2LIS_13_VDITM' for u2018Initialize without Data Transfer Optionu2019 .Execute the package.Re-establish the Delta processing flags in R/3 and BW for the Billing TD load .
8.Save the record count for table u2018VBRPu2019 using SE16 right before the setup job.
9.Schedule Billing Data Setup Job 'OLI9BW' in R/3 SYSTEM .
10.After the Billing Setup job is complete in R/3 system, get the record count of table u2018VBRPu2019 again using u2018SE16u2019
Expeted time in R/3:5 to 7 hrs(setupjobs)
Expeted time for init and fullload : 6 hrs
ODS activation : 3hrs
Cube and with agrregates fill all : 8hrs.
Thanks,
naidu. -
How to reduce time when updating table with join of anther table
Hi all,
I am update table Policy1 using another table from other scheme
Policy1 is in schema "TEST".
TRN_POLICY_RISK_GIS is in Schema "TEST2".
Now i am executing my query which is taking lot of time to update and make cpu utilization upto 45%.
update policy1 set total_si = (select total_is from (select pol_sys_id,
avg(nvl(pol_cvr_si,0)) total_si from TEST2.TRN_POLICY_COVER_GIS tpcg
group by pol_sys_id ) b where p.pol_sys_id = b.pol_sys_id)
Help to optimize to given query.update policy1 A
set total_si =
(select avg(nvl(pol_cvr_si,0))
from TEST2.TRN_POLICY_COVER_GIS B
where B.pol_sys_id = A.pol_sys_id
;hopefully there is an index on TEST2.TRN_POLICY_COVER_GIS (POL_SYS_ID) -
In a SQL query whihc has join, How to reduce Multiple instance of a table
in a SQL query which has join, How to reduce Multiple instance of a table
Here is an example: I am using Oracle 9i
is there a way to reduce no.of Person instances from the following query? or can I optimize this query further?
TABLES:
mail_table
mail_id, from_person_id, to_person_id, cc_person_id, subject, body
person_table
person_id, name, email
QUERY:
SELECT p_from.name from, p_to.name to, p_cc.name cc, subject
FROM mail, person p_from, person p_to, person p_cc
WHERE from_person_id = p_from.person_id
AND to_person_id = p_to.person_id
AND cc_person_id = p_cc.person_id
Thnanks in advance,
Babu.SQL> select * from mail;
ID F T CC
1 1 2 3
SQL> select * from person;
PID NAME
1 a
2 b
3 c
--Query with only ne Instance of PERSON Table
SQL> select m.id,max(decode(m.f,p.pid,p.name)) frm_name,
2 max(decode(m.t,p.pid,p.name)) to_name,
3 max(decode(m.cc,p.pid,p.name)) cc_name
4 from mail m,person p
5 where m.f = p.pid
6 or m.t = p.pid
7 or m.cc = p.pid
8 group by m.id;
ID FRM_NAME TO_NAME CC_NAME
1 a b c
--Expalin plan for "One instance" Query
SQL> explain plan for
2 select m.id,max(decode(m.f,p.pid,p.name)) frm_name,
3 max(decode(m.t,p.pid,p.name)) to_name,
4 max(decode(m.cc,p.pid,p.name)) cc_name
5 from mail m,person p
6 where m.f = p.pid
7 or m.t = p.pid
8 or m.cc = p.pid
9 group by m.id;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 902563036
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 3 | 216 | 7 (15)| 00:00:01 |
| 1 | HASH GROUP BY | | 3 | 216 | 7 (15)| 00:00:01 |
| 2 | NESTED LOOPS | | 3 | 216 | 6 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| MAIL | 1 | 52 | 3 (0)| 00:00:01 |
|* 4 | TABLE ACCESS FULL| PERSON | 3 | 60 | 3 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
4 - filter("M"."F"="P"."PID" OR "M"."T"="P"."PID" OR
"M"."CC"="P"."PID")
Note
- dynamic sampling used for this statement
--Explain plan for "Normal" query
SQL> explain plan for
2 select m.id,pf.name fname,pt.name tname,pcc.name ccname
3 from mail m,person pf,person pt,person pcc
4 where m.f = pf.pid
5 and m.t = pt.pid
6 and m.cc = pcc.pid;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 4145845855
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 112 | 14 (15)| 00:00:01 |
|* 1 | HASH JOIN | | 1 | 112 | 14 (15)| 00:00:01 |
|* 2 | HASH JOIN | | 1 | 92 | 10 (10)| 00:00:01 |
|* 3 | HASH JOIN | | 1 | 72 | 7 (15)| 00:00:01 |
| 4 | TABLE ACCESS FULL| MAIL | 1 | 52 | 3 (0)| 00:00:01 |
| 5 | TABLE ACCESS FULL| PERSON | 3 | 60 | 3 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
| 6 | TABLE ACCESS FULL | PERSON | 3 | 60 | 3 (0)| 00:00:01 |
| 7 | TABLE ACCESS FULL | PERSON | 3 | 60 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - access("M"."CC"="PCC"."PID")
2 - access("M"."T"="PT"."PID")
3 - access("M"."F"="PF"."PID")
PLAN_TABLE_OUTPUT
Note
- dynamic sampling used for this statement
25 rows selected.
Message was edited by:
jeneesh
No indexes created... -
Urgent HELP - How to reduce the number of entries in table MESYBODY?
Does anyone know how to reduce the number of records in synchronization table MESYBODY and MESYHEAD? The reason I wanted to reduce these tables is because I believe they have so many duplicated entries that causes extremely slow performance everytime we sync. Currently, there are almost 50,000 records for approximately 100 users, and I believe it shouldn't be that much.
We are running into a problem that it takes approximately 25-30 minutes to sync.
Any advices would be highly appreciated.
Regards,
DaiHi Dai,
please try to run the middleware job WAF_MW_MAPPING. For some applications (Mobile Time and Travel for example) this helps to clean the tables.
Br, alex
alexander ilg
http://www.msc-mobile.com -
How to reduce time for replicating large tables?
Hi
Any suggestions on how to reduce the amount of time it takes to replicate a large table when it is first created?
I have a table with 150 million rows in it, and it takes forever to start the replication process even if I run it in parallel, and I cant afford the downtime.What downtime are you referring to? The primary doesn't need to be down when you're setting up replication and you're presumably still in the process of doing the initial configuration on the replicated database, so it's not really down, it's just not up yet.
Justin -
How to reduce oracle DB's size?
Hi,All
After upgrading NW7.0 to NW7.0 EHP1, the oracle's changed from 37GB to 70GB, How to reduce the DB's size?
Thanks.
Best regards
Jiande DingHi,
1.From DB02--> detail analysis menu you can take out top 50 tables & indexes. you can mark the size of the index should be generally less than the table.If its more or very much similar size of table, you can rebuild it using SE14. This can free some space.
or else you may use brspace to do this.
http://help.sap.com/saphelp_nw70/helpdata/EN/58/6bec38c9fa7e44b7f2163905863575/frameset.htm
In case of table this option is risky as it may result in data loss.
2. Earlywatch alert gives the top 20 degenrated index. you can check that which also gives a factor 'storage quality'.
3. Run report SAP_DROP_TMPTABLES. It removes temporary database objects. ( we do this in our BW system)
Hope this helps
Thanks
Sushil -
How to reduce Oracle Cluster Time Synchronization time to 0
Hi Guys,
How to reduce Offset (in msec) of Oracle Cluster Time Synchronization time to 0 ???
is there any command or is it the only solution to wait to become 0 slowly...
[root@caslive bin]# ./crsctl check ctss
CRS-4701: The Cluster Time Synchronization Service is in Active mode.
CRS-4702: Offset (in msec): -1300
regards,
manish
Email ID: [email protected]Hi,
1.From DB02--> detail analysis menu you can take out top 50 tables & indexes. you can mark the size of the index should be generally less than the table.If its more or very much similar size of table, you can rebuild it using SE14. This can free some space.
or else you may use brspace to do this.
http://help.sap.com/saphelp_nw70/helpdata/EN/58/6bec38c9fa7e44b7f2163905863575/frameset.htm
In case of table this option is risky as it may result in data loss.
2. Earlywatch alert gives the top 20 degenrated index. you can check that which also gives a factor 'storage quality'.
3. Run report SAP_DROP_TMPTABLES. It removes temporary database objects. ( we do this in our BW system)
Hope this helps
Thanks
Sushil -
Update New Records is taking much time to complete. How to reduce
Hi,
Iam having a Table with 200 Clumns and trying to Update 5 columns and the table has 5lakh Records. It is taking very much time 2hours to complete. Pls let me know why is this taking time how to reduce....
In my ssis Package iam using
Oracle Source
Look up
Oledb Command for the Update.
Please help ism stuck?I have somthing like this..
Update table
Set column1 =@column1, column2=@column2,column3=@column3,column4=@column4,column5=@column5
where column1=@column1
in this case i need to add a index on column1 right? Pls llet me know
Yes, an index in column1 (preferably clustered) would avoid the table scan for each update. The ELT the staging table alternative Jim suggested will likely perform better than individual updates for a large process like this.
Dan Guzman, SQL Server MVP, http://www.dbdelta.com -
How to reduce buffer busy waits, session hanging due to buffer busy waits
Hi,
How to reduce buffer busy waits, session hanging due to buffer busy waits.
Thanks,
Sathis.When I see through enterprise manager I see lot of
tables with buffer busy waits.
Is there any way by table name we can check the
blocks info.
The simple way is to look at the SQL statement and corresponding table name?
P1=file#, P2=block#. You can extract segment name(table or index) using this info.
Query v$bh like following:
SQL> select file#, block#, class#, objd from v$bh where file# = P1 and block# = P2;
SQL> select object_name from all_objects where object_id = <objd>;See following doc:
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_1051.htm
Or you can dump block:
SQL> alter system dump datafie <P1> block <P2>;Some excerpts from block dump:
scn: 0x07df.17e70782 seq: 0x01 flg: 0x04 tail: 0x07822301
frmt: 0x02 chkval: 0x61d0 type: 0x23=PAGETABLE SEGMENT HEADER
Map Header:: next 0x00000000 #extents: 1 obj#: 55881 flag: 0x10000000>
Can we do something at table level that will reduce
the waits.
Yes, some methods are known. But before thinking of that, you must verify which block class and which access are involved.
Typo... always. :(
Message was edited by:
Dion_Cho -
How to reduce performance time.
Hi,
Any body guide me how to reduce performance time for this report.
Its taking to much time for execution.
*& Report ZEOU_CST_CLAIM_REP *
REPORT zeou_cst_claim_rep.
*& Program Name : ZEOU_CST_CLAIM_REP *
*& Title : CST Claim Report *
*& Module Name : EOU *
*& Author : Chandra Vangoor *
*& Create Date : 05.05.2006 *
*& Logical DB : None *
*& Program Type : On-Line. *
*& SAP Release : 4.7 *
*& Description : *
*& Log Date Author Reason of change
TABLES
TABLES : a363,
mara,
marc,
makt,
ekko,
ekpo,
mkpf,
mseg,
konp,
konh.
SELECTION-SCREEN
SELECTION-SCREEN : BEGIN OF BLOCK cst WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR mara-matnr, "Material Number
s_lifnr FOR ekko-lifnr, "Account Number of the Vendor
s_bedat FOR ekko-bedat, "Purchasing Document Date
s_kschl FOR konh-kschl OBLIGATORY NO INTERVALS, "Condition type
s_bwart FOR mseg-bwart OBLIGATORY NO INTERVALS. "Movement Type (Inventory Management)
PARAMETERS : p_werks LIKE marc-werks OBLIGATORY. "Plant
SELECTION-SCREEN : END OF BLOCK cst.
INCLUDES
INCLUDE zalv_data.
DATA - INTERNAL TABLES AND FIELD LISTS
DATA : BEGIN OF a363_itab OCCURS 0,
matnr LIKE a363-matnr, "Material Number
lifnr LIKE a363-lifnr, "Account Number of the Vendor
werks LIKE a363-werks, "Plant
kschl LIKE a363-kschl, "Condition type
knumh LIKE a363-knumh, "Condition record number
kbetr LIKE konp-kbetr, "Rate (condition amount or percentage) where no scale exists
END OF a363_itab.
DATA : BEGIN OF konp_itab OCCURS 0,
knumh LIKE a363-knumh, "Condition record number
kbetr LIKE konp-kbetr, "Rate (condition amount or percentage) where no scale exists
lifnr LIKE a363-lifnr, "Account Number of the Vendor
END OF konp_itab.
DATA : BEGIN OF ekko_itab OCCURS 0,
ebeln LIKE ekko-ebeln, "Purchasing Document Number
lifnr LIKE ekko-lifnr, "Account Number of the Vendor
bedat LIKE ekko-bedat, "Purchasing Document Date
END OF ekko_itab.
DATA : BEGIN OF ekpo_itab OCCURS 0,
ebeln LIKE ekpo-ebeln, "Purchasing Document Number
ebelp LIKE ekpo-ebelp, "Item Number of Purchasing Document
matnr LIKE ekpo-matnr, "Material Number
werks LIKE ekpo-werks, "Plant
menge LIKE ekpo-menge, "Purchase order quantity
END OF ekpo_itab.
DATA : BEGIN OF v_po_det OCCURS 0, "VENDOR + PLANT + PO DEATILS
lifnr LIKE ekko-lifnr, "Account Number of the Vendor
ebeln LIKE ekko-ebeln, "Purchasing Document Number
ebelp LIKE ekpo-ebelp, "Item Number of Purchasing Document
bedat LIKE ekko-bedat, "Purchasing Document Date
matnr LIKE ekpo-matnr, "Material Number
werks LIKE ekpo-werks, "Plant
menge LIKE ekpo-menge, "Purchase order quantity
kbetr LIKE konp-kbetr, "Rate (condition amount or percentage) where no scale exists
END OF v_po_det.
DATA : BEGIN OF mseg_itab OCCURS 0,
mblnr LIKE mseg-mblnr, "Number of Material Document
ebeln LIKE mseg-ebeln, "Purchasing Document Number
ebelp LIKE mseg-ebelp, "Item Number of Purchasing Document
matnr LIKE mseg-matnr, "Material Number
lifnr LIKE mseg-lifnr, "Account Number of the Vendor
werks LIKE mseg-werks, "Plant
menge LIKE mseg-menge, "Quantity
dmbtr LIKE mseg-dmbtr, "Amount in local currency
bwart LIKE mseg-bwart, "Movement Type (Inventory Management)
END OF mseg_itab.
DATA : BEGIN OF mkpf_itab OCCURS 0,
mblnr LIKE mkpf-mblnr, "Number of Material Document
bldat LIKE mkpf-bldat, "Document Date in Document
END OF mkpf_itab.
DATA : BEGIN OF zeou_pcrdtl_itab OCCURS 0,
matnr LIKE zeou_pcrdtl-matnr, "Material Number
lifnr LIKE zeou_pcrdtl-lifnr, "Account Number of the Vendor
mblnr LIKE zeou_pcrdtl-mblnr, "Number of Material Document
whssn LIKE zeou_pcrdtl-whssn, "Warehouse Records Entry Serial No.
whsdt LIKE zeou_pcrdtl-whsdt, "Warehouse Records Entry date
END OF zeou_pcrdtl_itab.
DATA : BEGIN OF gr_wh_info OCCURS 0, "INFO OF GR & WH BASED ON MVMT TYPE & PO
mblnr LIKE mseg-mblnr, "Number of Material Document
bldat LIKE mkpf-bldat, "Document Date in Document
ebeln LIKE mseg-ebeln, "Purchasing Document Number
ebelp LIKE ekpo-ebelp, "Item Number of Purchasing Document
matnr LIKE mseg-matnr, "Material Number
lifnr LIKE mseg-lifnr, "Account Number of the Vendor
werks LIKE mseg-werks, "Plant
menge LIKE mseg-menge, "Quantity
dmbtr LIKE mseg-dmbtr, "Amount in local currency
bwart LIKE mseg-bwart, "Movement Type (Inventory Management)
whssn LIKE zeou_pcrdtl-whssn, "Warehouse Records Entry Serial No.
whsdt LIKE zeou_pcrdtl-whsdt, "Warehouse Records Entry date
END OF gr_wh_info.
DATA : BEGIN OF bseg_itab OCCURS 0,
ebeln LIKE bseg-ebeln, "Purchasing Document Number
ebelp LIKE bseg-ebelp, "Item Number of Purchasing Document
matnr LIKE bseg-matnr, "Material Number
lifnr LIKE bseg-lifnr, "Account Number of the Vendor
werks LIKE bseg-werks, "Plant
buzid LIKE bseg-buzid, "Identification of the Line Item
bschl LIKE bseg-bschl, "Posting Key
wrbtr LIKE bseg-wrbtr, "Amount in document currency
bukrs LIKE bseg-bukrs, "Company Code
belnr LIKE bseg-belnr, "Accounting Document Number
gjahr LIKE bseg-gjahr, "Fiscal Year
END OF bseg_itab.
DATA : BEGIN OF bkpf_itab OCCURS 0,
bukrs LIKE bkpf-bukrs, "Company Code
belnr LIKE bkpf-belnr, "Accounting Document Number
gjahr LIKE bkpf-gjahr, "Fiscal Year
xblnr LIKE bkpf-xblnr, "Reference Document Number
bldat LIKE bkpf-bldat, "Document Date in Document
END OF bkpf_itab.
DATA : BEGIN OF vend_inv OCCURS 0, "VENDOR INVOICE DETAILS
ebeln LIKE bseg-ebeln, "Purchasing Document Number
ebelp LIKE bseg-ebelp, "Item Number of Purchasing Document
matnr LIKE bseg-matnr, "Material Number
lifnr LIKE bseg-lifnr, "Account Number of the Vendor
werks LIKE bseg-werks, "Plant
buzid LIKE bseg-buzid, "Identification of the Line Item
bschl LIKE bseg-bschl, "Posting Key
wrbtr LIKE bseg-wrbtr, "Amount in document currency
bukrs LIKE bseg-bukrs, "Company Code
belnr LIKE bseg-belnr, "Accounting Document Number
gjahr LIKE bseg-gjahr, "Fiscal Year
xblnr LIKE bkpf-xblnr, "Reference Document Number
bldat LIKE bkpf-bldat, "Document Date in Document
END OF vend_inv.
DATA : BEGIN OF chckinit OCCURS 0, "CHEQUE INIT INFO
ebeln LIKE bseg-ebeln, "Purchasing Document Number
ebelp LIKE bseg-ebelp, "Item Number of Purchasing Document
matnr LIKE bseg-matnr, "Material Number
lifnr LIKE bseg-lifnr, "Account Number of the Vendor
werks LIKE bseg-werks, "Plant
buzid LIKE bseg-buzid, "Identification of the Line Item
bschl LIKE bseg-bschl, "Posting Key
bukrs LIKE bkpf-bukrs, "Company Code
belnr LIKE bkpf-belnr, "Accounting Document Number
gjahr LIKE bkpf-gjahr, "Fiscal Year
koart LIKE bseg-koart, "Account type
augbl LIKE bseg-augbl, "Document Number of the Clearing Document
END OF chckinit.
DATA : BEGIN OF chckpayer OCCURS 0, "CHEQUE BANK DETAILS
vblnr LIKE payr-vblnr, "Document Number of the Payment Document
zbukr LIKE payr-zbukr, "Paying company code
gjahr LIKE payr-gjahr, "Fiscal Year
chect LIKE payr-chect, "Check Number
zaldt LIKE payr-zaldt, "Probable Payment Date (Cash Discount 1 Due)
hbkid LIKE payr-hbkid, "Short key for a house bank
END OF chckpayer.
DATA : chckpayer_u LIKE chckpayer OCCURS 0 WITH HEADER LINE. "UNIQUE CHEQUE DETAILS
DATA : BEGIN OF chckfinal OCCURS 0, "CHEQUE FINAL INFO
ebeln LIKE bseg-ebeln, "Purchasing Document Number
ebelp LIKE bseg-ebelp, "Item Number of Purchasing Document
matnr LIKE bseg-matnr, "Material Number
lifnr LIKE bseg-lifnr, "Account Number of the Vendor
werks LIKE bseg-werks, "Plant
buzid LIKE bseg-buzid, "Identification of the Line Item
bschl LIKE bseg-bschl, "Posting Key
bukrs LIKE bkpf-bukrs, "Company Code
belnr LIKE bkpf-belnr, "Accounting Document Number
gjahr LIKE bkpf-gjahr, "Fiscal Year
koart LIKE bseg-koart, "Account type
augbl LIKE bseg-augbl, "Document Number of the Clearing Document
vblnr LIKE payr-vblnr, "Document Number of the Payment Document
zbukr LIKE payr-zbukr, "Paying company code
chect LIKE payr-chect, "Check Number
zaldt LIKE payr-zaldt, "Probable Payment Date (Cash Discount 1 Due)
hbkid LIKE payr-hbkid, "Short key for a house bank
END OF chckfinal.
DATA : BEGIN OF mat_desc OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF mat_desc.
DATA : BEGIN OF vend_det OCCURS 0,
lifnr LIKE lfa1-lifnr,
name1 LIKE lfa1-name1,
j_1icstno LIKE j_1imovend-j_1icstno,
END OF vend_det.
DATA : BEGIN OF cst_rep OCCURS 0, "FINAL CST REPORT
lifnr LIKE a363-lifnr, "Account Number of the Vendor
name1 LIKE lfa1-name1, "Vendor Name
j_1icstno LIKE j_1imovend-j_1icstno, " Vendor CST No.
werks LIKE a363-werks, "Plant
kschl LIKE a363-kschl, "Condition type
ebeln LIKE ekko-ebeln, "Purchasing Document Number
ebelp LIKE ekpo-ebelp, "Item Number of Purchasing Document
bedat LIKE ekko-bedat, "Purchasing Document Date
matnr LIKE ekpo-matnr, "Material Number
maktx LIKE makt-maktx, "Material Description.
kbetr LIKE konp-kbetr, "Rate (condition amount or percentage) where no scale exists
mblnr LIKE mseg-mblnr, "Number of Material Document
bldat LIKE mkpf-bldat, "Document Date in Document
menge LIKE mseg-menge, "Quantity
dmbtr LIKE mseg-dmbtr, "Amount in local currency
cst_dmbtr LIKE mseg-dmbtr, "CST Amount in local currency
bwart LIKE mseg-bwart, "Movement Type (Inventory Management)
whssn LIKE zeou_pcrdtl-whssn, "Warehouse Records Entry Serial No.
whsdt LIKE zeou_pcrdtl-whsdt, "Warehouse Records Entry date
buzid LIKE bseg-buzid, "Identification of the Line Item
bschl LIKE bseg-bschl, "Posting Key
wrbtr LIKE bseg-wrbtr, "Amount in document currency
cst_wrbtr LIKE bseg-wrbtr, "CST Amount in document currency
belnr LIKE bseg-belnr, "Accounting Document Number
gjahr LIKE bseg-gjahr, "Fiscal Year
xblnr LIKE bkpf-xblnr, "Reference Document Number
koart LIKE bseg-koart, "Account type
augbl LIKE bseg-augbl, "Document Number of the Clearing Document
vblnr LIKE payr-vblnr, "Document Number of the Payment Document
zbukr LIKE payr-zbukr, "Paying company code
chect LIKE payr-chect, "Check Number
zaldt LIKE payr-zaldt, "Probable Payment Date (Cash Discount 1 Due)
hbkid LIKE payr-hbkid, "Short key for a house bank
END OF cst_rep.
DATA : BEGIN OF gt_output OCCURS 0, "ALV OUTPUT
slno LIKE sy-tabix, "Serial Number
lifnr LIKE a363-lifnr, "Account Number of the Vendor
name1 LIKE lfa1-name1, "Vendor Name
j_1icstno LIKE j_1imovend-j_1icstno, " Vendor CST No.
werks LIKE a363-werks, "Plant
kschl LIKE a363-kschl, "Condition type
ebeln LIKE ekko-ebeln, "Purchasing Document Number
ebelp LIKE ekpo-ebelp, "Item Number of Purchasing Document
bedat LIKE ekko-bedat, "Purchasing Document Date
matnr LIKE ekpo-matnr, "Material Number
maktx LIKE makt-maktx, "Material Description
mblnr LIKE mseg-mblnr, "Number of Material Document
bldat LIKE mkpf-bldat, "Document Date in Document
menge LIKE mseg-menge, "Quantity
dmbtr LIKE mseg-dmbtr, "Amount in local currency
cst_dmbtr LIKE mseg-dmbtr, "CST Amount in local currency
bwart LIKE mseg-bwart, "Movement Type (Inventory Management)
whssn LIKE zeou_pcrdtl-whssn, "Warehouse Records Entry Serial No.
whsdt LIKE zeou_pcrdtl-whsdt, "Warehouse Records Entry date
buzid LIKE bseg-buzid, "Identification of the Line Item
bschl LIKE bseg-bschl, "Posting Key
wrbtr LIKE bseg-wrbtr, "Amount in document currency
cst_wrbtr LIKE bseg-wrbtr, "CST Amount in document currency
belnr LIKE bseg-belnr, "Accounting Document Number
gjahr LIKE bseg-gjahr, "Fiscal Year
xblnr LIKE bkpf-xblnr, "Reference Document Number
koart LIKE bseg-koart, "Account type
augbl LIKE bseg-augbl, "Document Number of the Clearing Document
vblnr LIKE payr-vblnr, "Document Number of the Payment Document
zbukr LIKE payr-zbukr, "Paying company code
chect LIKE payr-chect, "Check Number
zaldt LIKE payr-zaldt, "Probable Payment Date (Cash Discount 1 Due)
hbkid LIKE payr-hbkid, "Short key for a house bank
usr_txt1(20) TYPE c,
usr_txt2(20) TYPE c,
END OF gt_output.
*Working Variables
DATA : cst_gr LIKE mseg-dmbtr,
cst_inv LIKE bseg-wrbtr,
usr_txt1(20) TYPE c,
usr_txt2(20) TYPE c.
START-OF-SELECTION.
*Retreiving Data from a363 table for the given input
SELECT matnr
lifnr
werks
kschl
knumh
FROM a363
INTO TABLE a363_itab
WHERE matnr IN s_matnr AND lifnr IN s_lifnr AND werks EQ p_werks AND kschl IN s_kschl.
*rakesh ***************************
SELECT *
FROM konp
INTO CORRESPONDING FIELDS OF TABLE konp_itab
FOR ALL ENTRIES IN a363_itab
WHERE knumh EQ a363_itab-knumh.
IF a363_itab[] IS NOT INITIAL.
SELECT knumh
kbetr
lifnr
FROM konp INTO TABLE konp_itab
FOR ALL ENTRIES IN a363_itab
WHERE knumh EQ a363_itab-knumh.
ENDIF.
LOOP AT a363_itab.
READ TABLE konp_itab WITH KEY knumh = a363_itab-knumh.
IF sy-subrc EQ 0.
MOVE : konp_itab-kbetr TO a363_itab-kbetr.
MODIFY a363_itab.
ENDIF.
CLEAR : a363_itab, konp_itab.
ENDLOOP.
rakesh****************************
SELECT *
FROM makt
INTO CORRESPONDING FIELDS OF TABLE mat_desc
FOR ALL ENTRIES IN a363_itab
WHERE matnr EQ a363_itab-matnr.
SELECT matnr
maktx
FROM makt INTO TABLE mat_desc
FOR ALL ENTRIES IN a363_itab
WHERE matnr EQ a363_itab-matnr.
SELECT a~lifnr
a~name1
b~j_1icstno
INTO TABLE vend_det
FROM lfa1 AS a JOIN j_1imovend AS b
ON alifnr EQ blifnr
FOR ALL ENTRIES IN a363_itab
WHERE a~lifnr EQ a363_itab-lifnr.
Retreiving Data from EKKO & EKPO table for the given input
And Populating the V_PO_DETAILS itab
SELECT *
FROM ekko
INTO CORRESPONDING FIELDS OF TABLE ekko_itab
FOR ALL ENTRIES IN a363_itab
WHERE lifnr EQ a363_itab-lifnr AND bedat IN s_bedat.
IF a363_itab[] IS NOT INITIAL.
SELECT ebeln
lifnr
bedat
FROM ekko INTO TABLE ekko_itab
FOR ALL ENTRIES IN a363_itab
WHERE lifnr EQ a363_itab-lifnr AND bedat IN s_bedat.
ENDIF.
SELECT *
FROM ekpo
INTO CORRESPONDING FIELDS OF TABLE ekpo_itab
FOR ALL ENTRIES IN a363_itab
WHERE matnr EQ a363_itab-matnr AND werks EQ a363_itab-werks AND mwskz NE 'V0'.
IF a363_itab[] IS NOT INITIAL.
SELECT ebeln
ebelp
matnr
werks
menge
FROM ekpo INTO TABLE ekpo_itab
FOR ALL ENTRIES IN a363_itab
WHERE matnr EQ a363_itab-matnr AND werks EQ a363_itab-werks AND mwskz NE 'V0'.
ENDIF.
LOOP AT ekpo_itab.
MOVE : ekpo_itab-ebelp TO v_po_det-ebelp,
ekpo_itab-matnr TO v_po_det-matnr,
ekpo_itab-werks TO v_po_det-werks,
ekpo_itab-menge TO v_po_det-menge.
READ TABLE ekko_itab WITH KEY ebeln = ekpo_itab-ebeln.
IF sy-subrc EQ 0.
MOVE : ekko_itab-lifnr TO v_po_det-lifnr,
ekko_itab-ebeln TO v_po_det-ebeln,
ekko_itab-bedat TO v_po_det-bedat.
APPEND : v_po_det.
ENDIF.
CLEAR : ekko_itab, ekpo_itab, v_po_det.
ENDLOOP.
LOOP AT v_po_det.
READ TABLE a363_itab WITH KEY matnr = v_po_det-matnr lifnr = v_po_det-lifnr werks = v_po_det-werks.
IF sy-subrc EQ 0.
MOVE : a363_itab-kbetr TO v_po_det-kbetr.
MODIFY v_po_det.
ENDIF.
CLEAR : a363_itab, v_po_det.
ENDLOOP.
Retreiving Data from MKPF & MSEG & ZEOU_PCRDTL table for the given input
And Populating the GR_WH_info itab
SELECT *
FROM mseg
INTO CORRESPONDING FIELDS OF TABLE mseg_itab
FOR ALL ENTRIES IN v_po_det
WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND bwart IN s_bwart.
IF v_po_det[] IS NOT INITIAL.
SELECT mblnr
ebeln
ebelp
matnr
lifnr
werks
menge
dmbtr
bwart
FROM mseg INTO TABLE mseg_itab
FOR ALL ENTRIES IN v_po_det
WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND bwart IN s_bwart.
ENDIF.
IF mseg_itab[] IS NOT INITIAL.
SELECT *
FROM mkpf
INTO CORRESPONDING FIELDS OF TABLE mkpf_itab
FOR ALL ENTRIES IN mseg_itab
WHERE mblnr EQ mseg_itab-mblnr.
SELECT mblnr
bldat
FROM mkpf INTO TABLE mkpf_itab
FOR ALL ENTRIES IN mseg_itab
WHERE mblnr EQ mseg_itab-mblnr.
SELECT *
FROM zeou_pcrdtl
INTO CORRESPONDING FIELDS OF TABLE zeou_pcrdtl_itab
FOR ALL ENTRIES IN mseg_itab
WHERE mblnr EQ mseg_itab-mblnr AND matnr EQ mseg_itab-matnr.
SELECT matnr
lifnr
mblnr
whssn
whsdt
FROM zeou_pcrdtl INTO TABLE zeou_pcrdtl_itab
FOR ALL ENTRIES IN mseg_itab
WHERE mblnr EQ mseg_itab-mblnr AND matnr EQ mseg_itab-matnr.
ENDIF.
LOOP AT mseg_itab.
MOVE : mseg_itab-mblnr TO gr_wh_info-mblnr,
mseg_itab-ebeln TO gr_wh_info-ebeln,
mseg_itab-ebelp TO gr_wh_info-ebelp,
mseg_itab-matnr TO gr_wh_info-matnr,
mseg_itab-lifnr TO gr_wh_info-lifnr,
mseg_itab-werks TO gr_wh_info-werks,
mseg_itab-menge TO gr_wh_info-menge,
mseg_itab-dmbtr TO gr_wh_info-dmbtr,
mseg_itab-bwart TO gr_wh_info-bwart.
READ TABLE mkpf_itab WITH KEY mblnr = mseg_itab-mblnr.
IF sy-subrc EQ 0.
MOVE : mkpf_itab-bldat TO gr_wh_info-bldat.
ENDIF.
READ TABLE zeou_pcrdtl_itab WITH KEY mblnr = mseg_itab-mblnr.
IF sy-subrc EQ 0.
MOVE : zeou_pcrdtl_itab-whssn TO gr_wh_info-whssn,
zeou_pcrdtl_itab-whsdt TO gr_wh_info-whsdt.
ENDIF.
APPEND : gr_wh_info.
CLEAR : mseg_itab, mkpf_itab, gr_wh_info.
ENDLOOP.
Retreiving Data from BSEG & BKPF table
And Populating the Vendor Invoice Details
IF v_po_det[] IS NOT INITIAL.
SELECT *
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE bseg_itab
FOR ALL ENTRIES IN v_po_det
WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '96'.
SELECT ebeln
ebelp
matnr
lifnr
werks
buzid
bschl
wrbtr
bukrs
belnr
gjahr
FROM bseg INTO TABLE bseg_itab
FOR ALL ENTRIES IN v_po_det
WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '96'.
ENDIF.
IF bseg_itab[] IS NOT INITIAL.
SELECT *
FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE bkpf_itab
FOR ALL ENTRIES IN bseg_itab
WHERE bukrs EQ bseg_itab-bukrs AND belnr EQ bseg_itab-belnr AND gjahr EQ bseg_itab-gjahr.
SELECT bukrs
belnr
gjahr
xblnr
bldat
FROM bkpf INTO TABLE bkpf_itab
FOR ALL ENTRIES IN bseg_itab
WHERE bukrs EQ bseg_itab-bukrs AND belnr EQ bseg_itab-belnr AND gjahr EQ bseg_itab-gjahr.
ENDIF.
LOOP AT bseg_itab.
MOVE : bseg_itab-ebeln TO vend_inv-ebeln,
bseg_itab-ebelp TO vend_inv-ebelp,
bseg_itab-matnr TO vend_inv-matnr,
bseg_itab-lifnr TO vend_inv-lifnr,
bseg_itab-werks TO vend_inv-werks,
bseg_itab-buzid TO vend_inv-buzid,
bseg_itab-bschl TO vend_inv-bschl,
bseg_itab-wrbtr TO vend_inv-wrbtr,
bseg_itab-bukrs TO vend_inv-bukrs,
bseg_itab-belnr TO vend_inv-belnr,
bseg_itab-gjahr TO vend_inv-gjahr.
READ TABLE bkpf_itab WITH KEY bukrs = bseg_itab-bukrs belnr = bseg_itab-belnr gjahr = bseg_itab-gjahr.
IF sy-subrc EQ 0.
MOVE : bkpf_itab-xblnr TO vend_inv-xblnr,
bkpf_itab-bldat TO vend_inv-bldat.
APPEND : vend_inv.
ENDIF.
CLEAR : vend_inv, bseg_itab, bkpf_itab.
ENDLOOP.
Retreiving Data from BSEG & BKPF table
And Populating the Cheque Info Details
IF v_po_det[] IS NOT INITIAL.
SELECT *
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE chckinit
FOR ALL ENTRIES IN v_po_det
WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '86' AND koart EQ 'K'.
SELECT ebeln
ebelp
matnr
lifnr
werks
buzid
bschl
bukrs
belnr
gjahr
koart
augbl
FROM bseg INTO TABLE chckinit
FOR ALL ENTRIES IN v_po_det
WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '86' AND koart EQ 'K'.
ENDIF.
IF chckinit[] IS NOT INITIAL.
SELECT *
FROM payr
INTO CORRESPONDING FIELDS OF TABLE chckpayer
FOR ALL ENTRIES IN chckinit
WHERE vblnr EQ chckinit-augbl.
SELECT vblnr
zbukr
gjahr
chect
zaldt
hbkid
FROM payr INTO TABLE chckpayer
FOR ALL ENTRIES IN chckinit
WHERE vblnr EQ chckinit-augbl.
ENDIF.
SORT chckpayer BY vblnr DESCENDING.
LOOP AT chckpayer.
ON CHANGE OF chckpayer-vblnr.
MOVE : chckpayer TO chckpayer_u.
APPEND : chckpayer_u.
CLEAR : chckpayer_u, chckpayer.
ENDON.
ENDLOOP.
LOOP AT chckinit.
MOVE : chckinit-ebeln TO chckfinal-ebeln,
chckinit-ebelp TO chckfinal-ebelp,
chckinit-matnr TO chckfinal-matnr,
chckinit-lifnr TO chckfinal-lifnr,
chckinit-werks TO chckfinal-werks,
chckinit-buzid TO chckfinal-buzid,
chckinit-bschl TO chckfinal-bschl,
chckinit-bukrs TO chckfinal-bukrs,
chckinit-gjahr TO chckfinal-gjahr,
chckinit-koart TO chckfinal-koart,
chckinit-augbl TO chckfinal-augbl.
READ TABLE chckpayer_u WITH KEY vblnr = chckinit-augbl gjahr = chckinit-gjahr.
IF sy-subrc EQ 0.
MOVE : chckpayer_u-vblnr TO chckfinal-vblnr,
chckpayer_u-zbukr TO chckfinal-zbukr,
chckpayer_u-chect TO chckfinal-chect,
chckpayer_u-zaldt TO chckfinal-zaldt,
chckpayer_u-hbkid TO chckfinal-hbkid.
APPEND : chckfinal.
ENDIF.
CLEAR : chckfinal, chckpayer_u, chckinit.
ENDLOOP.
Populating the final CST TABLE
LOOP AT v_po_det.
MOVE : v_po_det-lifnr TO cst_rep-lifnr,
v_po_det-werks TO cst_rep-werks,
v_po_det-ebeln TO cst_rep-ebeln,
v_po_det-ebelp TO cst_rep-ebelp,
v_po_det-bedat TO cst_rep-bedat,
v_po_det-matnr TO cst_rep-matnr,
v_po_det-kbetr TO cst_rep-kbetr.
READ TABLE gr_wh_info WITH KEY ebeln = v_po_det-ebeln ebelp = v_po_det-ebelp."matnr = v_po_det-matnr.
IF sy-subrc EQ 0.
MOVE : gr_wh_info-mblnr TO cst_rep-mblnr,
gr_wh_info-bldat TO cst_rep-bldat,
gr_wh_info-menge TO cst_rep-menge,
gr_wh_info-dmbtr TO cst_rep-dmbtr,
gr_wh_info-bwart TO cst_rep-bwart,
gr_wh_info-whssn TO cst_rep-whssn,
gr_wh_info-whsdt TO cst_rep-whsdt.
ENDIF.
READ TABLE vend_inv WITH KEY ebeln = v_po_det-ebeln ebelp = v_po_det-ebelp."matnr = v_po_det-matnr.
IF sy-subrc EQ 0.
MOVE : vend_inv-buzid TO cst_rep-buzid,
vend_inv-bschl TO cst_rep-bschl,
vend_inv-wrbtr TO cst_rep-wrbtr,
vend_inv-belnr TO cst_rep-belnr,
vend_inv-gjahr TO cst_rep-gjahr,
vend_inv-xblnr TO cst_rep-xblnr.
ENDIF.
READ TABLE chckfinal WITH KEY ebeln = v_po_det-ebeln ebelp = v_po_det-ebelp."matnr = v_po_det-matnr.
IF sy-subrc EQ 0.
MOVE : chckfinal-augbl TO cst_rep-augbl,
chckfinal-vblnr TO cst_rep-vblnr,
chckfinal-zbukr TO cst_rep-zbukr,
chckfinal-chect TO cst_rep-chect,
chckfinal-zaldt TO cst_rep-zaldt,
chckfinal-hbkid TO cst_rep-hbkid.
ENDIF.
READ TABLE mat_desc WITH KEY matnr = v_po_det-matnr.
IF sy-subrc EQ 0.
MOVE : mat_desc-maktx TO cst_rep-maktx.
ENDIF.
READ TABLE vend_det WITH KEY lifnr = v_po_det-lifnr.
IF sy-subrc EQ 0.
MOVE : vend_det-name1 TO cst_rep-name1,
vend_det-j_1icstno TO cst_rep-j_1icstno.
ENDIF.
APPEND : cst_rep.
CLEAR : cst_rep, v_po_det, gr_wh_info, vend_inv, chckfinal.
ENDLOOP.
Populating GT_output
LOOP AT cst_rep.
cst_gr = cst_rep-dmbtr * ( cst_rep-kbetr / 1000 ).
cst_inv = cst_rep-wrbtr * ( cst_rep-kbetr / 1000 ).
MOVE : cst_gr TO cst_rep-cst_dmbtr,
cst_inv TO cst_rep-cst_wrbtr.
MODIFY : cst_rep.
CLEAR : cst_rep, cst_gr, cst_inv.
ENDLOOP.
LOOP AT cst_rep.
MOVE : sy-tabix TO gt_output-slno,
cst_rep-lifnr TO gt_output-lifnr,
cst_rep-name1 TO gt_output-name1,
cst_rep-j_1icstno TO gt_output-j_1icstno,
cst_rep-werks TO gt_output-werks,
cst_rep-matnr TO gt_output-matnr,
cst_rep-maktx TO gt_output-maktx,
cst_rep-ebeln TO gt_output-ebeln,
cst_rep-ebelp TO gt_output-ebelp,
cst_rep-bedat TO gt_output-bedat,
cst_rep-mblnr TO gt_output-mblnr,
cst_rep-bldat TO gt_output-bldat,
cst_rep-menge TO gt_output-menge,
cst_rep-dmbtr TO gt_output-dmbtr,
cst_rep-cst_dmbtr TO gt_output-cst_dmbtr,
cst_rep-bwart TO gt_output-bwart,
cst_rep-whssn TO gt_output-whssn,
cst_rep-whsdt TO gt_output-whsdt,
cst_rep-buzid TO gt_output-buzid,
cst_rep-bschl TO gt_output-bschl,
cst_rep-wrbtr TO gt_output-wrbtr,
cst_rep-cst_wrbtr TO gt_output-cst_wrbtr,
cst_rep-belnr TO gt_output-belnr,
cst_rep-gjahr TO gt_output-gjahr,
cst_rep-xblnr TO gt_output-xblnr,
cst_rep-augbl TO gt_output-augbl,
cst_rep-vblnr TO gt_output-vblnr,
cst_rep-zbukr TO gt_output-zbukr,
cst_rep-chect TO gt_output-chect,
cst_rep-zaldt TO gt_output-zaldt,
cst_rep-hbkid TO gt_output-hbkid.
APPEND gt_output.
CLEAR : cst_rep, gt_output, sy-tabix.
ENDLOOP.
END-OF-SELECTION.
*-ALV Routine
PERFORM alv_forms.
*& Form alv_forms
FORM alv_forms.
PERFORM alv_routines.
gx_variant = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
vari = gx_variant-variant.
ENDIF.
PERFORM comment_build USING gt_list_top_of_page[].
PERFORM fieldcat_init USING gt_fieldcat[].
PERFORM layout_build USING gs_layout.
PERFORM print_build USING gs_print.
PERFORM alv_output.
ENDFORM. " alv_forms
*& Form alv_routines
FORM alv_routines.
PERFORM eventtab_build USING gt_events[].
PERFORM e06_t_sort_build USING gt_sort[].
PERFORM sp_group_build USING gt_sp_group[].
g_save = 'A'.
PERFORM variant_init.
ENDFORM. " alv_routines
*& Form eventtab_build
----Hi Anu,
These two statements taking to much time for execution what I can do for reducing execution time.
Regards,
Rakesh
SELECT ebeln
ebelp
matnr
lifnr
werks
buzid
bschl
wrbtr
bukrs
belnr
gjahr
FROM bseg INTO TABLE bseg_itab
FOR ALL ENTRIES IN v_po_det
WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '96'.
ENDIF.
SELECT ebeln
ebelp
matnr
lifnr
werks
buzid
bschl
bukrs
belnr
gjahr
koart
augbl
FROM bseg INTO TABLE chckinit
FOR ALL ENTRIES IN v_po_det
WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '86' AND koart EQ 'K'.
ENDIF. -
Web report for opening it takes long time how to reduce the time?
HI Experts,
I created report using webi. For next time while opening it takes more time. How to reduce the time.Hi Manikandan,
There could be multiple reason behind the bad performance.
1. Are you using supported JVM version to run Webi reports?
2. Do the reports contain prompts? Are the LOVs set to "Automatic refresh before use"? If yes, uncheck it.
3. How many queries do the report has? Can you run the queries one by one and check which query is taking much time?
4. If it based on relational database, copy and run it against the database directly and check how much time it takes. If more, you may have to fix the issue at database level like using temporary tables, indices, etc.
5. Also check if there are firewalls or proxy server between client and server communication. if yes, try to refresh the report directly on BO server and check.
6. Check if there is any hinderance between BO server and Database server communcation.
Hope it will help.
Regards,
Yuvraj -
How to reduce the query fetch from TKPROF output?
Hi,
Below is my query contains the TKPROF output.Here fetch is too high. How to reduce the fetch from here. And please check the explain plan is good or not?
SELECT czci.config_hdr_id,
czci.config_rev_nbr,
asoqla.quantity,
(SELECT
node_desc.LOCALIZED_STR
FROM CZ_LOCALIZED_TEXTS node_desc,
CZ_PS_NODES ps_nodes,
CZ_CONFIG_ITEMS czci1
WHERE czci1.config_hdr_id = asoqld.config_header_id
AND czci1.config_rev_nbr = asoqld.config_revision_num
AND node_desc.INTL_TEXT_ID = ps_nodes.INTL_TEXT_ID
AND NVL(node_desc.LANGUAGE,userenv('LANG')) = userenv('LANG')
AND czci1.PS_NODE_ID = ps_nodes.PERSISTENT_NODE_ID
AND ps_nodes.DEVL_PROJECT_ID = (SELECT MAX(DEVL_PROJECT_ID) FROM CZ_DEVL_PROJECTS WHERE NAME LIKE 'Control Model')
AND czci1.PARENT_CONFIG_ITEM_ID IN (SELECT sub_sub.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS sub_sub
WHERE sub_sub.CONFIG_HDR_ID = asoqld.config_header_id
AND sub_sub.CONFIG_REV_NBR = asoqld.config_revision_num
AND sub_sub.PS_NODE_NAME = 'fittings')) fitting_material,
(SELECT
node_desc.LOCALIZED_STR
FROM CZ_LOCALIZED_TEXTS node_desc,
CZ_PS_NODES ps_nodes,
CZ_CONFIG_ITEMS czci
WHERE czci.config_hdr_id = asoqld.config_header_id
AND czci.config_rev_nbr = asoqld.config_revision_num
AND node_desc.INTL_TEXT_ID = ps_nodes.INTL_TEXT_ID
AND NVL(node_desc.LANGUAGE,userenv('LANG')) = userenv('LANG')
AND czci.PS_NODE_ID = ps_nodes.PERSISTENT_NODE_ID
AND ps_nodes.DEVL_PROJECT_ID = (SELECT MAX(DEVL_PROJECT_ID) FROM CZ_DEVL_PROJECTS WHERE NAME LIKE 'Control Model')
AND czci.PARENT_CONFIG_ITEM_ID IN (SELECT sub_sub.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS sub_sub
WHERE sub_sub.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
AND sub_sub.CONFIG_REV_NBR = czci.CONFIG_REV_NBR
AND sub_sub.PS_NODE_NAME = 'tubing')) tubing_material
FROM aso_quote_lines_all asoqla,
aso_quote_line_details asoqld,
cz_config_items czci
WHERE asoqla.quote_header_id = 55774
AND asoqla.item_type_code = 'MDL'
--AND asoqla.org_id = 2763
AND asoqla.quote_line_id = asoqld.quote_line_id
AND asoqld.config_header_id = czci.config_hdr_id
AND asoqld.config_revision_num = czci.config_rev_nbr
AND czci.ps_node_name = 'CONTROL MASTER ASLY'
call count cpu elapsed disk query current rows
Parse 1 0.04 0.03 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 3 0.09 0.08 0 5100 0 19
total 5 0.13 0.12 0 5100 0 19
Misses in library cache during parse: 1
Optimizer goal: ALL_ROWS
Parsing user id: 173 (APPS)
Rows Row Source Operation
3 TABLE ACCESS BY INDEX ROWID CZ_LOCALIZED_TEXTS (cr=2161 pr=0 pw=0 time=32425 us)
40 NESTED LOOPS (cr=2158 pr=0 pw=0 time=32276 us)
3 NESTED LOOPS (cr=2147 pr=0 pw=0 time=32156 us)
3 NESTED LOOPS (cr=925 pr=0 pw=0 time=15885 us)
3 TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=665 pr=0 pw=0 time=13456 us)
5490 INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=96 pr=0 pw=0 time=1237 us)(object id 3049621)
3 TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=260 pr=0 pw=0 time=2401 us)
1094 INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=19 pr=0 pw=0 time=250 us)(object id 3049621)
3 TABLE ACCESS BY INDEX ROWID CZ_PS_NODES (cr=1222 pr=0 pw=0 time=16249 us)
3 INDEX RANGE SCAN CZ_PS_NODES_N12 (cr=1219 pr=0 pw=0 time=16211 us)(object id 750095)
1 SORT AGGREGATE (cr=1211 pr=0 pw=0 time=16125 us)
209 TABLE ACCESS FULL CZ_DEVL_PROJECTS (cr=1211 pr=0 pw=0 time=15883 us)
18 INDEX RANGE SCAN CZ_LOCALIZED_TEXTS_N1 (cr=11 pr=0 pw=0 time=68 us)(object id 31504)
3 TABLE ACCESS BY INDEX ROWID CZ_LOCALIZED_TEXTS (cr=2161 pr=0 pw=0 time=31499 us)
40 NESTED LOOPS (cr=2158 pr=0 pw=0 time=31351 us)
3 NESTED LOOPS (cr=2147 pr=0 pw=0 time=31215 us)
3 NESTED LOOPS (cr=925 pr=0 pw=0 time=15271 us)
3 TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=665 pr=0 pw=0 time=12441 us)
5490 INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=96 pr=0 pw=0 time=1230 us)(object id 3049621)
3 TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=260 pr=0 pw=0 time=2795 us)
1094 INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=19 pr=0 pw=0 time=264 us)(object id 3049621)
3 TABLE ACCESS BY INDEX ROWID CZ_PS_NODES (cr=1222 pr=0 pw=0 time=15920 us)
3 INDEX RANGE SCAN CZ_PS_NODES_N12 (cr=1219 pr=0 pw=0 time=15863 us)(object id 750095)
1 SORT AGGREGATE (cr=1211 pr=0 pw=0 time=15753 us)
209 TABLE ACCESS FULL CZ_DEVL_PROJECTS (cr=1211 pr=0 pw=0 time=15452 us)
18 INDEX RANGE SCAN CZ_LOCALIZED_TEXTS_N1 (cr=11 pr=0 pw=0 time=79 us)(object id 31504)
19 TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=778 pr=0 pw=0 time=20571 us)
5816 NESTED LOOPS (cr=202 pr=0 pw=0 time=8497 us)
21 NESTED LOOPS (cr=96 pr=0 pw=0 time=2037 us)
23 TABLE ACCESS BY INDEX ROWID ASO_QUOTE_LINES_ALL (cr=47 pr=0 pw=0 time=1427 us)
1058 INDEX RANGE SCAN ASO_QUOTE_LINES_ALL_N1 (cr=9 pr=0 pw=0 time=51 us)(object id 81688)
21 TABLE ACCESS BY INDEX ROWID ASO_QUOTE_LINE_DETAILS (cr=49 pr=0 pw=0 time=596 us)
21 INDEX RANGE SCAN ASO_QUOTE_LINE_DETAILS_N1 (cr=28 pr=0 pw=0 time=323 us)(object id 81706)
5794 INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=106 pr=0 pw=0 time=1424 us)(object id 3049621)Hi
After affed the exist operator i got below output. But it is more than that the previous one.
SELECT czci.config_hdr_id, czci.config_rev_nbr, asoqla.quantity,
(SELECT node_desc.localized_str
FROM cz_localized_texts node_desc,
cz_ps_nodes ps_nodes,
cz_config_items czci1
WHERE czci1.config_hdr_id = asoqld.config_header_id
AND czci1.config_rev_nbr = asoqld.config_revision_num
AND node_desc.intl_text_id = ps_nodes.intl_text_id
AND NVL (node_desc.LANGUAGE, USERENV ('LANG')) = USERENV ('LANG')
AND czci1.ps_node_id = ps_nodes.persistent_node_id
AND ps_nodes.devl_project_id = (SELECT MAX (devl_project_id)
FROM cz_devl_projects
WHERE NAME = 'Control Model')
AND EXISTS (
SELECT NULL
FROM cz_config_items sub_sub
WHERE sub_sub.config_hdr_id = asoqld.config_header_id
AND sub_sub.config_rev_nbr = asoqld.config_revision_num
AND sub_sub.ps_node_name = 'fittings'
AND czci1.parent_config_item_id = sub_sub.config_item_id))
fitting_material,
(SELECT node_desc.localized_str
FROM cz_localized_texts node_desc,
cz_ps_nodes ps_nodes,
cz_config_items czci1
WHERE czci1.config_hdr_id = asoqld.config_header_id
AND czci1.config_rev_nbr = asoqld.config_revision_num
AND node_desc.intl_text_id = ps_nodes.intl_text_id
AND node_desc.LANGUAGE = USERENV ('LANG')
AND czci1.ps_node_id = ps_nodes.persistent_node_id
AND ps_nodes.devl_project_id = (SELECT MAX (devl_project_id)
FROM cz_devl_projects
WHERE NAME = 'Control Model')
AND EXISTS (
SELECT NULL
FROM cz_config_items sub_sub
WHERE sub_sub.config_hdr_id = czci.config_hdr_id
AND sub_sub.config_rev_nbr = czci.config_rev_nbr
AND sub_sub.ps_node_name = 'tubing'
AND czci1.parent_config_item_id = sub_sub.config_item_id))
tubing_material
FROM aso_quote_lines_all asoqla,
aso_quote_line_details asoqld,
cz_config_items czci
WHERE asoqla.quote_header_id = 55774
AND asoqla.item_type_code = 'MDL'
--AND asoqla.org_id = 2763
AND asoqla.quote_line_id = asoqld.quote_line_id
AND asoqld.config_header_id = czci.config_hdr_id
AND asoqld.config_revision_num = czci.config_rev_nbr
AND czci.ps_node_name = 'CONTROL MASTER ASLY'
call count cpu elapsed disk query current rows
Parse 1 0.02 0.03 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 3 0.16 0.14 0 16526 0 19
total 5 0.18 0.17 0 16526 0 19
Misses in library cache during parse: 1
Optimizer goal: ALL_ROWS
Parsing user id: 173 (APPS)
Rows Row Source Operation
3 TABLE ACCESS BY INDEX ROWID CZ_LOCALIZED_TEXTS (cr=7874 pr=0 pw=0 time=51192 us)
40 NESTED LOOPS (cr=7871 pr=0 pw=0 time=50953 us)
3 NESTED LOOPS (cr=7860 pr=0 pw=0 time=50729 us)
3 TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=6638 pr=0 pw=0 time=33183 us)
3 INDEX RANGE SCAN CZ_CONFIG_ITEMS_N1 (cr=6635 pr=0 pw=0 time=33060 us)(object id 31734)
3 TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=6536 pr=0 pw=0 time=22873 us)
1292 INDEX UNIQUE SCAN CZ_CONFIG_ITEMS_PK (cr=5244 pr=0 pw=0 time=15326 us)(object id 3049621)
3 TABLE ACCESS BY INDEX ROWID CZ_PS_NODES (cr=1222 pr=0 pw=0 time=17483 us)
3 INDEX RANGE SCAN CZ_PS_NODES_N12 (cr=1219 pr=0 pw=0 time=17411 us)(object id 750095)
1 SORT AGGREGATE (cr=1211 pr=0 pw=0 time=17266 us)
209 TABLE ACCESS FULL CZ_DEVL_PROJECTS (cr=1211 pr=0 pw=0 time=16844 us)
18 INDEX RANGE SCAN CZ_LOCALIZED_TEXTS_N1 (cr=11 pr=0 pw=0 time=122 us)(object id 31504)
3 NESTED LOOPS (cr=7874 pr=0 pw=0 time=48203 us)
3 NESTED LOOPS (cr=7860 pr=0 pw=0 time=47973 us)
3 TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=6638 pr=0 pw=0 time=30352 us)
3 INDEX RANGE SCAN CZ_CONFIG_ITEMS_N1 (cr=6635 pr=0 pw=0 time=30218 us)(object id 31734)
3 TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=6536 pr=0 pw=0 time=20960 us)
1292 INDEX UNIQUE SCAN CZ_CONFIG_ITEMS_PK (cr=5244 pr=0 pw=0 time=14224 us)(object id 3049621)
3 TABLE ACCESS BY INDEX ROWID CZ_PS_NODES (cr=1222 pr=0 pw=0 time=17570 us)
3 INDEX RANGE SCAN CZ_PS_NODES_N12 (cr=1219 pr=0 pw=0 time=17510 us)(object id 750095)
1 SORT AGGREGATE (cr=1211 pr=0 pw=0 time=17395 us)
209 TABLE ACCESS FULL CZ_DEVL_PROJECTS (cr=1211 pr=0 pw=0 time=16937 us)
3 TABLE ACCESS BY INDEX ROWID CZ_LOCALIZED_TEXTS (cr=14 pr=0 pw=0 time=165 us)
3 INDEX UNIQUE SCAN CZ_LOCALIZED_TEXTS_PK (cr=11 pr=0 pw=0 time=132 us)(object id 3050530)
19 TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=778 pr=0 pw=0 time=41677 us)
5816 NESTED LOOPS (cr=202 pr=0 pw=0 time=16173 us)
21 NESTED LOOPS (cr=96 pr=0 pw=0 time=3617 us)
23 TABLE ACCESS BY INDEX ROWID ASO_QUOTE_LINES_ALL (cr=47 pr=0 pw=0 time=2528 us)
1058 INDEX RANGE SCAN ASO_QUOTE_LINES_ALL_N1 (cr=9 pr=0 pw=0 time=83 us)(object id 81688)
21 TABLE ACCESS BY INDEX ROWID ASO_QUOTE_LINE_DETAILS (cr=49 pr=0 pw=0 time=1053 us)
21 INDEX RANGE SCAN ASO_QUOTE_LINE_DETAILS_N1 (cr=28 pr=0 pw=0 time=598 us)(object id 81706)
5794 INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=106 pr=0 pw=0 time=8245 us)(object id 3049621) -
How to reduce the length of lines in Smartform windows
Hi,
In smartform Mainwindow or any window, how to draw the vertical lines and horizontal lines and how to reduce the lengths...very urgent please explain.
Thanks and Regards,
suryaHi Surya,
You should use templates for this purpose.
and if you are in table then you can not use templates. Here you should go for the line type.
and in either case there will be pattern tab in the right side bottom.
if double click on the teplate it will get display.
click on the select pattern and select the required format and give the line width
ex 15 TW
I think this will help you
Maybe you are looking for
-
Using so_new_document_send_api1 ?
hi there, i am using FM so_new_document_send_api1 for sending emails from z-abap. is there any possibility that i can send the email IMMEDIATELY ? now it is getting into the queue (in SCOT). there we have a job running every 5 minutes which sends th
-
I have had this printer for about six months. It will not print a test page but will print a demo page. It will not print anything using the black cartridge. I have replaced the cartridges and it still will not print. I have uninstalled the softwa
-
EEM, puts and terminal length
When I run this with "event manager run jb.tcl" with 15.0(1)M2, the "--More--" prompt interrupts the output at different points every time I run it. My terminal length is set to 35. Is there any way to get the "--More--" prompt to work correctly and
-
Any way to stop a PO match when GL account code is disabled?
When we match to a PO, we are finding that sometimes the GL accounts are disabled. Oracle allows the match to proceed. I've been trying to find a setting that would prevent that up front or at least throw a warning if the account string is disabled,
-
How do I get iTunes to move it from my 2nd hard drive into iTunes. It will play through Windows Media Player but can't get it into iTunes!!!! HELP PLEASE !!!!!