AP invoice workbench performance issue.
Hi Guys,
We have a production system with RHEL 5 ,R12 12.0.6 and DB:10.2.0.4
WE are facing Performance issue in Inovoice workbench were users when click on Inovoice batches or Inovoices it takes a lot of time to open the invoice form.
Also Validation of inovoices consumes a lot of time which is unaccepted .
Request you please give some pointers or note id to followd already have locked an SR with oracle .
This is urgent
Regards,
Milan
Please see these docs.
R12 Invoice Workbench Form Has A Performance Issue [ID 1072338.1]
Bad Performance When Checking Funds In Invoice Workbench [ID 1091280.1]
Bad Performance In Invoice Workbench (APXINWKB) Find Window When Searching By Purchase Order [ID 1195623.1]
R12 AP Invoice Workbench Performance Issues [ID 957105.1]
Poor Performance On Invoice Validation In The Invoice Workbench [ID 1130313.1]
Invoice Workbench> Actions: Pay in Full Performance Issue [ID 983804.1]
Invoice Workbench (APXINWKB) Performance Issue While Selecting The Self Assessment Check Box [ID 1210340.1
Performance of Project Expenditure LOV At AP Invoice Header in Invoice Workbench [ID 1143943.1]
R12.1.1 Performance Problem in AP Invoice Workbench [ID 861205.1]
R12 Invoice Performance FAQs [ID 579737.1]
Thanks,
Hussein
Similar Messages
-
APXPAWKB form has performance issues
Hi All,
Am running Oracle EBS release 12.0.4 running on HP-UX Itanium 11i.
Of late, whenever users try and pay an invoice,using the APXPAWKB, it either takes ages to save that
single transaction or the form completely hangs.
I tried re-generating the form but to no help.
Kindly assist as its end month so salaries cant be paid.
Thanks in advance.
Rajab.Hi;
Am running Oracle EBS release 12.0.4 running on HP-UX Itanium 11i.
Of late, whenever users try and pay an invoice,using the APXPAWKB, it either takes ages to save that
single transaction or the form completely hangs.Wiht hang you mean? You get any error or screen froze?
Please follow below and see its helpful:
AUTOSELECT PERFORMANCE ISSUE IN RELEASE 11 [ID 1070374.6]
R12: Application Hangs when Finding Invoices in Enter/Adjust Invoices [ID 749757.1]
PMT:PAYMENT BATCH HANGS IN PENDING, STANDBY STATUS WHEN TRYING TO CONFIRM [ID 1017339.102]
CONFIRM PAYMENT BATCH HANGS [ID 1051730.6]
R12: Void Payment With Invoice Workbench Open Causes Application Hang [ID 436529.1]
Regard
Helios -
Performance issue in DB need help with analysing this ADDM report
Hi,
My environment:
Os: RHEL5U3 / 11.1.0.7 64 bit / R12.1.1 64 bit
Issue:
Few days are am facing serious of performance problem in our Production instance. Normally the issue will occur 5 to 10 minutes occasionally per day. At the time of issue we not able to access the EBS application its taking time to load. But backend all the oracle, listener and apps services are up and running. No locks at table and session level. Cpu and memory usage is normal.
We have monitored using "Enterprise Manager" for this issue and we found the wait session present more in Active session tab. At this time EBS application is not able access its loading too time. After some time the in Active session tab the wait session came normal and when we try to access the EBS application its working fine.
We try to find the cause of the issue by running addm report. But am not able to understand what its says. Kindly suggests me
ADDM Report for Task 'TASK_42656'
Analysis Period
AWR snapshot range from 14754 to 14755.
Time period starts at 17-APR-12 11.00.22 AM
Time period ends at 17-APR-12 12.00.33 PM
Analysis Target
Database 'PRD' with DB ID 1789440879.
Database version 11.1.0.7.0.
ADDM performed an analysis of instance PRD, numbered 1 and hosted at
advgrpdb.advgroup.ae.
Activity During the Analysis Period
Total database time was 18674 seconds.
The average number of active sessions was 5.17.
Summary of Findings
Description Active Sessions Recommendations
Percent of Activity
1 Top SQL by DB Time 3.43 | 66.33 5
2 Buffer Busy 2.52 | 48.81 5
3 Buffer Busy 1.39 | 26.81 2
4 Log File Switches .91 | 17.56 1
5 Buffer Busy .56 | 10.87 2
6 Undersized SGA .38 | 7.37 1
7 Commits and Rollbacks .28 | 5.42 1
8 Undo I/O .18 | 3.53 0
9 CPU Usage .13 | 2.57 1
10 Top SQL By I/O .11 | 2.21 1
Findings and Recommendations
Finding 1: Top SQL by DB Time
Impact is 3.43 active sessions, 66.33% of total activity.
SQL statements consuming significant database time were found.
Recommendation 1: SQL Tuning
Estimated benefit is 1.59 active sessions, 30.8% of total activity.
Action
Investigate the SQL statement with SQL_ID "a49xsqhv0h31b" for possible
performance improvements.
Related Object
SQL statement with SQL_ID a49xsqhv0h31b.
SELECT R.Conc_Login_Id, R.Request_Id, R.Phase_Code, R.Status_Code,
P.Application_ID, P.Concurrent_Program_ID, P.Concurrent_Program_Name,
R.Enable_Trace, R.Restart, DECODE(R.Increment_Dates, 'Y', 'Y', 'N'),
R.NLS_Compliant, R.OUTPUT_FILE_TYPE, E.Executable_Name,
E.Execution_File_Name, A2.Basepath, DECODE(R.Stale, 'Y', 'C',
P.Execution_Method_Code), P.Print_Flag, P.Execution_Options,
DECODE(P.Srs_Flag, 'Y', 'Y', 'Q', 'Y', 'N'), P.Argument_Method_Code,
R.Print_Style, R.Argument_Input_Method_Code, R.Queue_Method_Code,
R.Responsibility_ID, R.Responsibility_Application_ID, R.Requested_By,
R.Number_Of_Copies, R.Save_Output_Flag, R.Printer, R.Print_Group,
R.Priority, U.User_Name, O.Oracle_Username,
O.Encrypted_Oracle_Password, R.Cd_Id, A.Basepath,
A.Application_Short_Name, TO_CHAR(R.Requested_Start_Date,'YYYY/MM/DD
HH24:MI:SS'), R.Nls_Language, R.Nls_Territory,
R.Nls_Numeric_Characters, DECODE(R.Parent_Request_ID, NULL, 0,
R.Parent_Request_ID), R.Priority_Request_ID, R.Single_Thread_Flag,
R.Has_Sub_Request, R.Is_Sub_Request, R.Req_Information,
R.Description, R.Resubmit_Time, TO_CHAR(R.Resubmit_Interval),
R.Resubmit_Interval_Type_Code, R.Resubmit_Interval_Unit_Code,
TO_CHAR(R.Resubmit_End_Date,'YYYY/MM/DD HH24:MI:SS'),
Decode(E.Execution_File_Name, NULL, 'N', Decode(E.Subroutine_Name,
NULL, Decode(E.Execution_Method_Code, 'I', 'Y', 'J', 'Y', 'N'),
'Y')), R.Argument1, R.Argument2, R.Argument3, R.Argument4,
R.Argument5, R.Argument6, R.Argument7, R.Argument8, R.Argument9,
R.Argument10, R.Argument11, R.Argument12, R.Argument13, R.Argument14,
R.Argument15, R.Argument16, R.Argument17, R.Argument18, R.Argument19,
R.Argument20, R.Argument21, R.Argument22, R.Argument23, R.Argument24,
R.Argument25, X.Argument26, X.Argument27, X.Argument28, X.Argument29,
X.Argument30, X.Argument31, X.Argument32, X.Argument33, X.Argument34,
X.Argument35, X.Argument36, X.Argument37, X.Argument38, X.Argument39,
X.Argument40, X.Argument41, X.Argument42, X.Argument43, X.Argument44,
X.Argument45, X.Argument46, X.Argument47, X.Argument48, X.Argument49,
X.Argument50, X.Argument51, X.Argument52, X.Argument53, X.Argument54,
X.Argument55, X.Argument56, X.Argument57, X.Argument58, X.Argument59,
X.Argument60, X.Argument61, X.Argument62, X.Argument63, X.Argument64,
X.Argument65, X.Argument66, X.Argument67, X.Argument68, X.Argument69,
X.Argument70, X.Argument71, X.Argument72, X.Argument73, X.Argument74,
X.Argument75, X.Argument76, X.Argument77, X.Argument78, X.Argument79,
X.Argument80, X.Argument81, X.Argument82, X.Argument83, X.Argument84,
X.Argument85, X.Argument86, X.Argument87, X.Argument88, X.Argument89,
X.Argument90, X.Argument91, X.Argument92, X.Argument93, X.Argument94,
X.Argument95, X.Argument96, X.Argument97, X.Argument98, X.Argument99,
X.Argument100, R.number_of_arguments, C.CD_Name,
NVL(R.Security_Group_ID, 0), NVL(R.org_id, 0) FROM
fnd_concurrent_requests R, fnd_concurrent_programs P, fnd_application
A, fnd_user U, fnd_oracle_userid O, fnd_conflicts_domain C,
fnd_concurrent_queues Q, fnd_application A2, fnd_executables E,
fnd_conc_request_arguments X WHERE R.Status_code = 'I' And
((R.OPS_INSTANCE is null) or (R.OPS_INSTANCE = -1) or
(R.OPS_INSTANCE =
decode(:dcp_on,1,FND_CONC_GLOBAL.OPS_INST_NUM,R.OPS_INSTANCE))) And
R.Request_ID = X.Request_ID(+) And R.Program_Application_Id =
P.Application_Id(+) And R.Concurrent_Program_Id =
P.Concurrent_Program_Id(+) And R.Program_Application_Id =
A.Application_Id(+) And P.Executable_Application_Id =
E.Application_Id(+) And P.Executable_Id =
E.Executable_Id(+) And P.Executable_Application_Id =
A2.Application_Id(+) And R.Requested_By = U.User_Id(+) And R.Cd_Id
= C.Cd_Id(+) And R.Oracle_Id = O.Oracle_Id(+) And Q.Application_Id =
:q_applid And Q.Concurrent_Queue_Id = :queue_id And (P.Enabled_Flag
is NULL OR P.Enabled_Flag = 'Y') And R.Hold_Flag = 'N' And
R.Requested_Start_Date <= Sysdate And ( R.Enforce_Seriality_Flag =
'N' OR ( C.RunAlone_Flag = P.Run_Alone_Flag And (P.Run_Alone_Flag =
'N' OR Not Exists (Select Null From Fnd_Concurrent_Requests Sr
Where Sr.Status_Code In ('R', 'T') And Sr.Enforce_Seriality_Flag =
'Y' And Sr.CD_id = C.CD_Id)))) And Q.Running_Processes <=
Q.Max_Processes And R.Rowid = :reqname And
((P.Execution_Method_Code != 'S' OR
(R.PROGRAM_APPLICATION_ID,R.CONCURRENT_PROGRAM_ID) IN
((0,98),(0,100),(0,31721),(0,31722),(0,31757))) AND
((R.PROGRAM_APPLICATION_ID,R.CONCURRENT_PROGRAM_ID) NOT IN
((510,40112),(510,40113),(510,41497),(510,41498),(530,41859),(530,418
60),(535,41492),(535,41493),(535,41494)))) FOR UPDATE OF
R.status_code NoWait
Rationale
SQL statement with SQL_ID "a49xsqhv0h31b" was executed 4686 times and
had an average elapsed time of 1.2 seconds.
Rationale
Waiting for event "buffer busy waits" in wait class "Concurrency"
accounted for 85% of the database time spent in processing the SQL
statement with SQL_ID "a49xsqhv0h31b".
Rationale
Waiting for event "log file switch (checkpoint incomplete)" in wait
class "Configuration" accounted for 9% of the database time spent in
processing the SQL statement with SQL_ID "a49xsqhv0h31b".
Recommendation 3: SQL Tuning
Estimated benefit is .56 active sessions, 10.91% of total activity.
Action
Investigate the SQL statement with SQL_ID "5d7957yktf3nn" for possible
performance improvements.
Related Object
SQL statement with SQL_ID 5d7957yktf3nn.
UPDATE ICX_SESSIONS SET TIME_OUT = :B2 WHERE SESSION_ID = :B1
Rationale
SQL statement with SQL_ID "5d7957yktf3nn" was executed 266 times and had
an average elapsed time of 7.6 seconds.
Rationale
Waiting for event "buffer busy waits" in wait class "Concurrency"
accounted for 86% of the database time spent in processing the SQL
statement with SQL_ID "5d7957yktf3nn".
Rationale
Waiting for event "log file switch (checkpoint incomplete)" in wait
class "Configuration" accounted for 7% of the database time spent in
processing the SQL statement with SQL_ID "5d7957yktf3nn".
Finding 2: Buffer Busy
Impact is 2.52 active sessions, 48.81% of total activity.
Read and write contention on database blocks was consuming significant
database time.
Recommendation 1: Application Analysis
Estimated benefit is 1.42 active sessions, 27.44% of total activity.
Action
Trace the cause of object contention due to SELECT statements in the
application using the information provided.
Related Object
Database object with ID 34562.
Rationale
The SELECT statement with SQL_ID "a49xsqhv0h31b" was significantly
affected by "buffer busy" waits.
Related Object
SQL statement with SQL_ID a49xsqhv0h31b.
SELECT R.Conc_Login_Id, R.Request_Id, R.Phase_Code, R.Status_Code,
P.Application_ID, P.Concurrent_Program_ID, P.Concurrent_Program_Name,
R.Enable_Trace, R.Restart, DECODE(R.Increment_Dates, 'Y', 'Y', 'N'),
R.NLS_Compliant, R.OUTPUT_FILE_TYPE, E.Executable_Name,
E.Execution_File_Name, A2.Basepath, DECODE(R.Stale, 'Y', 'C',
P.Execution_Method_Code), P.Print_Flag, P.Execution_Options,
DECODE(P.Srs_Flag, 'Y', 'Y', 'Q', 'Y', 'N'), P.Argument_Method_Code,
R.Print_Style, R.Argument_Input_Method_Code, R.Queue_Method_Code,
R.Responsibility_ID, R.Responsibility_Application_ID, R.Requested_By,
R.Number_Of_Copies, R.Save_Output_Flag, R.Printer, R.Print_Group,
R.Priority, U.User_Name, O.Oracle_Username,
O.Encrypted_Oracle_Password, R.Cd_Id, A.Basepath,
A.Application_Short_Name, TO_CHAR(R.Requested_Start_Date,'YYYY/MM/DD
HH24:MI:SS'), R.Nls_Language, R.Nls_Territory,
R.Nls_Numeric_Characters, DECODE(R.Parent_Request_ID, NULL, 0,
R.Parent_Request_ID), R.Priority_Request_ID, R.Single_Thread_Flag,
R.Has_Sub_Request, R.Is_Sub_Request, R.Req_Information,
R.Description, R.Resubmit_Time, TO_CHAR(R.Resubmit_Interval),
R.Resubmit_Interval_Type_Code, R.Resubmit_Interval_Unit_Code,
TO_CHAR(R.Resubmit_End_Date,'YYYY/MM/DD HH24:MI:SS'),
Decode(E.Execution_File_Name, NULL, 'N', Decode(E.Subroutine_Name,
NULL, Decode(E.Execution_Method_Code, 'I', 'Y', 'J', 'Y', 'N'),
'Y')), R.Argument1, R.Argument2, R.Argument3, R.Argument4,
R.Argument5, R.Argument6, R.Argument7, R.Argument8, R.Argument9,
R.Argument10, R.Argument11, R.Argument12, R.Argument13, R.Argument14,
R.Argument15, R.Argument16, R.Argument17, R.Argument18, R.Argument19,
R.Argument20, R.Argument21, R.Argument22, R.Argument23, R.Argument24,
R.Argument25, X.Argument26, X.Argument27, X.Argument28, X.Argument29,
X.Argument30, X.Argument31, X.Argument32, X.Argument33, X.Argument34,
X.Argument35, X.Argument36, X.Argument37, X.Argument38, X.Argument39,
X.Argument40, X.Argument41, X.Argument42, X.Argument43, X.Argument44,
X.Argument45, X.Argument46, X.Argument47, X.Argument48, X.Argument49,
X.Argument50, X.Argument51, X.Argument52, X.Argument53, X.Argument54,
X.Argument55, X.Argument56, X.Argument57, X.Argument58, X.Argument59,
X.Argument60, X.Argument61, X.Argument62, X.Argument63, X.Argument64,
X.Argument65, X.Argument66, X.Argument67, X.Argument68, X.Argument69,
X.Argument70, X.Argument71, X.Argument72, X.Argument73, X.Argument74,
X.Argument75, X.Argument76, X.Argument77, X.Argument78, X.Argument79,
X.Argument80, X.Argument81, X.Argument82, X.Argument83, X.Argument84,
X.Argument85, X.Argument86, X.Argument87, X.Argument88, X.Argument89,
X.Argument90, X.Argument91, X.Argument92, X.Argument93, X.Argument94,
X.Argument95, X.Argument96, X.Argument97, X.Argument98, X.Argument99,
X.Argument100, R.number_of_arguments, C.CD_Name,
NVL(R.Security_Group_ID, 0), NVL(R.org_id, 0) FROM
fnd_concurrent_requests R, fnd_concurrent_programs P, fnd_application
A, fnd_user U, fnd_oracle_userid O, fnd_conflicts_domain C,
fnd_concurrent_queues Q, fnd_application A2, fnd_executables E,
fnd_conc_request_arguments X WHERE R.Status_code = 'I' And
((R.OPS_INSTANCE is null) or (R.OPS_INSTANCE = -1) or
(R.OPS_INSTANCE =
decode(:dcp_on,1,FND_CONC_GLOBAL.OPS_INST_NUM,R.OPS_INSTANCE))) And
R.Request_ID = X.Request_ID(+) And R.Program_Application_Id =
P.Application_Id(+) And R.Concurrent_Program_Id =
P.Concurrent_Program_Id(+) And R.Program_Application_Id =
A.Application_Id(+) And P.Executable_Application_Id =
E.Application_Id(+) And P.Executable_Id =
E.Executable_Id(+) And P.Executable_Application_Id =
A2.Application_Id(+) And R.Requested_By = U.User_Id(+) And R.Cd_Id
= C.Cd_Id(+) And R.Oracle_Id = O.Oracle_Id(+) And Q.Application_Id =
:q_applid And Q.Concurrent_Queue_Id = :queue_id And (P.Enabled_Flag
is NULL OR P.Enabled_Flag = 'Y') And R.Hold_Flag = 'N' And
R.Requested_Start_Date <= Sysdate And ( R.Enforce_Seriality_Flag =
'N' OR ( C.RunAlone_Flag = P.Run_Alone_Flag And (P.Run_Alone_Flag =
'N' OR Not Exists (Select Null From Fnd_Concurrent_Requests Sr
Where Sr.Status_Code In ('R', 'T') And Sr.Enforce_Seriality_Flag =
'Y' And Sr.CD_id = C.CD_Id)))) And Q.Running_Processes <=
Q.Max_Processes And R.Rowid = :reqname And
((P.Execution_Method_Code != 'S' OR
(R.PROGRAM_APPLICATION_ID,R.CONCURRENT_PROGRAM_ID) IN
((0,98),(0,100),(0,31721),(0,31722),(0,31757))) AND
((R.PROGRAM_APPLICATION_ID,R.CONCURRENT_PROGRAM_ID) NOT IN
((510,40112),(510,40113),(510,41497),(510,41498),(530,41859),(530,418
60),(535,41492),(535,41493),(535,41494)))) FOR UPDATE OF
R.status_code NoWait
UPDATE ICX_SESSIONS SET LAST_CONNECT = SYSDATE WHERE SESSION_ID = :B1
Recommendation 1: Schema Changes
Estimated benefit is .03 active sessions, .62% of total activity.
Action
Consider rebuilding the TABLE "APPLSYS.FND_LOGIN_RESP_FORMS" with object
ID 34651 using a higher value for PCTFREE.
Related Object
Database object with ID 34651.
Rationale
The UPDATE statement with SQL_ID "cqc5crhxxt36t" was significantly
affected by "buffer busy" waits.
Related Object
SQL statement with SQL_ID cqc5crhxxt36t.
UPDATE FND_LOGIN_RESP_FORMS FLRF SET END_TIME = SYSDATE WHERE
FLRF.LOGIN_ID = :B2 AND FLRF.LOGIN_RESP_ID = :B1 AND FLRF.END_TIME IS
NULL AND (FLRF.FORM_ID, FLRF.FORM_APPL_ID) = (SELECT F.FORM_ID,
F.APPLICATION_ID FROM FND_FORM F, FND_APPLICATION A WHERE F.FORM_NAME
= :B4 AND F.APPLICATION_ID = A.APPLICATION_ID AND
A.APPLICATION_SHORT_NAME = :B3 )
Symptoms That Led to the Finding:
Wait class "Concurrency" was consuming significant database time.
Impact is 2.53 active sessions, 48.87% of total activity.
Finding 4: Log File Switches
Impact is .91 active sessions, 17.56% of total activity.
Log file switch operations were consuming significant database time while
waiting for checkpoint completion.
This problem can be caused by use of hot backup mode on tablespaces. DML to
tablespaces in hot backup mode causes generation of additional redo.
Recommendation 1: Database Configuration
Estimated benefit is .91 active sessions, 17.56% of total activity.
Action
Verify whether incremental shipping was used for standby databases.
Symptoms That Led to the Finding:
Wait class "Configuration" was consuming significant database time.
Impact is .91 active sessions, 17.63% of total activity.
Finding 5: Buffer Busy
Impact is .56 active sessions, 10.87% of total activity.
A hot data block with concurrent read and write activity was found. The block
belongs to segment "ICX.ICX_SESSIONS" and is block 243489 in file 36.
Recommendation 1: Application Analysis
Estimated benefit is .56 active sessions, 10.87% of total activity.
Action
Investigate application logic to find the cause of high concurrent read
and write activity to the data present in this block.
Related Object
Database block with object number 37562, file number 36 and block
number 243489.
Rationale
The SQL statement with SQL_ID "5d7957yktf3nn" spent significant time on
"buffer busy" waits for the hot block.
Related Object
SQL statement with SQL_ID 5d7957yktf3nn.
UPDATE ICX_SESSIONS SET TIME_OUT = :B2 WHERE SESSION_ID = :B1
Rationale
The SQL statement with SQL_ID "326up1aym56dd" spent significant time on
"buffer busy" waits for the hot block.
Related Object
SQL statement with SQL_ID 326up1aym56dd.
UPDATE ICX_SESSIONS SET LAST_CONNECT = SYSDATE WHERE SESSION_ID = :B1
Recommendation 2: Schema Changes
Estimated benefit is .56 active sessions, 10.87% of total activity.
Action
Consider rebuilding the TABLE "ICX.ICX_SESSIONS" with object ID 37562
using a higher value for PCTFREE.
Related Object
Database object with ID 37562.
Symptoms That Led to the Finding:
Wait class "Concurrency" was consuming significant database time.
Impact is 2.53 active sessions, 48.87% of total activity.
Finding 6: Undersized SGA
Impact is .38 active sessions, 7.37% of total activity.
The SGA was inadequately sized, causing additional I/O or hard parses.
The value of parameter "sga_target" was "4096 M" during the analysis period.
Recommendation 1: Database Configuration
Estimated benefit is .12 active sessions, 2.33% of total activity.
Action
Increase the size of the SGA by setting the parameter "sga_target" to
4608 M.
Symptoms That Led to the Finding:
Wait class "User I/O" was consuming significant database time.
Impact is .7 active sessions, 13.57% of total activity.
Hard parsing of SQL statements was consuming significant database time.
Impact is .13 active sessions, 2.51% of total activity.
Contention for latches related to the shared pool was consuming
significant database time.
Impact is 0 active sessions, .03% of total activity.
Wait class "Concurrency" was consuming significant database time.
Impact is 2.53 active sessions, 48.87% of total activity.
Finding 7: Commits and Rollbacks
Impact is .28 active sessions, 5.42% of total activity.
Waits on event "log file sync" while performing COMMIT and ROLLBACK operations
were consuming significant database time.
Recommendation 1: Host Configuration
Estimated benefit is .28 active sessions, 5.42% of total activity.
Action
Investigate the possibility of improving the performance of I/O to the
online redo log files.
Rationale
The average size of writes to the online redo log files was 163 K and
the average time per write was 68 milliseconds.
Symptoms That Led to the Finding:
Wait class "Commit" was consuming significant database time.
Impact is .28 active sessions, 5.42% of total activity.
Finding 8: Undo I/O
Impact is .18 active sessions, 3.53% of total activity.
Undo I/O was a significant portion (26%) of the total database I/O.
No recommendations are available.
Symptoms That Led to the Finding:
The throughput of the I/O subsystem was significantly lower than
expected.
Impact is .08 active sessions, 1.46% of total activity.
Wait class "User I/O" was consuming significant database time.
Impact is .7 active sessions, 13.57% of total activity.
Finding 9: CPU Usage
Impact is .13 active sessions, 2.57% of total activity.
Time spent on the CPU by the instance was responsible for a substantial part
of database time.
Recommendation 1: SQL Tuning
Estimated benefit is .13 active sessions, 2.57% of total activity.
Finding 10: Top SQL By I/O
Impact is .11 active sessions, 2.21% of total activity.
Individual SQL statements responsible for significant user I/O wait were
found.
Recommendation 1: SQL Tuning
Estimated benefit is .11 active sessions, 2.22% of total activity.
Action
Run SQL Tuning Advisor on the SQL statement with SQL_ID "b3pnc5yctv2z5".
Related Object
SQL statement with SQL_ID b3pnc5yctv2z5.
INSERT INTO ZX_TRANSACTION_LINES_GT( APPLICATION_ID ,ENTITY_CODE
,EVENT_CLASS_CODE ,TRX_ID ,TRX_LEVEL_TYPE ,TRX_LINE_ID ,LINE_CLASS
,LINE_LEVEL_ACTION ,TRX_LINE_TYPE ,TRX_LINE_DATE
,LINE_AMT_INCLUDES_TAX_FLAG ,LINE_AMT ,TRX_LINE_QUANTITY ,UNIT_PRICE
,PRODUCT_ID ,PRODUCT_ORG_ID ,UOM_CODE ,PRODUCT_CODE ,SHIP_TO_PARTY_ID
,SHIP_FROM_PARTY_ID ,BILL_TO_PARTY_ID ,BILL_FROM_PARTY_ID
,SHIP_FROM_PARTY_SITE_ID ,BILL_FROM_PARTY_SITE_ID
,SHIP_TO_LOCATION_ID ,SHIP_FROM_LOCATION_ID ,BILL_TO_LOCATION_ID
,SHIP_THIRD_PTY_ACCT_ID ,SHIP_THIRD_PTY_ACCT_SITE_ID ,HISTORICAL_FLAG
,TRX_LINE_CURRENCY_CODE ,TRX_LINE_CURRENCY_CONV_DATE
,TRX_LINE_CURRENCY_CONV_RATE ,TRX_LINE_CURRENCY_CONV_TYPE
,TRX_LINE_MAU ,TRX_LINE_PRECISION ,HISTORICAL_TAX_CODE_ID
,TRX_BUSINESS_CATEGORY ,PRODUCT_CATEGORY ,PRODUCT_FISC_CLASSIFICATION
,LINE_INTENDED_USE ,PRODUCT_TYPE ,USER_DEFINED_FISC_CLASS
,ASSESSABLE_VALUE ,INPUT_TAX_CLASSIFICATION_CODE ,ACCOUNT_CCID
,BILL_THIRD_PTY_ACCT_ID ,BILL_THIRD_PTY_ACCT_SITE_ID ,TRX_LINE_NUMBER
,TRX_LINE_DESCRIPTION ,PRODUCT_DESCRIPTION ,USER_UPD_DET_FACTORS_FLAG
,DEFAULTING_ATTRIBUTE1 ) SELECT :B4 ,:B3 ,:B2
,PRL.REQUISITION_HEADER_ID ,:B1 ,PRL.REQUISITION_LINE_ID ,'INVOICE'
,NVL(PRL.TAX_ATTRIBUTE_UPDATE_CODE,'UPDATE') ,'ITEM'
,NVL(PRL.NEED_BY_DATE, SYSDATE) ,'N' ,NVL(PRL.AMOUNT,
PRL.UNIT_PRICE*PRL.QUANTITY) ,PRL.QUANTITY ,PRL.UNIT_PRICE
,PRL.ITEM_ID ,(SELECT FSP.INVENTORY_ORGANIZATION_ID FROM
FINANCIALS_SYSTEM_PARAMS_ALL FSP WHERE FSP.ORG_ID=PRL.ORG_ID)
,(SELECT MUM.UOM_CODE FROM MTL_UNITS_OF_MEASURE MUM WHERE
MUM.UNIT_OF_MEASURE=PRL.UNIT_MEAS_LOOKUP_CODE) ,MSIB.SEGMENT1
,PRL.DESTINATION_ORGANIZATION_ID ,PV.PARTY_ID ,PRH.ORG_ID
,PV.PARTY_ID ,PVS.PARTY_SITE_ID ,PVS.PARTY_SITE_ID
,PRL.DELIVER_TO_LOCATION_ID ,(SELECT HZPS.LOCATION_ID FROM
HZ_PARTY_SITES HZPS WHERE HZPS.PARTY_SITE_ID = PVS.PARTY_SITE_ID)
,(SELECT LOCATION_ID FROM HR_ALL_ORGANIZATION_UNITS WHERE
ORGANIZATION_ID=PRH.ORG_ID) ,PRL.VENDOR_ID ,PRL.VENDOR_SITE_ID ,NULL
,NVL(PRL.CURRENCY_CODE, :B9 ) ,NVL2(PRL.CURRENCY_CODE, PRL.RATE_DATE,
SYSDATE) ,NVL2(PRL.CURRENCY_CODE, PRL.RATE, :B8 )
,NVL2(PRL.CURRENCY_CODE, PRL.RATE_TYPE, :B7 )
,FC.MINIMUM_ACCOUNTABLE_UNIT ,NVL(FC.PRECISION, 2) ,NULL
,DECODE(PRL.TAX_ATTRIBUTE_UPDATE_CODE, 'CREATE',
NVL2(PRL.PARENT_REQ_LINE_ID, ZXLDET.TRX_BUSINESS_CATEGORY, NULL),
NULL ) ,DECODE(PRL.TAX_ATTRIBUTE_UPDATE_CODE, 'CREATE',
NVL2(PRL.PARENT_REQ_LINE_ID, ZXLDET.PRODUCT_CATEGORY, NULL), NULL )
,DECODE(PRL.TAX_ATTRIBUTE_UPDATE_CODE, 'CREATE',
NVL2(PRL.PARENT_REQ_LINE_ID, ZXLDET.PRODUCT_FISC_CLASSIFICATION,
NULL), NULL ) ,DECODE(PRL.TAX_ATTRIBUTE_UPDATE_CODE, 'CREATE',
NVL2(PRL.PARENT_REQ_LINE_ID, ZXLDET.LINE_INTENDED_USE, NULL), NULL )
,DECODE(PRL.TAX_ATTRIBUTE_UPDATE_CODE, 'CREATE',
NVL2(PRL.PARENT_REQ_LINE_ID, ZXLDET.PRODUCT_TYPE, NULL), NULL )
,DECODE(PRL.TAX_ATTRIBUTE_UPDATE_CODE, 'CREATE',
NVL2(PRL.PARENT_REQ_LINE_ID, ZXLDET.USER_DEFINED_FISC_CLASS, NULL),
NULL ) ,DECODE(PRL.TAX_ATTRIBUTE_UPDATE_CODE, 'CREATE',
NVL2(PRL.PARENT_REQ_LINE_ID, ZXLDET.ASSESSABLE_VALUE, NULL), NULL )
,DECODE(:B6 , 'REQIMPORT', PRL.TAX_NAME,
DECODE(PRL.TAX_ATTRIBUTE_UPDATE_CODE, 'CREATE',
NVL2(PRL.PARENT_REQ_LINE_ID, ZXLDET.INPUT_TAX_CLASSIFICATION_CODE,
NULL), NULL ) ) ,NVL((SELECT PRD.CODE_COMBINATION_ID FROM
PO_REQ_DISTRIBUTIONS_ALL PRD WHERE PRD.REQUISITION_LINE_ID =
PRL.REQUISITION_LINE_ID AND ROWNUM = 1), MSIB.EXPENSE_ACCOUNT )
,PV.VENDOR_ID ,PVS.VENDOR_SITE_ID ,PRL.LINE_NUM ,PRL.ITEM_DESCRIPTION
,PRL.ITEM_DESCRIPTION ,(SELECT 'Y' FROM DUAL WHERE :B6 = 'REQIMPORT'
AND PRL.TAX_NAME IS NOT NULL) ,PRL.DESTINATION_ORGANIZATION_ID FROM
PO_REQUISITION_HEADERS_ALL PRH, PO_REQUISITION_LINES_ALL PRL,
ZX_LINES_DET_FACTORS ZXLDET, PO_VENDORS PV, PO_VENDOR_SITES_ALL PVS,
MTL_SYSTEM_ITEMS_B MSIB, FND_CURRENCIES FC WHERE
PRH.REQUISITION_HEADER_ID = :B5 AND PRH.REQUISITION_HEADER_ID =
PRL.REQUISITION_HEADER_ID AND ZXLDET.APPLICATION_ID(+) = :B4 AND
ZXLDET.ENTITY_CODE(+) = :B3 AND ZXLDET.EVENT_CLASS_CODE(+) = :B2 AND
ZXLDET.TRX_LEVEL_TYPE(+) = :B1 AND ZXLDET.TRX_LINE_ID(+) =
PRL.PARENT_REQ_LINE_ID AND PV.VENDOR_ID(+) = PRL.VENDOR_ID AND
PVS.VENDOR_SITE_ID(+) = PRL.VENDOR_SITE_ID AND
MSIB.INVENTORY_ITEM_ID(+) = PRL.ITEM_ID AND MSIB.ORGANIZATION_ID(+) =
PRL.ORG_ID AND FC.CURRENCY_CODE(+) = PRL.CURRENCY_CODE AND
NVL(PRL.MODIFIED_BY_AGENT_FLAG, 'N') = 'N' AND NVL(PRL.CANCEL_FLAG,
'N') = 'N' AND NVL(PRL.CLOSED_CODE, 'OPEN') <> 'FINALLY CLOSED' AND
PRL.LINE_LOCATION_ID IS NULL AND PRL.AT_SOURCING_FLAG IS NULL
Rationale
SQL statement with SQL_ID "b3pnc5yctv2z5" was executed 3 times and had
an average elapsed time of 138 seconds.
Rationale
Average time spent in User I/O wait events per execution was 137
seconds.
Symptoms That Led to the Finding:
Wait class "User I/O" was consuming significant database time.
Impact is .7 active sessions, 13.57% of total activity.
Additional Information
Miscellaneous Information
Wait class "Application" was not consuming significant database time.
Wait class "Network" was not consuming significant database time.
Session connect and disconnect calls were not consuming significant database
time.
The database's maintenance windows were active during 100% of the analysis
period.
Regards
AthishFew days are am facing serious of performance problem in our Production instanceFor production issues, please log a SR.
Was this working before? If yes, any changes been done recently?
Do you have the statistics collected up to date?
Please see these docs.
AutoInvoice Performance Issue When Processing Tax [ID 1059275.1]
R12 : System Hangs When Attempting To Save Blanket Release After Applying Patch 11817843 [ID 1333336.1]
Thanks,
Hussein -
Performance Issue in a ABAP Report
Hi All,
I am facing a big performance issue in a abap program which produce the cash flow details our group of company. This is the logic I used to develop the report. (It is a SAP Script)
- First I am getting the closed customer payment records from the table BSAD ( eg: - Type 'DZ')
- Then I am getting the correcponding invoices from the BSAD using the same BELNR ( eg :- Type <> 'DZ')
- Then checking the GL Entry (BSIS) for the correspongding records which select in the second stage.
- In a Z tabel I am keeping the account list by grouping seperate section ( Eg: - Customer recipts, fixed assets...etc).
I have done the same thing to get the open Item balances also.
Report is correct and running perfectly, but my issue is it's takeing long time to process. Because of this I made this report to run as a background job. But still it is taking such a long time. ( For Eg: - If 1000 records selected from the first stage, it will take about more than onr hour to process, which is not good enough to run in a live environment)
Pls advice me how to improve the preformance of this.Hi Ravi,
I am sorry I had problem in my internet connection yesterday, because of that i couldn't reply u. Here is my code. I don't is there any way to send the code as a attachement since it is a little bit big one. I am going to paste that here any way.
Here zcashflow_matrix is the "Z" table where I am going to keep my account details by grouping.
REPORT ZCASH_FLOW.
INCLUDE <%_LIST>.
* Author Thanura ....... *
TYPES :BEGIN OF ty_voucher1,
kunnr LIKE bseg-kunnr,
dmbtr LIKE bseg-dmbtr,
belnr LIKE bseg-belnr,
hkont LIKE bseg-hkont,
shkzg LIKE bseg-shkzg,
xblnr LIKE bsad-xblnr,
budat LIKE bsad-bldat,
blart LIKE bsad-blart,
bldat LIKE bsad-bldat,
lifnr LIKE bseg-lifnr,
END OF ty_voucher1.
DATA :it_voucher1 TYPE STANDARD TABLE OF ty_voucher1 ,
wa_voucher1 TYPE ty_voucher1.
DATA : it_voucher2 TYPE STANDARD TABLE OF ty_voucher1,
wa_voucher2 TYPE ty_voucher1.
DATA : it_voucher3 TYPE STANDARD TABLE OF ty_voucher1,
wa_voucher3 TYPE ty_voucher1.
Data : w_ITCPO type ITCPO.
Data : w_ITCPP type ITCPP.
DATA : w_Rcptamt LIKE bseg-dmbtr,
w_Netamt LIKE bseg-dmbtr,
w_IntIncomeAmt LIKE bseg-dmbtr,
w_IntIncome LIKE bseg-dmbtr,
w_FixedAmt LIKE bseg-dmbtr,
w_fixedasst LIKE bseg-dmbtr,
w_Sundry LIKE bseg-dmbtr,
w_SundryAmt LIKE bseg-dmbtr,
w_SuppayAmt LIKE bseg-dmbtr,
w_Suppay LIKE bseg-dmbtr,
w_SuppayAmt1 LIKE bseg-dmbtr,
w_Suppay1 LIKE bseg-dmbtr,
w_DutyAmt LIKE bseg-dmbtr,
w_Duty LIKE bseg-dmbtr,
w_SalaryAmt LIKE bseg-dmbtr,
w_Salary LIKE bseg-dmbtr,
w_TaxAmt LIKE bseg-dmbtr,
w_Tax LIKE bseg-dmbtr,
w_TaxAmt1 LIKE bseg-dmbtr,
w_Tax1 LIKE bseg-dmbtr,
w_SellAmt LIKE bseg-dmbtr,
w_Sell LIKE bseg-dmbtr,
w_AdminAmt LIKE bseg-dmbtr,
w_Admin LIKE bseg-dmbtr,
w_loanAmt LIKE bseg-dmbtr,
w_loan LIKE bseg-dmbtr,
w_ManAmt LIKE bseg-dmbtr,
w_Man LIKE bseg-dmbtr,
w_CapitalAmt LIKE bseg-dmbtr,
w_Capital LIKE bseg-dmbtr,
w_GroupAmt LIKE bseg-dmbtr,
w_Group LIKE bseg-dmbtr,
w_IntAmt LIKE bseg-dmbtr,
w_Int LIKE bseg-dmbtr,
w_InterAmt LIKE bseg-dmbtr,
w_Inter LIKE bseg-dmbtr,
w_AdPayAmt LIKE bseg-dmbtr,
w_AdPay LIKE bseg-dmbtr,
w_GTotal LIKE bseg-dmbtr,
W_COMPANYNAME like zcompany-copmname.
DATA : w_ORcptamt LIKE bseg-dmbtr,
w_ONetamt LIKE bseg-dmbtr,
w_OIntIncomeAmt LIKE bseg-dmbtr,
w_OIntIncome LIKE bseg-dmbtr,
w_OFixedAmt LIKE bseg-dmbtr,
w_Ofixedasst LIKE bseg-dmbtr,
w_OSundry LIKE bseg-dmbtr,
w_OSundryAmt LIKE bseg-dmbtr,
w_OSuppayAmt LIKE bseg-dmbtr,
w_OSuppay LIKE bseg-dmbtr,
w_OSuppayAmt1 LIKE bseg-dmbtr,
w_OSuppay1 LIKE bseg-dmbtr,
w_ODutyAmt LIKE bseg-dmbtr,
w_ODuty LIKE bseg-dmbtr,
w_OSalaryAmt LIKE bseg-dmbtr,
w_OSalary LIKE bseg-dmbtr,
w_OTaxAmt LIKE bseg-dmbtr,
w_OTax LIKE bseg-dmbtr,
w_OTaxAmt1 LIKE bseg-dmbtr,
w_OTax1 LIKE bseg-dmbtr,
w_OSellAmt LIKE bseg-dmbtr,
w_OSell LIKE bseg-dmbtr,
w_OAdminAmt LIKE bseg-dmbtr,
w_OAdmin LIKE bseg-dmbtr,
w_OloanAmt LIKE bseg-dmbtr,
w_Oloan LIKE bseg-dmbtr,
w_OManAmt LIKE bseg-dmbtr,
w_OMan LIKE bseg-dmbtr,
w_OCapitalAmt LIKE bseg-dmbtr,
w_OCapital LIKE bseg-dmbtr,
w_OGroupAmt LIKE bseg-dmbtr,
w_OGroup LIKE bseg-dmbtr,
w_OIntAmt LIKE bseg-dmbtr,
w_OInt LIKE bseg-dmbtr,
w_OInterAmt LIKE bseg-dmbtr,
w_OInter LIKE bseg-dmbtr,
w_OAdPayAmt LIKE bseg-dmbtr,
w_OAdPay LIKE bseg-dmbtr.
DATA : w_NNetamt LIKE bseg-dmbtr,
w_NIntIncome LIKE bseg-dmbtr,
w_Nfixedasst LIKE bseg-dmbtr,
w_NSundry LIKE bseg-dmbtr,
w_NSuppay LIKE bseg-dmbtr,
w_NSuppay1 LIKE bseg-dmbtr,
w_NDuty LIKE bseg-dmbtr,
w_NSalary LIKE bseg-dmbtr,
w_NTax LIKE bseg-dmbtr,
w_NTax1 LIKE bseg-dmbtr,
w_NSell LIKE bseg-dmbtr,
w_NAdmin LIKE bseg-dmbtr,
w_Nloan LIKE bseg-dmbtr,
w_NMan LIKE bseg-dmbtr,
w_NCapital LIKE bseg-dmbtr,
w_NGroup LIKE bseg-dmbtr,
w_NInt LIKE bseg-dmbtr,
w_NInter LIKE bseg-dmbtr,
w_NAdPay LIKE bseg-dmbtr.
RANGES : r_bwart FOR bsad-blart.
TABLES: bsad.
* Internal tables Begin with IT_ *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_bukrs LIKE bsad-bukrs OBLIGATORY.
SELECT-OPTIONS: s_bldat FOR bsad-bldat OBLIGATORY.
* SELECT-OPTIONS: s_hkont FOR bsad-hkont .
PARAMETERS: p_gjahr LIKE bkpf-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1 .
* PARAMETERS : w_local TYPE char1 RADIOBUTTON GROUP g1 DEFAULT 'X'. .
* PARAMETERS : w_curr TYPE char1 RADIOBUTTON GROUP g1 .
w_ITCPO-TDNEWID = 'X'.
*w_itcpo-tdgetotf = 'X'.
*opern form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
* APPLICATION = 'TX'
* ARCHIVE_INDEX =
* ARCHIVE_PARAMS =
* DEVICE = 'PRINTER'
* DIALOG = ' '
form = 'ZCASHFLOW_FORM1'
* LANGUAGE = SY-LANGU
OPTIONS = w_ITCPO
* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJECT =
* RAW_DATA_INTERFACE = '*'
* SPONUMIV =
* IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
* RESULT =
* EXCEPTIONS
* CANCELED = 1
* DEVICE = 2
* FORM = 3
* OPTIONS = 4
* UNCLOSED = 5
* MAIL_OPTIONS = 6
* ARCHIVE_ERROR = 7
* INVALID_FAX_NUMBER = 8
* MORE_PARAMS_NEEDED_IN_BATCH = 9
* SPOOL_ERROR = 10
* CODEPAGE = 11
* OTHERS = 12
IF sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM select_data_closed.
PERFORM select_data_open.
* calculate the net figures
w_NNetamt = w_Netamt + w_ONetamt.
w_NIntIncome = w_IntIncome + w_OIntIncome.
*w_NInCompRct = w_InCompRct + w_OInCompRct.
w_NfixedAsst = w_fixedAsst + w_OfixedAsst.
w_NSundry = w_Sundry + w_OSundry.
w_NSuppay = w_Suppay + w_OSuppay.
w_NSuppay1 = w_Suppay1 + w_OSuppay1.
w_NDuty = w_Duty + w_ODuty.
w_NSalary = w_Salary + w_OSalary.
w_NTax = w_Tax + w_OTax.
w_NTax1 = w_Tax1 + w_OTax1.
w_NSell = w_Sell + w_OSell.
w_NAdmin = w_Admin + w_OAdmin.
w_NCapital = w_Capital + w_OCapital.
w_Nloan = w_loan + w_Oloan.
w_NMan = w_Man + w_OMan.
w_NGroup = w_Group + w_OGroup.
w_NInt = w_Int + w_OInt.
w_NInter = w_Inter + w_OInter.
w_NAdPay = w_AdPay + w_OAdPay.
w_GTotal = ( w_NNetamt + w_NIntIncome + w_NfixedAsst + w_NSundry ) - (
w_NSuppay + w_NSuppay1 + w_NDuty + w_NSalary + w_NTax + w_NTax1 +
w_NSell + w_NAdmin + w_NCapital + w_Nloan + w_NMan + w_NGroup + w_NInt +
w_NInter + w_NAdPay ).
* Write the Main Account Balance
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAIN'
function = 'SET'
type = 'BODY'
window = 'MAIN'.
IF sy-subrc <> 0.
** message id sy-msgid type sy-msgty number sy-msgno
** with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_ITCPP-TDNEWID = 'X'.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = w_ITCPP
* RDI_RESULT =
* TABLES
* OTFDATA =
* EXCEPTIONS
* UNOPENED = 1
* BAD_PAGEFORMAT_FOR_PRINT = 2
* SEND_ERROR = 3
* SPOOL_ERROR = 4
* CODEPAGE = 5
* OTHERS = 6
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM select_data_closed.
SELECT SINGLE copmname INTO w_companyname
FROM zcompany
WHERE copcode = p_bukrs.
* Select the receipts
SELECT SUM( dmbtr ) AS dmbtr belnr kunnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher3
FROM bsad
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart = 'DZ'
* AND blart = 'DZ' and shkzg = 'S'
GROUP BY kunnr belnr hkont shkzg xblnr budat blart bldat.
SORT it_voucher3 BY kunnr.
LOOP AT it_voucher3 INTO wa_voucher3.
* Select the invoices
SELECT SUM( dmbtr ) AS dmbtr belnr kunnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher1
FROM bsad
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart <> 'DZ' AND
augbl = wa_voucher3-belnr AND
kunnr = wa_voucher3-kunnr
GROUP BY belnr kunnr hkont shkzg xblnr budat blart bldat.
LOOP AT it_voucher1 INTO wa_voucher1.
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_Rcptamt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_Rcptamt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Netamt = w_Netamt + w_Rcptamt.
continue.
ENDIF.
ELSE.
w_Netamt = w_Netamt + w_Rcptamt.
continue.
ENDIF.
* Interest Income
SELECT SINGLE dmbtr FROM bsis INTO w_IntIncomeAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_IntIncomeAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_IntIncome = w_IntIncome + w_IntIncomeAmt.
continue.
ENDIF.
ELSE.
w_IntIncome = w_IntIncome + w_IntIncomeAmt.
continue.
ENDIF.
* Sale Of fixed Assets
SELECT SINGLE dmbtr FROM bsis INTO w_FixedAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_FixedAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_fixedasst = w_fixedasst + w_FixedAmt.
continue.
ENDIF.
ELSE.
w_fixedasst = w_fixedasst + w_FixedAmt.
continue.
ENDIF.
* Gl Receipts ( Sundry Income)
SELECT SINGLE dmbtr FROM bsis INTO w_SundryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_SundryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Sundry = w_Sundry + w_SundryAmt.
continue.
ENDIF.
ELSE.
w_Sundry = w_Sundry + w_SundryAmt.
continue.
ENDIF.
ENDLOOP.
ENDLOOP.
*Out Flow
r_bwart-sign = 'I'. r_bwart-option = 'EQ'. r_bwart-low = 'KZ'.
APPEND r_bwart TO r_bwart.
r_bwart-sign = 'I'. r_bwart-option = 'EQ'. r_bwart-low = 'VZ'.
APPEND r_bwart TO r_bwart.
SELECT SUM( dmbtr ) AS dmbtr belnr lifnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher3
FROM bsak
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart IN r_bwart
* AND blart = 'DZ' and shkzg = 'S'
GROUP BY lifnr belnr hkont shkzg xblnr budat blart bldat.
SORT it_voucher3 BY lifnr.
LOOP AT it_voucher3 INTO wa_voucher3.
* Select the invoices
SELECT SUM( dmbtr ) AS dmbtr belnr lifnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher1
FROM bsak
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart NOT IN r_bwart AND
augbl = wa_voucher3-belnr AND
lifnr = wa_voucher3-lifnr
GROUP BY belnr lifnr hkont shkzg xblnr budat blart bldat.
LOOP AT it_voucher1 INTO wa_voucher1.
* Supplier Payments (LOCAL)
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_SupPayAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_SupPayAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_SupPay = w_SupPay + w_SupPayAmt.
continue.
ENDIF.
ELSE.
w_SupPay = w_SupPay + w_SupPayAmt.
continue.
ENDIF.
* supplier Payments (Foreign )
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_SupPayAmt1 WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_SupPayAmt1 WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_SupPay1 = w_SupPay1 + w_SupPayAmt1.
continue.
ENDIF.
ELSE.
w_SupPay1 = w_SupPay1 + w_SupPayAmt1.
continue.
ENDIF.
* duty/clearing expenses
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_DutyAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY003' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_DutyAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY003' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Duty = w_Duty + w_DutyAmt.
continue.
ENDIF.
ELSE.
w_Duty = w_Duty + w_DutyAmt.
continue.
ENDIF.
* Salary /EPF/ETF/MSPS/OVERTIME
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_SalaryAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_SalaryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Salary = w_Salary + w_SalaryAmt.
continue.
ENDIF.
ELSE.
w_Salary = w_Salary + w_SalaryAmt.
continue.
ENDIF.
* Income Taxes
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_TaxAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_TaxAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Tax = w_Tax + w_TaxAmt.
continue.
ENDIF.
ELSE.
w_Tax = w_Tax + w_TaxAmt.
continue.
ENDIF.
* other taxes ( VAT: TT:Debit tax )
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_TaxAmt1 WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY006' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_TaxAmt1 WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY006' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Tax1 = w_Tax1 + w_TaxAmt1.
continue.
ENDIF.
ELSE.
w_Tax1 = w_Tax1 + w_TaxAmt1.
continue.
ENDIF.
* Selling & Promotional Costs
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_SellAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY007' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_SellAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY007' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Sell = w_Sell + w_SellAmt.
continue.
ENDIF.
ELSE.
w_Sell = w_Sell + w_SellAmt.
continue.
ENDIF.
* Admistration costs
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_AdminAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY008' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_AdminAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY008' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Admin = w_Admin + w_AdminAmt.
continue.
ENDIF.
ELSE.
w_Admin = w_Admin + w_AdminAmt.
continue.
ENDIF.
* Capital Expenditure
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_CapitalAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY009' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_CapitalAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY009' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Capital = w_Capital + w_CapitalAmt.
continue.
ENDIF.
ELSE.
w_Capital = w_Capital + w_CapitalAmt.
continue.
ENDIF.
* Loan repayments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_LoanAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY010' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_LoanAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY010' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Loan = w_Loan + w_LoanAmt.
continue.
ENDIF.
ELSE.
w_Loan = w_Loan + w_LoanAmt.
continue.
ENDIF.
* maangment fees
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_ManAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY011' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_ManAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY011' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Man = w_Man + w_ManAmt.
continue.
ENDIF.
ELSE.
w_Man = w_Man + w_ManAmt.
continue.
ENDIF.
* Group charges
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_GroupAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY012' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_GroupAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY012' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Group = w_Group + w_GroupAmt.
continue.
ENDIF.
ELSE.
w_Group = w_Group + w_GroupAmt.
continue.
ENDIF.
* Interest Payments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_IntAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY013' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_IntAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY013' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Int = w_Int + w_IntAmt.
continue.
ENDIF.
ELSE.
w_Int = w_Int + w_IntAmt.
continue.
ENDIF.
* Other Intercompany payments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_InterAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY014' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_InterAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY014' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Inter = w_Inter + w_InterAmt.
continue.
ENDIF.
ELSE.
w_Inter = w_Inter + w_InterAmt.
continue.
ENDIF.
* Advacnes/Prepayments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_AdPayAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY015' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_AdPayAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY015' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_AdPay = w_AdPay + w_AdPayAmt.
continue.
ENDIF.
ELSE.
w_AdPay = w_AdPay + w_AdPayAmt.
continue.
ENDIF.
ENDLOOP.
ENDLOOP.
* Open Item Balances
ENDFORM. " Select_Data
FORM select_data_Open.
* SELECT SINGLE copmname INTO w_companyname
* FROM zcompany
* WHERE copcode = p_bukrs.
* Select the receipts
SELECT SUM( dmbtr ) AS dmbtr belnr kunnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher3
FROM bsid
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart = 'DZ'
* AND blart = 'DZ' and shkzg = 'S'
GROUP BY kunnr belnr hkont shkzg xblnr budat blart bldat.
SORT it_voucher3 BY kunnr.
LOOP AT it_voucher3 INTO wa_voucher3.
* Select the invoices
SELECT SUM( dmbtr ) AS dmbtr belnr kunnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher1
FROM bsid
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart <> 'DZ' AND
augbl = wa_voucher3-belnr AND
kunnr = wa_voucher3-kunnr
GROUP BY belnr kunnr hkont shkzg xblnr budat blart bldat.
LOOP AT it_voucher1 INTO wa_voucher1.
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_ORcptamt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_ORcptamt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_ONetamt = w_ONetamt + w_ORcptamt.
continue.
ENDIF.
ELSE.
w_ONetamt = w_ONetamt + w_ORcptamt.
continue.
ENDIF.
* Interest Income
SELECT SINGLE dmbtr FROM bsis INTO w_OIntIncomeAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OIntIncomeAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OIntIncome = w_OIntIncome + w_OIntIncomeAmt.
continue.
ENDIF.
ELSE.
w_OIntIncome = w_OIntIncome + w_OIntIncomeAmt.
continue.
ENDIF.
* Sale Of fixed Assets
SELECT SINGLE dmbtr FROM bsis INTO w_OFixedAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OFixedAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Ofixedasst = w_Ofixedasst + w_OFixedAmt.
continue.
ENDIF.
ELSE.
w_Ofixedasst = w_Ofixedasst + w_OFixedAmt.
continue.
ENDIF.
* Gl Receipts ( Sundry Income)
SELECT SINGLE dmbtr FROM bsis INTO w_OSundryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OSundryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OSundry = w_OSundry + w_OSundryAmt.
continue.
ENDIF.
ELSE.
w_OSundry = w_OSundry + w_OSundryAmt.
continue.
ENDIF.
ENDLOOP.
ENDLOOP.
*Out Flow
Clear r_bwart.
refresh r_bwart.
r_bwart-sign = 'I'. r_bwart-option = 'EQ'. r_bwart-low = 'KZ'.
APPEND r_bwart TO r_bwart.
r_bwart-sign = 'I'. r_bwart-option = 'EQ'. r_bwart-low = 'VZ'.
APPEND r_bwart TO r_bwart.
SELECT SUM( dmbtr ) AS dmbtr belnr lifnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher3
FROM bsik
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart IN r_bwart
* AND blart = 'DZ' and shkzg = 'S'
GROUP BY lifnr belnr hkont shkzg xblnr budat blart bldat.
SORT it_voucher3 BY lifnr.
LOOP AT it_voucher3 INTO wa_voucher3.
* Select the invoices
SELECT SUM( dmbtr ) AS dmbtr belnr lifnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher1
FROM bsik
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart NOT IN r_bwart AND
augbl = wa_voucher3-belnr AND
lifnr = wa_voucher3-lifnr
GROUP BY belnr lifnr hkont shkzg xblnr budat blart bldat.
LOOP AT it_voucher1 INTO wa_voucher1.
* Supplier Payments (LOCAL)
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OSupPayAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OSupPayAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OSupPay = w_OSupPay + w_OSupPayAmt.
continue.
ENDIF.
ELSE.
w_OSupPay = w_OSupPay + w_OSupPayAmt.
continue.
ENDIF.
* supplier Payments (Foreign )
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OSupPayAmt1 WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OSupPayAmt1 WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OSupPay1 = w_OSupPay1 + w_OSupPayAmt1.
continue.
ENDIF.
ELSE.
w_OSupPay1 = w_OSupPay1 + w_OSupPayAmt1.
continue.
ENDIF.
* duty/clearing expenses
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_ODutyAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY003' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_ODutyAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY003' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_ODuty = w_ODuty + w_ODutyAmt.
continue.
ENDIF.
ELSE.
w_ODuty = w_ODuty + w_ODutyAmt.
continue.
ENDIF.
* Salary /EPF/ETF/MSPS/OVERTIME
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OSalaryAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OSalaryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OSalary = w_OSalary + w_OSalaryAmt.
continue.
ENDIF.
ELSE.
w_OSalary = w_OSalary + w_OSalaryAmt.
continue.
ENDIF.
* Income Taxes
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OTaxAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OTaxAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OTax = w_OTax + w_OTaxAmt.
continue.
ENDIF.
ELSE.
w_OTax = w_OTax + w_OTaxAmt.
continue.
ENDIF.
* other taxes ( VAT: TT:Debit tax )
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OTaxAmt1 WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY006' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OTaxAmt1 WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY006' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OTax1 = w_OTax1 + w_OTaxAmt1.
continue.
ENDIF.
ELSE.
w_OTax1 = w_OTax1 + w_OTaxAmt1.
continue.
ENDIF.
* Selling & Promotional Costs
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OSellAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY007' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OSellAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY007' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OSell = w_OSell + w_OSellAmt.
continue.
ENDIF.
ELSE.
w_OSell = w_OSell + w_OSellAmt.
continue.
ENDIF.
* Admistration costs
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OAdminAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY008' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OAdminAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY008' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OAdmin = w_OAdmin + w_OAdminAmt.
continue.
ENDIF.
ELSE.
w_OAdmin = w_OAdmin + w_OAdminAmt.
continue.
ENDIF.
* Capital Expenditure
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OCapitalAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY009' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OCapitalAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY009' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OCapital = w_OCapital + w_OCapitalAmt.
continue.
ENDIF.
ELSE.
w_OCapital = w_OCapital + w_OCapitalAmt.
continue.
ENDIF.
* Loan repayments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OLoanAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY010' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OLoanAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY010' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OLoan = w_OLoan + w_OLoanAmt.
continue.
ENDIF.
ELSE.
w_OLoan = w_OLoan + w_OLoanAmt.
continue.
ENDIF.
* maangment fees
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OManAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY011' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OManAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY011' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OMan = w_OMan + w_OManAmt.
continue.
ENDIF.
ELSE.
w_OMan = w_OMan + w_OManAmt.
continue.
ENDIF.
* Group charges
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OGroupAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY012' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OGroupAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY012' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OGroup = w_OGroup + w_OGroupAmt.
continue.
ENDIF.
ELSE.
w_OGroup = w_OGroup + w_OGroupAmt.
continue.
ENDIF.
* Interest Payments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OIntAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY013' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OIntAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY013' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OInt = w_OInt + w_OIntAmt.
continue.
ENDIF.
ELSE.
w_OInt = w_OInt + w_OIntAmt.
continue.
ENDIF.
* Other Intercompany payments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OInterAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY014' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OInterAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY014' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OInter = w_OInter + w_OInterAmt.
continue.
ENDIF.
ELSE.
w_OInter = w_OInter + w_OInterAmt.
continue.
ENDIF.
* Advacnes/Prepayments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OAdPayAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY015' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OAdPayAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY015' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OAdPay = w_OAdPay + w_OAdPayAmt.
continue.
ENDIF.
ELSE.
w_OAdPay = w_OAdPay + w_OAdPayAmt.
continue.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. " Select_Data -
Hi,
Can you please modify this code, i have performance issue for the following code.
Here: t_po is a final internal table.
select ekkobukrs ekkoebeln ekkolifnr ekkobsart " EKKO
ekkoernam ekkoaedat ekko~memory " EKKO
ekpoebelp ekpoidnlf ekpotxz01 ekpoloekz " EKPO
ekpoeffwr ekpomenge " EKPO
ekknsakto ekknps_psp_pnr " EKKN
ekknzekkn ekknmenge " EKKN
into (t_po-bukrs,t_po-ebeln,t_po-lifnr,t_po-bsart,
t_po-ernam,t_po-aedat,t_po-memory,
t_po-ebelp,t_po-idnlf,t_po-txz01,t_po-loekz,
t_po-effwr,t_po-menge,
t_po-sakto,t_po-ps_psp_pnr,
t_po-zekkn,t_po-menge1)
from ( ekko inner join ekpo
on ekkoebeln eq ekpoebeln )
inner join ekkn
on ekkoebeln eq ekknebeln
and ekpoebelp eq ekknebelp
for all entries in t_pspnr
where ekko~bukrs in s_bukrs and
ekko~lifnr in s_lifnr and
ekko~bsart in s_bsart and
ekko~aedat in s_aedat and
ekko~ernam in s_ernam and
ekpo~idnlf in s_idnlf and
ps_psp_pnr = t_pspnr-pspnr.
append t_po.
clear t_po.
endselect.
Another code:
sort t_po by bukrs idnlf ebeln ebelp.
loop at t_po.
select single post1 psphi into (t_po-post1,t_po-psphi) "Performance issue
from prps
where pspnr = t_po-ps_psp_pnr.
select single pspid into t_po-pspid ""Performance issue
from proj
where pspnr = t_po-psphi.
if t_po-pspid in s_pspid.
do nothing
else.
delete t_po index sy-tabix.
continue.
endif.
Get invoiced amount for a PO line item
select dmbtr shkzg into (ekbe-dmbtr,ekbe-shkzg) ""Performance issue
from ekbe
where ebeln = t_po-ebeln and
ebelp = t_po-ebelp and
vgabe = '2'.
if ekbe-shkzg = 'H'.
ekbe-dmbtr = ekbe-dmbtr * -1.
endif.
t_po-invamt = t_po-invamt + ekbe-dmbtr.
endselect. ""Performance issue
if not t_po-menge eq 0.
t_po-polinamt = t_po-effwr * ( t_po-menge1 / t_po-menge ).
endif.
t_po-amtopen = t_po-polinamt - t_po-invamt.
modify t_po index sy-tabix.
clear: t_po,prps,ekbe,proj.
endloop.HI,
Instead of selecting each fields and putting it in each fileds in internal table, we can select the fields and put it into the internal table which contains the required fields.
Eg.
TYPES: begin of itab,
vorna type vorna,
nachn type nachn,
end of itab.
data: wt_itab type table of itab.
select vorna, nachn into table wt_itab from pa0002 where cond.
This increase the performance because it wont take time to match the each fields given after the table statement.
Regards,
Rani. -
QUERY PERFORMANCE AND DATA LOADING PERFORMANCE ISSUES
WHAT ARE QUERY PERFORMANCE ISSUES WE NEED TO TAKE CARE PLEASE EXPLAIN AND LET ME KNOW T CODES...PLZ URGENT
WHAT ARE DATALOADING PERFORMANCE ISSUES WE NEED TO TAKE CARE PLEASE EXPLAIN AND LET ME KNOW T CODES PLZ URGENT
WILL REWARD FULL POINT S
REGARDS
GURUBW Back end
Some Tips -
1)Identify long-running extraction processes on the source system. Extraction processes are performed by several extraction jobs running on the source system. The run-time of these jobs affects the performance. Use transaction code SM37 Background Processing Job Management to analyze the run-times of these jobs. If the run-time of data collection jobs lasts for several hours, schedule these jobs to run more frequently. This way, less data is written into update tables for each run and extraction performance increases.
2)Identify high run-times for ABAP code, especially for user exits. The quality of any custom ABAP programs used in data extraction affects the extraction performance. Use transaction code SE30 ABAP/4 Run-time Analysis and then run the analysis for the transaction code RSA3 Extractor Checker. The system then records the activities of the extraction program so you can review them to identify time-consuming activities. Eliminate those long-running activities or substitute them with alternative program logic.
3)Identify expensive SQL statements. If database run-time is high for extraction jobs, use transaction code ST05 Performance Trace. On this screen, select ALEREMOTE user and then select SQL trace to record the SQL statements. Identify the time-consuming sections from the results. If the data-selection times are high on a particular SQL statement, index the DataSource tables to increase the performance of selection (see no. 6 below). While using ST05, make sure that no other extraction job is running with ALEREMOTE user.
4)Balance loads by distributing processes onto different servers if possible. If your site uses more than one BW application server, distribute the extraction processes to different servers using transaction code SM59 Maintain RFC Destination. Load balancing is possible only if the extraction program allows the option
5)Set optimum parameters for data-packet size. Packet size affects the number of data requests to the database. Set the data-packet size to optimum values for an efficient data-extraction mechanism. To find the optimum value, start with a packet size in the range of 50,000 to 100,000 and gradually increase it. At some point, you will reach the threshold at which increasing packet size further does not provide any performance increase. To set the packet size, use transaction code SBIW BW IMG Menu on the source system. To set the data load parameters for flat-file uploads, use transaction code RSCUSTV6 in BW.
6)Build indexes on DataSource tables based on selection criteria. Indexing DataSource tables improves the extraction performance, because it reduces the read times of those tables.
7)Execute collection jobs in parallel. Like the Business Content extractors, generic extractors have a number of collection jobs to retrieve relevant data from DataSource tables. Scheduling these collection jobs to run in parallel reduces the total extraction time, and they can be scheduled via transaction code SM37 in the source system.
8). Break up your data selections for InfoPackages and schedule the portions to run in parallel. This parallel upload mechanism sends different portions of the data to BW at the same time, and as a result the total upload time is reduced. You can schedule InfoPackages in the Administrator Workbench.
You can upload data from a data target (InfoCube and ODS) to another data target within the BW system. While uploading, you can schedule more than one InfoPackage with different selection options in each one. For example, fiscal year or fiscal year period can be used as selection options. Avoid using parallel uploads for high volumes of data if hardware resources are constrained. Each InfoPacket uses one background process (if scheduled to run in the background) or dialog process (if scheduled to run online) of the application server, and too many processes could overwhelm a slow server.
9). Building secondary indexes on the tables for the selection fields optimizes these tables for reading, reducing extraction time. If your selection fields are not key fields on the table, primary indexes are not much of a help when accessing data. In this case it is better to create secondary indexes with selection fields on the associated table using ABAP Dictionary to improve better selection performance.
10)Analyze upload times to the PSA and identify long-running uploads. When you extract the data using PSA method, data is written into PSA tables in the BW system. If your data is on the order of tens of millions, consider partitioning these PSA tables for better performance, but pay attention to the partition sizes. Partitioning PSA tables improves data-load performance because it's faster to insert data into smaller database tables. Partitioning also provides increased performance for maintenance of PSA tables for example, you can delete a portion of data faster. You can set the size of each partition in the PSA parameters screen, in transaction code SPRO or RSCUSTV6, so that BW creates a new partition automatically when a threshold value is reached.
11)Debug any routines in the transfer and update rules and eliminate single selects from the routines. Using single selects in custom ABAP routines for selecting data from database tables reduces performance considerably. It is better to use buffers and array operations. When you use buffers or array operations, the system reads data from the database tables and stores it in the memory for manipulation, improving performance. If you do not use buffers or array operations, the whole reading process is performed on the database with many table accesses, and performance deteriorates. Also, extensive use of library transformations in the ABAP code reduces performance; since these transformations are not compiled in advance, they are carried out during run-time.
12)Before uploading a high volume of transaction data into InfoCubes, activate the number-range buffer for dimension IDs. The number-range buffer is a parameter that identifies the number of sequential dimension IDs stored in the memory. If you increase the number range before high-volume data upload, you reduce the number of reads from the dimension tables and hence increase the upload performance. Do not forget to set the number-range values back to their original values after the upload. Use transaction code SNRO to maintain the number range buffer values for InfoCubes.
13)Drop the indexes before uploading high-volume data into InfoCubes. Regenerate them after the upload. Indexes on InfoCubes are optimized for reading data from the InfoCubes. If the indexes exist during the upload, BW reads the indexes and tries to insert the records according to the indexes, resulting in poor upload performance. You can automate the dropping and regeneration of the indexes through InfoPackage scheduling. You can drop indexes in the Manage InfoCube screen in the Administrator Workbench.
14)IDoc (intermediate document) archiving improves the extraction and loading performance and can be applied on both BW and R/3 systems. In addition to IDoc archiving, data archiving is available for InfoCubes and ODS objects.
Hope it Helps
Chetan
@CP.. -
Performance Issue with BSIS(open accounting items)
Hey All,
I am having serious performance issue with a accrual report which gets all open GL items, and need some tips for optimization.
The main issue is that I am accesing large tables like BSIS, BSEG, BSAS etc without proper indexes and that I am dealing with huge amounts of data.
The select itself take a long time and after that as I have so much data overall execution is slow too.
The select which concerns me the most is:
SELECT zuonr hkont gjahr belnr buzei budat blart wrbtr shkzg xblnr waers bukrs
INTO TABLE i_bsis
FROM bsis
WHERE bukrs = '1000'
AND hkont in r_hkont
AND budat <= p_lcdate
AND augdt = 0
AND augbl = space
AND gsber = c_ZRL1
AND gjahr BETWEEN l_gjahr2 AND l_gjahr
AND ( blart = c_re "Invoice
OR blart = c_we "Goods receipt
OR blart = c_zc "Invoice Cancels
OR blart = c_kp ). "Accounting offset
I have seen other related threads, but was not that helpful.
We already have a secondary index on bukrs hkont and budat, and i have checked in ST05 that it does use it. But inspite that it takes more than 15 hrs to complete(maybe because of huge data).
Any Input is highly appreciated.
ThanksThank you Thomas for your inputs:
You said that R_HKONT contains several ranges of account numbers. If these ranges cover a significant
portion of the overall existing account numbers, then there is no really quick access possible via the
BSIS primary key.
Unfortunately R_HKONT contains all account numbers.
As Rob said, your index on HKONT and BUDAT does not help much, since you are selecting "<=" on
BUDAT. No chance of narrowing down that range?
Will look into this.
What about GSBER? Does the value in c_ZRL1 provide a rather small subset of the overall values? Then
an index on BUKRS and GSBER might be helpful.
ZRL1 does provide a decent selection . But I dont know if one more index is a good idea on overall
system performance.
I assume that the four document types are not very selective, so it probably does not pay off to
investigate selecting on BKPF (there is an index involving BLART) and joining BSIS for the additional
information. You still might want to look into it though.
I did try to investigate this option too. Based on other threads related to BSIS and Robs Suggestion in
those threads I tried this:
SELECT bukrs belnr gjahr blart budat
FROM bkpf INTO TABLE bkpf_l
WHERE bukrs = c_pepsico
AND bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z')
AND blart IN ('RE', 'WE', 'ZC', 'KP')
AND gjahr BETWEEN l_gjahr2 AND l_gjahr
AND budat <= p_lcdate.
SELECT zuonr hkont gjahr belnr buzei budat blart wrbtr shkzg xblnr waers bukrs
FROM bsis INTO TABLE i_bsis FOR ALL ENTRIES IN bkpf_l
WHERE bukrs = bkpf_l-bukrs
AND hkont IN r_hkont
AND budat = bkpf_l-budat
AND augdt = 0
AND augbl = space
AND gjahr = bkpf_l-gjahr
AND belnr = bkpf_l-belnr
AND blart = bkpf_l-blart
AND gsber = c_zrl1.
The improves the select on BSIS a lot, but the first select on BKPF kills it. Not sure if this would help
improve performance.
Also I was wondering whether it helps on refreshing the tabe statistics through DB20. The last refresh
was done 7 months back. How frequently should we do this? Will it help? -
Performance issue with Adobe forms
Dear SAP Experts,
We have the following issue/requirement from our client. The client is on SAP ECC 6.0 - production environment.
The client is highlighting performance issue while accessing the adobe forms for HR and FI business process ( both static and interactive ).
Examples are
FI – Invoice Approvals
HR – Job Salary Change
The client is asking us to provide best practices surrounding:
1. How to improve the performance of the adobe forms while accessing in SAP.
2. Is there any other technology which we can use in SAP to replace the adobe forms which has better performance factor.
3. Are there solutions such as webdynpro floor plan manager, UI Fiori which can be alternately used?
Regards,
SakthiHello Priya,
Adobe forms are easy to develop and much more comfortable than SAP Scripts and Smartforms. Initially they are a bit difficult but once you have your hands on, they are the most simplest things in ABAP.
Performance in Adobe forms is a mix of both fine tuning the Layout as well as back end coding.
Performance in Adobe forms cannot be done overnight. A lot of care has to be taken during the initial stage of development.
As far as my experience is concerned, please consider the below points while developing SAP Adobe forms.
1) Avoid Scripting (Javascript/Formcalc) as much as possible inside the form. It drastically reduces the performance and makes the form to execute slower. If you still want to use scripting(which cannot be avoided for some requirements), use Formcalc since it is comparatively faster than JavaScript.
2) Try to avoid the coding inside the Form Interface. You can always handle the maximum coding in the Driver program and pass it to the form.
3) Use Form Caching.
For forms that have fixed layout, its a good way to increase the performance of form rendering. In the layout, go to Form Properties. Then Click on Defaults tab and select Allow Form Rendering To Be Cached On Server. Then Click OK.
For forms that have flowable or dynamic layout, render the forms on the client side because it improves performance.
Last but not the least, please go through the below post by Otto Gold which is worth a read at least once.
How to write a messy form -
How to get around a performance issue when dealing with a lot of data
Hello All,
This is an academic question really, I'm not sure what I'm going to do with my issue, but I have some options. I was wondering if anyone would like to throw in their two cents on what they would do.
I have a report, the users want to see all agreements and all conditions related to the updating of rebates and the affected invoices. From a technical perspective ENT6038-KONV-KONP-KONA-KNA1. THese are the tables I have to hit. The problem is that when they retroactively update rebate conditions they can hit thousands of invoices, which blossoms out to thousands of conditions...you see the problem. I simply have too much data to grab, it times out.
I've tried everything around the code. If you have a better way to get price conditions and agreement numbers off of thousands of invoices, please let me know what that is.
I have a couple of options.
1) Use shared memory to preload the data for the report. This would work, but I'm not going to know what data is needed to be loaded until report run time. They put in a date. I simply can't preload everything. I don't like this option much.
2) Write a function module to do this work. When the user clicks on the button to get this particular data, it will launch the FM in background and e-mail them the results. As you know, the background job won't time out. So far this is my favored option.
Any other ideas?
Oh...nope, BI is not an option, we don't have it. I know, I'm not happy about it. We do have a data warehouse, but the prospect of working with that group makes me whince.My two cents - firstly totally agree with Derick that its probably a good idea to go back to the business and justify their requirement in regards to reporting and "whether any user can meaningfully process all those results in an aggregate". But having dealt with customers across industries over a long period of time, it would probably be bit fanciful to expect them to change their requirements too much as in my experience neither do they understand (too much) technology nor they want to hear about technical limitations for a system etc. They want what they want if possible yesterday!
So, about dealing with performance issues within ABAP, I'm sure you must be already using efficient programming techniques like using Hash internal tables with Unique Keys, accessing rows of the table using Field-Symbols and all that but what I was going to suggest to you is probably look at using [Extracts|http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9ed135c111d1829f0000e829fbfe/content.htm]. I've had to deal with this couple of times in the past when dealing with massive amount of data and I found it to be very efficient in regards to performance. A good point to remember when using Extracts that, I quote from SAP Help, "The size of an extract dataset is, in principle, unlimited. Extracts larger than 500KB are stored in operating system files. The practical size of an extract is up to 2GB, as long as there is enough space in the filesystem."
Hope this helps,
Cheers,
Sougata. -
OEPE Performance Issues in Eclipse 3.5 / Vista
Hello,
We are experiencing some performance issues handling larger DML files:
1. It takes about a 45 - 60 sec to open 6.6MB DML file (see link for source below) in Eclipse 3.5 on Lenovo ThinkPad W500 Core Duo 2 laptop with 3GB memory (1 year old and still considered a pretty fast laptop)
2. Executing this file from Eclipse IDE just hangs with a spinning Vista wheel. I have to kill and restart the IDE.
Here is the error I get after waiting for the spinning wheel to stop for a while:
"Unhandled event loop exception
Java heap space"
Then Eclipse shows this message:
"An out of memory error has occurred. Consult the "Running Eclipse"section of the read me file for information on preventing this kind of error in the future. You are recommended to exit the workbench..."
******** 2/28 Update:
I've changed the Xmx parameter to -Xmx1024 as suggested. It didn't give me the error this time, but it still took about 1.5 min to open this SQL file in Eclipse and another 10 min waiting before the INSERT statements started to execute, though they never reached the end. Other operations on this file are very slow too (e.g. right-clicking and selecting a menu item). It seems that handling larger files is currently not implemented as efficient as it could be. Maybe it's not buffered?
The DDL/DML scripts to replicate this issue can be downloaded from http://colddata.zftp.com/tmp/dml-ddl.zip
Thank you.I've done some preliminary research into this performance bottleneck. There are several issues involved: DTP's scrapbook handles large strings without buffer; our plsql parser parses large strings without buffer; and we attempt to execute more than 40000 insert statements one by one.
We're near the end of our current release cycle. With issues in this scale, we have to wait until our next release to address it.
Shenxue -
SQL query performance issues.
Hi All,
I worked on the query a month ago and the fix worked for me in test intance but failed in production. Following is the URL for the previous thread.
SQL query performance issues.
Following is the tkprof file.
CURSOR_ID:76 LENGTH:2383 ADDRESS:f6b40ab0 HASH_VALUE:2459471753 OPTIMIZER_GOAL:ALL_ROWS USER_ID:443 (APPS)
insert into cos_temp(
TRX_DATE, DEPT, PRODUCT_LINE, PART_NUMBER,
CUSTOMER_NUMBER, QUANTITY_SOLD, ORDER_NUMBER,
INVOICE_NUMBER, EXT_SALES, EXT_COS,
GROSS_PROFIT, ACCT_DATE,
SHIPMENT_TYPE,
FROM_ORGANIZATION_ID,
FROM_ORGANIZATION_CODE)
select a.trx_date,
g.segment5 dept,
g.segment4 prd,
m.segment1 part,
d.customer_number customer,
b.quantity_invoiced units,
-- substr(a.sales_order,1,6) order#,
substr(ltrim(b.interface_line_attribute1),1,10) order#,
a.trx_number invoice,
(b.quantity_invoiced * b.unit_selling_price) sales,
(b.quantity_invoiced * nvl(price.operand,0)) cos,
(b.quantity_invoiced * b.unit_selling_price) -
(b.quantity_invoiced * nvl(price.operand,0)) profit,
to_char(to_date('2010/02/28 00:00:00','yyyy/mm/dd HH24:MI:SS'),'DD-MON-RR') acct_date,
'DRP',
l.ship_from_org_id,
p.organization_code
from ra_customers d,
gl_code_combinations g,
mtl_system_items m,
ra_cust_trx_line_gl_dist c,
ra_customer_trx_lines b,
ra_customer_trx_all a,
apps.oe_order_lines l,
apps.HR_ORGANIZATION_INFORMATION i,
apps.MTL_INTERCOMPANY_PARAMETERS inter,
apps.HZ_CUST_SITE_USES_ALL site,
apps.qp_list_lines_v price,
apps.mtl_parameters p
where a.trx_date between to_date('2010/02/01 00:00:00','yyyy/mm/dd HH24:MI:SS')
and to_date('2010/02/28 00:00:00','yyyy/mm/dd HH24:MI:SS')+0.9999
and a.batch_source_id = 1001 -- Sales order shipped other OU
and a.complete_flag = 'Y'
and a.customer_trx_id = b.customer_trx_id
and b.customer_trx_line_id = c.customer_trx_line_id
and a.sold_to_customer_id = d.customer_id
and b.inventory_item_id = m.inventory_item_id
and m.organization_id
= decode(substr(g.segment4,1,2),'01',5004,'03',5004,
'02',5003,'00',5001,5002)
and nvl(m.item_type,'0') <> '111'
and c.code_combination_id = g.code_combination_id+0
and l.line_id = b.interface_line_attribute6
and i.organization_id = l.ship_from_org_id
and p.organization_id = l.ship_from_org_id
and i.org_information3 <> '5108'
and inter.ship_organization_id = i.org_information3
and inter.sell_organization_id = '5108'
and inter.customer_site_id = site.site_use_id
and site.price_list_id = price.list_header_id
and product_attr_value = to_char(m.inventory_item_id)
call count cpu elapsed disk query current rows misses
Parse 1 0.47 0.56 11 197 0 0 1
Execute 1 3733.40 3739.40 34893 519962154 11 188 0
total 2 3733.87 3739.97 34904 519962351 11 188 1
| Rows Row Source Operation
| ------------ ---------------------------------------------------
| 188 HASH JOIN (cr=519962149 pr=34889 pw=0 time=2607.35)
| 741 .TABLE ACCESS BY INDEX ROWID QP_PRICING_ATTRIBUTES (cr=519939426 pr=34889 pw=0 time=2457.32)
| 254644500 ..NESTED LOOPS (cr=519939265 pr=34777 pw=0 time=3819.67)
| 254643758 ...NESTED LOOPS (cr=8921833 pr=29939 pw=0 time=1274.41)
| 741 ....NESTED LOOPS (cr=50042 pr=7230 pw=0 time=11.37)
| 741 .....NESTED LOOPS (cr=48558 pr=7229 pw=0 time=11.35)
| 741 ......NESTED LOOPS (cr=47815 pr=7223 pw=0 time=11.32)
| 3237 .......NESTED LOOPS (cr=41339 pr=7223 pw=0 time=12.42)
| 3237 ........NESTED LOOPS (cr=38100 pr=7223 pw=0 time=12.39)
| 3237 .........NESTED LOOPS (cr=28296 pr=7139 pw=0 time=12.29)
| 1027 ..........NESTED LOOPS (cr=17656 pr=4471 pw=0 time=3.81)
| 1027 ...........NESTED LOOPS (cr=13537 pr=4404 pw=0 time=3.30)
| 486 ............NESTED LOOPS (cr=10873 pr=4240 pw=0 time=0.04)
| 486 .............NESTED LOOPS (cr=10385 pr=4240 pw=0 time=0.03)
| 486 ..............TABLE ACCESS BY INDEX ROWID RA_CUSTOMER_TRX_ALL (cr=9411 pr=4240 pw=0 time=0.02)
| 75253 ...............INDEX RANGE SCAN RA_CUSTOMER_TRX_N5 (cr=403 pr=285 pw=0 time=0.38)
| 486 ..............TABLE ACCESS BY INDEX ROWID HZ_CUST_ACCOUNTS (cr=974 pr=0 pw=0 time=0.01)
| 486 ...............INDEX UNIQUE SCAN HZ_CUST_ACCOUNTS_U1 (cr=488 pr=0 pw=0 time=0.01)
| 486 .............INDEX UNIQUE SCAN HZ_PARTIES_U1 (cr=488 pr=0 pw=0 time=0.01)
| 1027 ............TABLE ACCESS BY INDEX ROWID RA_CUSTOMER_TRX_LINES_ALL (cr=2664 pr=164 pw=0 time=1.95)
| 2063 .............INDEX RANGE SCAN RA_CUSTOMER_TRX_LINES_N2 (cr=1474 pr=28 pw=0 time=0.22)
| 1027 ...........TABLE ACCESS BY INDEX ROWID RA_CUST_TRX_LINE_GL_DIST_ALL (cr=4119 pr=67 pw=0 time=0.54)
| 1027 ............INDEX RANGE SCAN RA_CUST_TRX_LINE_GL_DIST_N1 (cr=3092 pr=31 pw=0 time=0.20)
| 3237 ..........TABLE ACCESS BY INDEX ROWID MTL_SYSTEM_ITEMS_B (cr=10640 pr=2668 pw=0 time=15.35)
| 3237 ...........INDEX RANGE SCAN MTL_SYSTEM_ITEMS_B_U1 (cr=2062 pr=40 pw=0 time=0.33)
| 3237 .........TABLE ACCESS BY INDEX ROWID OE_ORDER_LINES_ALL (cr=9804 pr=84 pw=0 time=0.77)
| 3237 ..........INDEX UNIQUE SCAN OE_ORDER_LINES_U1 (cr=6476 pr=47 pw=0 time=0.43)
| 3237 ........TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=3239 pr=0 pw=0 time=0.04)
| 3237 .........INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=2 pr=0 pw=0 time=0.01)
| 741 .......TABLE ACCESS BY INDEX ROWID HR_ORGANIZATION_INFORMATION (cr=6476 pr=0 pw=0 time=0.10)
| 6474 ........INDEX RANGE SCAN HR_ORGANIZATION_INFORMATIO_FK2 (cr=3239 pr=0 pw=0 time=0.03)Please help.
Regards
Ashish| 254644500 ..NESTED LOOPS (cr=519939265 pr=34777 pw=0 time=3819.67)
| 254643758 ...NESTED LOOPS (cr=8921833 pr=29939 pw=0 time=1274.41)There is no way the optimizer should choose to process that many rows using nested loops.
Either the statistics are not up to date, the data values are skewed or you have some optimizer parameter set to none default to force index access.
Please post explain plan and optimizer* parameter settings. -
Hi Friends,
While executing Tcode - MIRO, we are facing performance issue . The details are as below
We create PO , then receive the goods against PO and then do invoice verification. In PO we check box for GR-Based IV.
We have observed that if we check the box for GR-Based IV, there is performance issue with MIRO, But if we do not check this box, there is no performance issue with MIRO.
Could you tell me how to resolve this issue ?
I will reward for every useful responses.
pls treat it as urgent.
Thx in Adv.
BobbyIf you check the box for GR-Based IV.
then the GR data needs to be picked up from table MKPF & MSEG
for MIRO..
Check with your Basis team...they may find the exact reason -
R12.1.1 AP invoice workbench accounted not changed to yes
HI ALL
i have a problem in my R12.1.1 AP invoice workbench accounted not changed to yes , action create account always executed successfully but the accounted status not changed to (YES) however the create account command successfully created.
i appreciate you help.
Thanks
Khaled.Hi,
i wonder if the accounting is actually being created for the invoice. open the inovice for which you say that accounted is still no, go to tools bar click on Reports then View Accounting. you can also check the issue by gettig the invoice data through Application diagnostics giving the invoice id in parameters.
Regards,
Tasweer -
Report Performance Issue - Activity
Hi gurus,
I'm developing an Activity report using Transactional database (Online real time object).
the purpose of the report is to list down all contacts related activities and activities NOT related to Contact by activity owner (user id).
In order to fullfill that requirment I've created 2 report
1) All Activities related to Contact -- Report A
pull in Acitivity ID , Activity Type, Status, Contact ID
2) All Activities not related to Contact UNION All Activities related to Contact (Base report) -- Report B
to get the list of activities not related to contact i'm using Advanced filter based on result of another request which is I think is the part that slow down the query.
<Activity ID not equal to any Activity ID in Report B>
Anyone encountered performance issue due to the advanced filter in analytic before?
any input is really appriciated
Thanks in advanced,
FinaFina,
Union is always the last option. If you can get all record in one report, do not use union.
since all records, which you are targeting, are in the activity subject area, it is not nessecery to combine reports. add a column with the following logic
if contact id is null (or = 'Unspecified') then owner name else contact name
Hopefully, this is helping. -
Report performance Issue in BI Answers
Hi All,
We have a performance issues with reports. Report is running more than 10 mins. we took query from the session log and ran it in database, at that time it took not more than 2 mins. We have verified proper indexes on the where clause columns.
Could any once suggest to improve the performance in BI answers?
Thanks in advance,I hope you dont have many case statements and complex calculations that you do in the Answers.
Next thing you need to monitor is how many rows of data that you are trying to retrieve from the query. If the volume is huge then it takes time to do the formatting on the Answers as you are going to dump huge volumes of data. Database(like teradata) returns initially like 1-2000 records if you hit show all records then even db is gonna fair amount of time if you are dumping many records
hope it helps
thanks
Prash
Maybe you are looking for
-
One way encryption, decrypting not encrypting ASA5505
Hello All, I've been troubleshooting this issue and was hoping to get some more feed back and maybe point out an error if I'm not seeing it. I recently setup a remote access VPN on Cisco ASA 5505. Everything appeared to work at first and the IPsec cl
-
Adobe Reader doesn't work after windows 7 update
Hello, My Adobe Reader X was working fine, until one night where Windows 7 automatically updated, and after that Adobe Reader doesn't work anymore. It doesn't respond AT ALL when I click on it, and I cannot view PDF files anymore. I uninstalled it, a
-
Filter not working in SQL Developer 2.1
I have just upgraded to SQL Developer 2.1 and there seems to be a problem with filtering information in the Data tab. The filters I type in are simply ignored. Is there a setting somewhere that I am missing?
-
Can I update plugin on dial-up - check & update page doesn't work
I am on DIAL UP as I live in remote area. Got message that Flash plugin was disabled because it is out of date. Tried to update and told plugins BLOCKED FOR MY SAFETY, then told to go to "Plugin Check & Update" page. The "Checking Mozilla on Status o
-
I am interested in the X-Rite ColorMunki monitor and printer profiling device but being a non professional I find it rather expensive. Especially as I already have the Spyder2. I am pleased with the Spider2 as a monitor calibrating device but I'm not