Reports taking long time to execute
Hi,
There are few reports on SSRS which are taking almost 6-8 minutes to complete and display the data.
I am using Oracle database as source.
When I checked the query performance, what I found that main data set is taking almost 2-3 minutes to execute on Sql developer. Also there are two parameters which are taking almost 1-1 minute to execute.
When I run the report without these two parameters, report execution time is reduced by more than 3 minutes.
Also I am using 3-4 groupings in the report and 6 columns are aggregated at each grouping.
Reports are tabular reports and contains header, footers and 2-3 text boxes to display parameter values.
Can you please provide me some ways to optimize the queries and reduce the time taken by report to complete.
Hi sudipta,
According to your description, it takes too long to render the report when accessing it. Right?
In this scenario, it can be many possibilities which will reduce the report performance. We suggest you check the report on ReportServer first. Go to the ReportServer ExecutionLog to see which part takes more time.
Then we need to do some troubleshooting to improve the report performance. Here we have a article for your reference:
Troubleshooting Reports: Report Performance
If you have any question, please feel free to ask.
Best Regards,
Simon Hou
Similar Messages
-
Performance tunned report taking more time to execute - URGENT
Dear Experts,
In One Report Program is Taking long time to execute at background session, I am Taking That Report To Tune The Performance But This is taking 12 hours more to excute .........
The Code is given below.
Before Tune.
DATA : BEGIN OF ITAB OCCURS 0,
LGOBE LIKE T001L-LGOBE,
105DT LIKE MKPF-BUDAT,
XBLNR LIKE MKPF-XBLNR,
BEDAT LIKE EKKO-BEDAT,
LIFNR LIKE EKKO-LIFNR,
NAME1 LIKE LFA1-NAME1,
EKKO LIKE EKKO-BEDAT,
BISMT LIKE MARA-BISMT,
MAKTX LIKE MAKT-MAKTX,
NETPR LIKE EKPO-NETPR,
PEINH LIKE EKPO-PEINH,
VALUE TYPE P DECIMALS 2,
DISPO LIKE MARC-DISPO,
DSNAM LIKE T024D-DSNAM,
AGE TYPE P DECIMALS 0,
PARLIFNR LIKE EKKO-LIFNR,
PARNAME1 LIKE LFA1-NAME1,
MBLNR LIKE MSEG-MBLNR,
MJAHR LIKE MSEG-MJAHR,
ZEILE LIKE MSEG-ZEILE,
BWART LIKE MSEG-BWART,
MATNR LIKE MSEG-MATNR,
WERKS LIKE MSEG-WERKS,
LIFNR LIKE MSEG-LIFNR,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
EBELN LIKE MSEG-EBELN,
EBELP LIKE MSEG-EBELP,
LGORT LIKE MSEG-LGORT,
SMBLN LIKE MSEG-SMBLN,
BUKRS LIKE MSEG-BUKRS,
GSBER LIKE MSEG-GSBER,
INSMK LIKE MSEG-INSMK,
XAUTO LIKE MSEG-XAUTO,
END OF ITAB.
SELECT MBLNR MJAHR ZEILE BWART MATNR WERKS LIFNR MENGE MEINS
EBELN EBELP LGORT SMBLN BUKRS GSBER INSMK XAUTO
FROM MSEG
INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE WERKS EQ P_WERKS AND
MBLNR IN S_MBLNR AND
BWART EQ '105' and
mblnr ne '5002361303' and
mblnr ne '5003501080' and
mblnr ne '5002996300' and
mblnr ne '5002996407' AND
mblnr ne '5003587026' AND
mblnr ne '5003587026' AND
mblnr ne '5003493186' AND
mblnr ne '5002720583' AND
mblnr ne '5002928122' AND
mblnr ne '5002628263'.
After tune.
TYPES : BEGIN OF ST_ITAB ,
MBLNR LIKE MSEG-MBLNR,
MJAHR LIKE MSEG-MJAHR,
ZEILE LIKE MSEG-ZEILE,
BWART LIKE MSEG-BWART,
MATNR LIKE MSEG-MATNR,
WERKS LIKE MSEG-WERKS,
LIFNR LIKE MSEG-LIFNR,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
EBELN LIKE MSEG-EBELN,
EBELP LIKE MSEG-EBELP,
LGORT LIKE MSEG-LGORT,
SMBLN LIKE MSEG-SMBLN,
BUKRS LIKE MSEG-BUKRS,
GSBER LIKE MSEG-GSBER,
INSMK LIKE MSEG-INSMK,
XAUTO LIKE MSEG-XAUTO,
END OF ST_ITAB.
DATA : ITAB TYPE STANDARD TABLE OF ST_ITAB WITH HEADER LINE.
SELECT MBLNR MJAHR ZEILE BWART MATNR WERKS LIFNR MENGE MEINS
EBELN EBELP LGORT SMBLN BUKRS GSBER INSMK XAUTO
FROM MSEG
INTO TABLE ITAB
WHERE WERKS EQ P_WERKS AND
MBLNR IN S_MBLNR AND
BWART EQ '105' AND
MBLNR NE '5002361303' AND
MBLNR NE '5003501080' AND
MBLNR NE '5002996300' AND
MBLNR NE '5002996407' AND
MBLNR NE '5003587026' AND
MBLNR NE '5003587026' AND
MBLNR NE '5003493186' AND
MBLNR NE '5002720583' AND
MBLNR NE '5002928122' AND
MBLNR NE '5002628263'.
PLEASE GIVE ME THE SOULUTION......
Reward avail for useful answer
thanks in adv,
jai.mHi.
The Select statment accessing MSEG Table is Slow Many a times.
To Improve the performance of MSEG.
1.Check for the proper notes in the Service Market Place if you are working for CIN version.
2.Index the MSEG table
2.Check and limit the Columns in the Select statment .
Possible Way.
SELECT MBLNR MJAHR ZEILE BWART MATNR WERKS LIFNR MENGE MEINS
EBELN EBELP LGORT SMBLN BUKRS GSBER INSMK XAUTO
FROM MSEG
INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE WERKS EQ P_WERKS AND
MBLNR IN S_MBLNR AND
BWART EQ '105' .
Delete itab where itab EQ '5002361303'
Delete itab where itab EQ '5003501080'
Delete itab where itab EQ '5002996300'
Delete itab where itab EQ '5002996407'
Delete itab where itab EQ '5003587026'
Delete itab where itab EQ '5003587026'
Delete itab where itab EQ '5003493186'
Delete itab where itab EQ '5002720583'
Delete itab where itab EQ '5002928122'
Delete itab where itab EQ '5002628263'.
Select
Regards
Bala.M
Edited by: Bala Malvatu on Feb 7, 2008 9:18 PM -
SSRS Reports taking long time to load
Hello,
Problem : SSRS Reports taking long time to load
My System environment : Visual Studio 2008 SP1 and SQL Server 2008 R2
Production Environment : Visual Studio 2008 SP1 and SQL Server 2008 R2
I have created a Parameterized report (6 parameters), it will fetch data from 1 table. table has 1 year and 6 months data, I am selecting parameters for only 1 month (about 2500 records). It is taking almost 2 minutes and 30 seconds
to load the report.
This report running efficiently in my system (report load takes only 5 to 6 seconds) but in
production it is taking 2 minutes 30 seconds.
I have checked the Execution log from production so I found the timing for
Data retrieval (approx~) Processing (approx~) Rendering (approx~)
10 second 15 sec
2 mins and 5 sec.
But Confusing point is that , if I run the same report at different time overall output time is same (approx) 2 min 30 sec but
Data retrieval (approx~) Processing (approx~) Rendering (approx~)
more than 1 min 15 sec
more than 1 min
so 1 question why timings are different ?
My doubts are
1) If query(procedure to retrieve the data) is the problem then it should take more time always,
2) If Report structure is problem then rendering will also take same time (long time)
for this (2nd point) I checked on blog that Rendering depends on environment structure e.g. Network bandwidth, RAM, CPU Usage , Number of users accessing same report at a time.
So I did testing of report when no other user working on any report But failed (same result output is 2 min 30 sec)
From network team I got the result is that there is no issue or overload in CPU usage or RAM also No issue in Network bandwidth.
Production Database Server and Report server are different (but in same network).
I checked that database server the SQL Server is using almost Full RAM (23 GB out of 24 GB)
I tried to allocate the memory to less amount up to 2GB (Trial solution I got from Blogs) but this on also failed.
one hint I got from colleague that , change the allocated memory setting from static memory to dynamic to SQL Server
(I guess above point is the same) I could not find that option Static and Dynamic memory setting.
I did below steps
Connected to SQL Server Instance
Right click on Instance go to properties, Go to Memory Tab
I found three options 1) Server Memory 2) Other memory 3) Section for "Configured values and Running values"
Then I tried to reduce Maximum Server memory up to 2 GB (As mentioned above)
All trials failed, this issue I could not find the roots for this issue.
Can anyone please help (it's bit urgent).Hi UdayKGR,
According to your description, your report takes too long to load on your production environment. Right?
In this scenario, since the report runs quickly in developing environment, we initially think it supposed to be the issue on data retrieval. However, based on the information in execution log, it takes longest time on rendering part. So we suggest you optimize
the report itself to reduce the time for rendering. Please refer to the link below:
My report takes too long to render
Here is another article about overall performance optimization for Reporting Services:
Reporting Services Performance and Optimization
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
Taking long time to execute views
Hi All,
my query is taking long time to execute(i am using standard views in my query)
XLA_INV_AEL_GL_V , XLA_WIP_AEL_GL_V -----these standard views itself taking long time to execute ,but i need the info from this views
WHERE gjh.je_batch_id = gjb.je_batch_id AND
gjh.je_header_id = gjl.je_header_id AND
gjh.je_header_id = xlawip.je_header_id AND
gjl.je_header_id = xlawip.je_header_id AND
gjl.je_line_num = xlawip.je_line_num AND
gcc.code_combination_id = gjl.code_combination_id AND
gjl.code_combination_id = xlawip.code_combination_id AND
gjb.set_of_books_id = xlawip.set_of_books_id AND
gjh.je_source = 'Inventory' AND
gjh.je_category = 'WIP' AND
gp.period_set_name = 'Accounting' AND
gp.period_name = gjl.period_name AND
gp.period_name = gjh.period_name AND
gp.start_date +1 between to_date(startdate,'DD-MON-YY') AND
to_date(enddate,'DD-MON-YY') AND
gjh.status =nvl(lstatus,gjh.status)
Could any one help me to execute it fast?
Thanks
Madhu[url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]When your query takes too long...
-
Query is taking long time to execute after migrating to 10g r2
Hi
We recently migrated the database from 9i to 10gr2 ((10.2.0.2.0).. This query was running in acceptable time before the upgrade in 9i.. Now it is taking a long long time to execute this... Can you please let me know what should i do to improve the performance now.. We are running stats everyday..
Thanks for your help,
Shree
======================================================================================
SELECT cr.cash_receipt_id
,cr.pay_from_customer
,cr.receipt_number
,cr.receipt_date
,cr.amount
,cust.account_number
,crh.gl_date
,cr.set_of_books_id
,sum(ra.amount_applied) amount_applied
FROM AR_CASH_RECEIPTS_ALL cr
,AR_RECEIVABLE_APPLICATIONS_ALL ra
,hz_cust_accounts cust
,AR_CASH_RECEIPT_HISTORY_ALL crh
,GL_PERIOD_STATUSES gps
,FND_APPLICATION app
WHERE cr.cash_receipt_id = ra.cash_receipt_id
AND ra.status = 'UNAPP'
AND cr.status <> 'REV'
AND cust.cust_account_id = cr.pay_from_customer
AND substr(cust.account_number,1,2) <> 'SI' -- Don't allocate Unapplied receipts FOR SI customers
AND crh.cash_receipt_id = cr.cash_receipt_id
AND app.application_id = gps.application_id
AND app.application_short_name = 'AR'
AND gps.period_name = 'May-07'
AND crh.gl_date <= gps.end_date
AND cr.receipt_number not like 'WH%'
-- AND cust.customer_number = '0000079260001'
GROUP BY cr.cash_receipt_id
,cr.pay_from_customer
,cr.receipt_number
,cr.receipt_date
,cr.amount
,cust.account_number
,crh.gl_date
,cr.set_of_books_id
HAVING sum(ra.amount_applied) > 0;
=========================================================================================
Here is the explain plan in 10g r2 (10.2.0.2.0)
PLAN_TABLE_OUTPUT
Plan hash value: 2617075047
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
| 0 | SELECT STATEMENT | | 92340 | 10M| | 513K (1)|
|* 1 | FILTER | | | | | |
| 2 | HASH GROUP BY | | 92340 | 10M| 35M| 513K (1)|
| 3 | TABLE ACCESS BY INDEX ROWID | AR_RECEIVABLE_APPLICATIONS_ALL | 2 | 34 |
| 4 | NESTED LOOPS | | 184K| 21M| | 510K (1)|
|* 5 | HASH JOIN | | 99281 | 9M| 3296K| 176K (1)|
|* 6 | TABLE ACCESS FULL | HZ_CUST_ACCOUNTS | 112K| 1976K| | 22563 (1)|
|* 7 | HASH JOIN | | 412K| 33M| 25M| 151K (1)|
| 8 | TABLE ACCESS BY INDEX ROWID | AR_CASH_RECEIPT_HISTORY_ALL | 332K| 4546K|
| 9 | NESTED LOOPS | | 498K| 19M| | 26891 (1)|
| 10 | NESTED LOOPS | | 2 | 54 | | 4 (0)|
| 11 | TABLE ACCESS BY INDEX ROWID| FND_APPLICATION | 1 | 8 | | 1 (0)|
|* 12 | INDEX UNIQUE SCAN | FND_APPLICATION_U3 | 1 | | | 0 (0)|
| 13 | TABLE ACCESS BY INDEX ROWID| GL_PERIOD_STATUSES | 2 | 38 | | 3 (0)
|* 14 | INDEX RANGE SCAN | GL_PERIOD_STATUSES_U1 | 1 | | | 2 (0)|
|* 15 | INDEX RANGE SCAN | AR_CASH_RECEIPT_HISTORY_N2 | 332K| | | 1011 (1)
PLAN_TABLE_OUTPUT
|* 16 | TABLE ACCESS FULL | AR_CASH_RECEIPTS_ALL | 5492K| 235M| | 108K
|* 17 | INDEX RANGE SCAN | AR_RECEIVABLE_APPLICATIONS_N1 | 4 | | | 2
Predicate Information (identified by operation id):
1 - filter(SUM("RA"."AMOUNT_APPLIED")>0)
5 - access("CUST"."CUST_ACCOUNT_ID"="CR"."PAY_FROM_CUSTOMER")
6 - filter(SUBSTR("CUST"."ACCOUNT_NUMBER",1,2)<>'SI')
7 - access("CRH"."CASH_RECEIPT_ID"="CR"."CASH_RECEIPT_ID")
12 - access("APP"."APPLICATION_SHORT_NAME"='AR')
14 - access("APP"."APPLICATION_ID"="GPS"."APPLICATION_ID" AND "GPS"."PERIOD_NAME"='May-07')
filter("GPS"."PERIOD_NAME"='May-07')
15 - access("CRH"."GL_DATE"<="GPS"."END_DATE")
16 - filter("CR"."STATUS"<>'REV' AND "CR"."RECEIPT_NUMBER" NOT LIKE 'WH%')
17 - access("CR"."CASH_RECEIPT_ID"="RA"."CASH_RECEIPT_ID" AND "RA"."STATUS"='UNAPP')
filter("RA"."CASH_RECEIPT_ID" IS NOT NULL)
Here is the explain plan in 9i
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=445977 Card=78530 By
tes=9423600)
1 0 FILTER
2 1 SORT (GROUP BY) (Cost=445977 Card=78530 Bytes=9423600)
3 2 HASH JOIN (Cost=443717 Card=157060 Bytes=18847200)
4 3 HASH JOIN (Cost=99563 Card=94747 Bytes=9758941)
5 4 TABLE ACCESS (FULL) OF 'HZ_CUST_ACCOUNTS' (Cost=12
286 Card=110061 Bytes=1981098)
6 4 HASH JOIN (Cost=86232 Card=674761 Bytes=57354685)
7 6 TABLE ACCESS (BY INDEX ROWID) OF 'AR_CASH_RECEIP
T_HISTORY_ALL' (Cost=17532 Card=542304 Bytes=7592256)
8 7 NESTED LOOPS (Cost=17536 Card=809791 Bytes=332
01431)
9 8 NESTED LOOPS (Cost=4 Card=1 Bytes=27)
10 9 TABLE ACCESS (BY INDEX ROWID) OF 'FND_APPL
ICATION' (Cost=1 Card=1 Bytes=8)
11 10 INDEX (UNIQUE SCAN) OF 'FND_APPLICATION_
U3' (UNIQUE)
12 9 TABLE ACCESS (BY INDEX ROWID) OF 'GL_PERIO
D_STATUSES' (Cost=3 Card=1 Bytes=19)
13 12 INDEX (RANGE SCAN) OF 'GL_PERIOD_STATUSE
S_U1' (UNIQUE) (Cost=2 Card=1)
14 8 INDEX (RANGE SCAN) OF 'AR_CASH_RECEIPT_HISTO
RY_N2' (NON-UNIQUE) (Cost=1740 Card=542304)
15 6 TABLE ACCESS (FULL) OF 'AR_CASH_RECEIPTS_ALL' (C
ost=60412 Card=8969141 Bytes=394642204)
16 3 TABLE ACCESS (FULL) OF 'AR_RECEIVABLE_APPLICATIONS_A
LL' (Cost=337109 Card=15613237 Bytes=265425029)Hi,
The plan between 9i and 10g is pretty the same but the amount of data fetched has considerably increased. I guess the query was performing slow even in 9i.
The AR_CASH_RECEIPT_HISTORY_ALL is presently having 332000 rows in 10g where as it was 17532 in 9i.
AR_CASH_RECEIPT_HISTORY_N2 is now having 332,000 rows in 10g where as in 9i it had 1,740
Try creating some indexes on
AR_CASH_RECEIPTS_ALL
hz_cust_accounts -
Report Taking long time in QA system
Gurus,
I have developed a report which works fine in dev.Though in QA system its performance is not okay.Please go through th ecode and help me through.
TABLES: REGUH,BSAK,BSIS,LFA1,LFB1,BSAS.
**** Internal table declaration starts.
*** To Store Vendor clearing Document.
*** Internal table for credit card sub total.
DATA : BEGIN OF I_BSAK OCCURS 0,
XBLNR LIKE BSAK-XBLNR,
LIFNR LIKE REGUH-LIFNR,
PRCTR LIKE BSEG-PRCTR,
NAME1 LIKE LFA1-NAME1,
AUGDT LIKE BSAK-AUGDT,
AUGBL LIKE BSAK-AUGBL,
XBLNR1 LIKE BSAK-XBLNR,
GJAHR LIKE BSAK-GJAHR,
BELNR LIKE BSAK-BELNR,
BLDAT LIKE BSAK-BLDAT,
BLART LIKE BSAK-BLART,
SHKZG LIKE BSAK-SHKZG,
DMBTR LIKE BSAK-DMBTR,
AUGGJ LIKE BSAK-AUGGJ,
CPUDT LIKE BSAK-CPUDT,
LAUFD LIKE REGUH-LAUFD,
KTOKK LIKE LFA1-KTOKK,
RWBTR LIKE REGUH-RWBTR,
VBLNR LIKE REGUH-VBLNR,
HKONT LIKE BSEG-HKONT,
END OF I_BSAK.
*** Internal table for Vendor sub total.
DATA : BEGIN OF I_BSAK_LIFNR OCCURS 0,
LIFNR LIKE REGUH-LIFNR,
XBLNR LIKE BSAK-XBLNR,
PRCTR LIKE BSEG-PRCTR,
NAME1 LIKE LFA1-NAME1,
AUGDT LIKE BSAK-AUGDT,
AUGBL LIKE BSAK-AUGBL,
XBLNR1 LIKE BSAK-XBLNR,
GJAHR LIKE BSAK-GJAHR,
BELNR LIKE BSAK-BELNR,
BLDAT LIKE BSAK-BLDAT,
BLART LIKE BSAK-BLART,
SHKZG LIKE BSAK-SHKZG,
DMBTR LIKE BSAK-DMBTR,
AUGGJ LIKE BSAK-AUGGJ,
CPUDT LIKE BSAK-CPUDT,
LAUFD LIKE REGUH-LAUFD,
KTOKK LIKE LFA1-KTOKK,
RWBTR LIKE REGUH-RWBTR,
VBLNR LIKE REGUH-VBLNR,
HKONT LIKE BSEG-HKONT,
END OF I_BSAK_LIFNR.
*** Internal table for Profit center sub total.
DATA : BEGIN OF I_BSAK_PRCTR OCCURS 0,
PRCTR LIKE BSEG-PRCTR,
BELNR LIKE BSAK-BELNR,
GJAHR LIKE BSAK-GJAHR,
LIFNR LIKE REGUH-LIFNR,
XBLNR LIKE BSAK-XBLNR,
HKONT LIKE BSEG-HKONT,
NAME1 LIKE LFA1-NAME1,
AUGDT LIKE BSAK-AUGDT,
AUGBL LIKE BSAK-AUGBL,
XBLNR1 LIKE BSAK-XBLNR,
BLDAT LIKE BSAK-BLDAT,
BLART LIKE BSAK-BLART,
SHKZG LIKE BSAK-SHKZG,
DMBTR LIKE BSAK-DMBTR,
AUGGJ LIKE BSAK-AUGGJ,
CPUDT LIKE BSAK-CPUDT,
LAUFD LIKE REGUH-LAUFD,
KTOKK LIKE LFA1-KTOKK,
RWBTR LIKE REGUH-RWBTR,
VBLNR LIKE REGUH-VBLNR,
END OF I_BSAK_PRCTR.
*** Work area for sub totals.
DATA: WA LIKE I_BSAK.
DATA : I_BSAK_INIT LIKE I_BSAK OCCURS 0 WITH HEADER LINE.
*** To store line item.
DATA : BEGIN OF I_BSEG OCCURS 0,
BELNR LIKE BSEG-BELNR,
GJAHR LIKE BSEG-GJAHR,
BUZEI LIKE BSEG-BUZEI,
HKONT LIKE BSEG-HKONT,
SHKZG LIKE BSEG-SHKZG,
DMBTR LIKE BSEG-DMBTR,
PRCTR LIKE BSEG-PRCTR,
LIFNR LIKE REGUH-LIFNR,
AUGDT LIKE BSAK-AUGDT,
AUGBL LIKE BSAK-AUGBL,
XBLNR LIKE BSAK-XBLNR,
XBLNR1 LIKE BSAK-XBLNR,
BLDAT LIKE BSAK-BLDAT,
BLART LIKE BSAK-BLART,
NAME1 LIKE LFA1-NAME1,
END OF I_BSEG.
DATA : BEGIN OF I_BSEG_COPY OCCURS 0,
PRCTR LIKE BSEG-PRCTR,
BELNR LIKE BSEG-BELNR,
GJAHR LIKE BSEG-GJAHR,
BUZEI LIKE BSEG-BUZEI,
HKONT LIKE BSEG-HKONT,
SHKZG LIKE BSEG-SHKZG,
DMBTR LIKE BSEG-DMBTR,
LIFNR LIKE REGUH-LIFNR,
AUGDT LIKE BSAK-AUGDT,
AUGBL LIKE BSAK-AUGBL,
XBLNR LIKE BSAK-XBLNR,
XBLNR1 LIKE BSAK-XBLNR,
BLDAT LIKE BSAK-BLDAT,
BLART LIKE BSAK-BLART,
NAME1 LIKE LFA1-NAME1,
END OF I_BSEG_COPY.
*** To store GL account name
DATA: BEGIN OF I_SKAT OCCURS 0,
SAKNR LIKE SKAT-SAKNR,
TXT50 LIKE SKAT-TXT50,
END OF I_SKAT.
*** To store Vendor detail
DATA: BEGIN OF I_LFA1 OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
KTOKK LIKE LFA1-KTOKK,
END OF I_LFA1.
DATA: I_INACT TYPE TABLE OF SY-UCOMM.
*** End of Internal table declaration.
*** Constant for company code
CONSTANTS : C_BUKRS(4) VALUE '0010'.
*** Data declaration.
DATA: FR_LAUFDT LIKE REGUH-LAUFD,
TO_LAUFDT LIKE REGUH-LAUFD,
COL,
HEADING(80),
HEADING1(10),
HEADING2(80),
AUTH_RESTRICT,
G_DETAIL,
G_SORTV,
G_SORTP,
G_SORTC,
G_FLAG,
V_XBLNR LIKE BSAK-XBLNR,
V_UCOMM LIKE SY-UCOMM,
V_AUGBL LIKE BSAS-AUGBL,
V_BELNR LIKE BSAS-BELNR.
DATA : BEGIN OF I_SEL OCCURS 0 ,
AUGBL LIKE BSAK-AUGBL,
END OF I_SEL.
DATA: PROGNAME TYPE SY-REPID,
DYNNUM TYPE SY-DYNNR,
DYNPRO_VALUES TYPE TABLE OF DYNPREAD,
FIELD_VALUE LIKE LINE OF DYNPRO_VALUES,
VALUES_TAB LIKE I_SEL OCCURS 0 WITH HEADER LINE.
DATA : RETURN_TAB LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.
*** Selection screen.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) TXT_PD FOR FIELD P_LAUFDF.
SELECTION-SCREEN POSITION POS_LOW.
PARAMETERS P_LAUFDF LIKE REGUH-LAUFD OBLIGATORY.
SELECTION-SCREEN COMMENT 52(5) TXT_TO FOR FIELD P_LAUFDT.
SELECTION-SCREEN POSITION POS_HIGH.
PARAMETERS P_LAUFDT LIKE REGUH-LAUFD.
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS: S_KTOKK FOR LFA1-KTOKK.
PARAMETERS: P_RWBTR LIKE REGUH-RWBTR.
SELECT-OPTIONS: S_LIFNR FOR REGUH-LIFNR.
* S_XBLNR FOR BSAK-XBLNR MATCHCODE OBJECT ZXBLNR.
**** Added By Rajesh On 17 OCT 08 (DEVK914797) ****
SELECT-OPTIONS: S_BELNR FOR BSAK-BELNR.
**** End of Addition By Rajesh *****
*** Added By Samir On 04 Sep 08 (DEVK914623) ***
SELECTION-SCREEN SKIP.
PARAMETERS: CHK_REC AS CHECKBOX.
*** End Of Addition By Samir ***
SELECTION-SCREEN END OF BLOCK B1.
*** Initialization.
INITIALIZATION.
TXT_PD = 'Payment Date'.
TXT_TO = 'to' .
G_SORTC = 'X'.
*** At selection-screen.
AT SELECTION-SCREEN.
FR_LAUFDT = P_LAUFDF.
IF P_LAUFDT IS INITIAL.
TO_LAUFDT = FR_LAUFDT.
ELSE.
IF P_LAUFDT LT P_LAUFDF.
MESSAGE E000(ZMSG) WITH 'To Date is less than From date'.
ENDIF.
TO_LAUFDT = P_LAUFDT.
ENDIF.
*** Heading.
WRITE FR_LAUFDT TO HEADING1.
WRITE TO_LAUFDT TO HEADING2.
IF HEADING1 <> HEADING2.
CONCATENATE 'Vendor Credit Card(s) Report for the Payment Date'
HEADING1 'To' HEADING2 INTO HEADING2 SEPARATED BY SPACE.
ELSE.
CONCATENATE 'Vendor Credit Card(s) Report for the Payment Date'
HEADING1 INTO HEADING2 SEPARATED BY SPACE.
ENDIF.
*** Start of selection.
START-OF-SELECTION.
G_DETAIL = 'X'.
PERFORM GET_DATA.
PERFORM MODIFY_ITAB. "Process and for authority check.
*** Added By Samir On 04 Sep 08 (DEVK914623) ***
**** Changed By Rajesh On 17 OCT 08 (DEVK914797) ****
IF CHK_REC = 'X'.
LOOP AT I_BSAK.
SELECT SINGLE BELNR
INTO V_BELNR
FROM BSAS
WHERE BUKRS = C_BUKRS
AND HKONT = '0000002012'
AND BELNR = I_BSAK-AUGBL
AND BUDAT = I_BSAK-AUGDT
AND BELNR IN S_BELNR. " For displaying only reconciled items.
**** End of Addition By Rajesh *****
IF SY-SUBRC <> 0.
DELETE I_BSAK.
ENDIF.
ENDLOOP.
ENDIF.
*** End Of Addition By Samir ***
LOOP AT I_BSAK.
MOVE-CORRESPONDING I_BSAK TO: I_BSAK_LIFNR.
APPEND: I_BSAK_LIFNR.
CLEAR: I_BSAK_LIFNR.
ENDLOOP.
LOOP AT I_BSAK.
MOVE-CORRESPONDING I_BSAK TO: I_BSAK_PRCTR.
READ TABLE I_BSEG WITH KEY BELNR = I_BSAK-BELNR.
I_BSAK_PRCTR-HKONT = I_BSEG-HKONT.
APPEND: I_BSAK_PRCTR.
CLEAR: I_BSAK_PRCTR.
ENDLOOP.
*loop at i_bseg.
* MOVE-CORRESPONDING I_BSAK TO: I_BSAK_PRCTR.
*endloop.
*perform write_data.
PERFORM DISPLAY_OUTPUT.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'EXPA'.
G_DETAIL = 'X'.
WHEN 'COLL'.
CLEAR G_DETAIL.
WHEN 'SORTV'.
CLEAR: V_UCOMM.
V_UCOMM = 'SORTV'.
G_SORTV = 'X'.
CLEAR G_SORTP.
CLEAR G_SORTC.
WHEN 'SORTC'.
CLEAR: V_UCOMM.
V_UCOMM = 'SORTC'.
CLEAR G_SORTV.
CLEAR G_SORTP.
G_SORTC = 'X'.
WHEN 'SORTP'.
CLEAR: V_UCOMM.
V_UCOMM = 'SORTP'.
CLEAR G_SORTV.
CLEAR G_SORTC.
G_SORTP = 'X'.
ENDCASE.
PERFORM DISPLAY_OUTPUT.
*perform write_data.
*** To get the header text in the output.
TOP-OF-PAGE.
PERFORM TOP_OF_PAGE.
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM TOP_OF_PAGE.
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM GET_DATA .
SY-LSIND = 0.
P_RWBTR = P_RWBTR * -1.
REFRESH I_BSAK_INIT.
CLEAR I_BSAK_INIT.
SELECT A~LIFNR A~LAUFD A~VBLNR A~RWBTR
B~KTOKK B~NAME1
FROM REGUH AS A INNER JOIN LFA1 AS B
ON A~LIFNR = B~LIFNR
INTO CORRESPONDING FIELDS OF TABLE I_BSAK_INIT
WHERE A~LAUFD BETWEEN FR_LAUFDT AND TO_LAUFDT AND
A~XVORL <> 'X' AND
A~ZBUKR = C_BUKRS AND
A~LIFNR IN S_LIFNR AND
A~RZAWE = 'X' AND
A~RWBTR LE P_RWBTR AND
B~KTOKK IN S_KTOKK.
IF SY-SUBRC <> 0.
MESSAGE 'Records Not Found' TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
*---------------------PERFORMANCE ISSUE--------------------------
delete adjacent duplicates from i_bsak_init.
IF NOT I_BSAK_INIT[] IS INITIAL.
SELECT LIFNR AUGDT AUGBL GJAHR BELNR CPUDT BLDAT XBLNR
BLART SHKZG DMBTR AUGGJ
FROM BSAK
INTO CORRESPONDING FIELDS OF TABLE I_BSAK
FOR ALL ENTRIES IN I_BSAK_INIT
WHERE BUKRS = C_BUKRS AND
AUGBL = I_BSAK_INIT-VBLNR AND
XZAHL <> 'X'.
ENDIF.
*** Selecting all line item records from BSEG table.
IF I_BSAK[] IS NOT INITIAL.
SELECT BELNR GJAHR BUZEI HKONT SHKZG DMBTR PRCTR
FROM BSEG
INTO CORRESPONDING FIELDS OF TABLE I_BSEG
FOR ALL ENTRIES IN I_BSAK
WHERE BUKRS = C_BUKRS AND
BELNR = I_BSAK-BELNR AND
GJAHR = I_BSAK-GJAHR AND
BELNR <> I_BSAK-AUGBL AND
KOART <> 'K'.
ENDIF.
*** Selecting gl account name from SKAT table.
IF I_BSEG[] IS NOT INITIAL.
SELECT SAKNR TXT50
FROM SKAT
INTO CORRESPONDING FIELDS OF TABLE I_SKAT
FOR ALL ENTRIES IN I_BSEG
WHERE SPRAS = 'E' AND
KTOPL = C_BUKRS AND
SAKNR = I_BSEG-HKONT.
ENDIF.
SORT I_BSAK BY BELNR.
SORT I_BSAK_INIT BY VBLNR.
SORT I_BSEG BY BELNR GJAHR.
*** Selecting Credit Card No. into I_XBLNR table.
LOOP AT I_BSAK.
I_BSAK-XBLNR1 = I_BSAK-XBLNR.
CLEAR: V_XBLNR.
SELECT SINGLE XBLNR FROM BKPF INTO V_XBLNR
WHERE BUKRS = C_BUKRS AND
BELNR = I_BSAK-AUGBL.
IF SY-SUBRC EQ 0.
I_BSAK-XBLNR = V_XBLNR.
ENDIF.
READ TABLE I_BSEG WITH KEY BELNR = I_BSAK-BELNR
GJAHR = I_BSAK-GJAHR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
I_BSAK-PRCTR = I_BSEG-PRCTR.
ENDIF.
READ TABLE I_BSAK_INIT WITH KEY VBLNR = I_BSAK-AUGBL BINARY SEARCH.
IF SY-SUBRC EQ 0.
I_BSAK-NAME1 = I_BSAK_INIT-NAME1.
I_BSAK-LAUFD = I_BSAK_INIT-LAUFD.
I_BSAK-KTOKK = I_BSAK_INIT-KTOKK.
ENDIF.
MODIFY I_BSAK TRANSPORTING XBLNR XBLNR1 PRCTR NAME1 LAUFD KTOKK.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form MODIFY_ITAB
* text
* --> p1 text
* <-- p2 text
FORM MODIFY_ITAB .
*** Process on internal table
LOOP AT I_BSAK.
AUTHORITY-CHECK OBJECT 'F_LFA1_GRP'
ID 'KTOKK'
FIELD I_BSAK-KTOKK.
IF SY-SUBRC NE 0.
DELETE I_BSAK WHERE KTOKK EQ I_BSAK-KTOKK.
AUTH_RESTRICT = 'X'.
CONTINUE.
ENDIF.
ENDLOOP.
IF AUTH_RESTRICT EQ 'X'.
MESSAGE S005(ZMSG).
ENDIF.
LOOP AT I_BSAK.
IF I_BSAK-SHKZG = 'S'.
I_BSAK-DMBTR = I_BSAK-DMBTR * -1.
MODIFY I_BSAK .
ENDIF.
ENDLOOP.
LOOP AT I_BSEG.
IF I_BSEG-SHKZG = 'H'.
I_BSEG-DMBTR = I_BSEG-DMBTR * -1.
MODIFY I_BSEG .
ENDIF.
ENDLOOP.
*** Default Sorting on internal table .
SORT I_BSAK BY XBLNR LIFNR BELNR.
SORT I_BSEG BY BELNR HKONT.
SORT I_SKAT BY SAKNR.
ENDFORM. " MODIFY_ITAB
*& Form DISPLAY_OUTPUT
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY_OUTPUT .
*** Coding for detail output starts
CLEAR SY-LSIND.
REFRESH I_INACT.
IF G_DETAIL EQ 'X'.
APPEND 'EXPA' TO I_INACT.
ELSE.
APPEND 'COLL' TO I_INACT.
ENDIF.
IF G_SORTV EQ 'X'.
APPEND 'SORTV' TO I_INACT.
SORT I_BSAK BY LIFNR.
SORT I_BSAK_LIFNR BY LIFNR.
ELSEIF G_SORTP EQ 'X'.
APPEND 'SORTP' TO I_INACT.
SORT I_BSAK BY PRCTR.
SORT I_BSAK_PRCTR BY PRCTR.
ELSE.
APPEND 'SORTC' TO I_INACT.
SORT I_BSAK BY XBLNR.
ENDIF.
SET PF-STATUS 'STAT' EXCLUDING I_INACT.
IF V_UCOMM = 'SORTC'.
PERFORM WRITE_DATA.
ELSEIF V_UCOMM = 'SORTV' . "Subroutine for card sub total.
PERFORM WRITE_DATA_VENDOR. "Subroutine for vendor sub total.
ELSEIF V_UCOMM = 'SORTP'. "Subroutine for profit center sub total.
* PERFORM WRITE_DATA_PROFIT.
PERFORM WRITE_DATA_PROFIT_NEW. " New subroutine for profit center.
ELSE.
PERFORM WRITE_DATA.
ENDIF.
ENDFORM. " DISPLAY_OUTPUT
*& Form F_COLOR
* text
* --> p1 text
* <-- p2 text
FORM F_COLOR .
IF COL = 'X'.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
CLEAR COL.
ELSE.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
COL = 'X'.
ENDIF.
ENDFORM. " F_COLOR
*& Form TOP_OF_PAGE
* text
* --> p1 text
* <-- p2 text
FORM TOP_OF_PAGE .
*** Top-of-page is Common for summary and detail report.
*** To display top of page only on first page.
IF SY-PAGNO = 1 .
CALL FUNCTION 'Z_NPL_HEADING'
EXPORTING
LINE_SIZE = SY-LINSZ
HEADING1 = HEADING
HEADING2 = HEADING2.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
**** To get output columns text descprition
ULINE.
WRITE:/ SY-VLINE NO-GAP, (10) 'Vendor' NO-GAP,
SY-VLINE NO-GAP, (35) 'Name of Payee' NO-GAP,
SY-VLINE NO-GAP, (10) 'G/L Num' NO-GAP,
SY-VLINE NO-GAP, (42) 'G/L Name' NO-GAP,
SY-VLINE NO-GAP, (07) 'Profit Center' NO-GAP,
SY-VLINE NO-GAP, (16) 'Credit Card NO.' NO-GAP,
SY-VLINE NO-GAP, (10) 'Pmnt Date' NO-GAP,
SY-VLINE NO-GAP, (08) 'Doc.Type' NO-GAP,
SY-VLINE NO-GAP, (10) 'Inv.Date' NO-GAP,
SY-VLINE NO-GAP, (16) 'Invoice' NO-GAP,
SY-VLINE NO-GAP, (14) 'Amount Paid' NO-GAP,
SY-VLINE.
ULINE.
ENDIF.
ENDFORM. " TOP_OF_PAGE
*& Form WRITE_DATA
* text
* --> p1 text
* <-- p2 text
FORM WRITE_DATA .
LOOP AT I_BSAK.
CLEAR WA.
MOVE-CORRESPONDING I_BSAK TO WA.
PERFORM WRITE.
AT END OF XBLNR. "Card sub total
IF G_SORTC EQ 'X'.
SUM.
IF G_DETAIL EQ 'X'. ULINE. ENDIF.
FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
WRITE:/ SY-VLINE NO-GAP, (25) 'Credit Card Total:', I_BSAK-XBLNR ,
(35) I_BSAK-NAME1 NO-GAP.
WRITE: 110 SY-VLINE NO-GAP,(79) I_BSAK-DMBTR NO-GAP
CURRENCY 'USD',SY-VLINE.
ULINE.
ENDIF.
ENDAT. "End of Credit card Detail
**** Grand total
AT LAST. "Grand total
SUM.
FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
WRITE:/ SY-VLINE NO-GAP,(107) 'Grand Total:',
SY-VLINE NO-GAP,(79) I_BSAK-DMBTR NO-GAP
CURRENCY 'USD', SY-VLINE.
ULINE.
ENDAT.
ENDLOOP. "End for I_BSAK loop
ENDFORM. " WRITE_DATA
*& Form WRITE_DATA_VENDOR
* text
* --> p1 text
* <-- p2 text
FORM WRITE_DATA_VENDOR .
LOOP AT I_BSAK_LIFNR.
CLEAR WA.
MOVE-CORRESPONDING I_BSAK_LIFNR TO WA.
PERFORM WRITE.
AT END OF LIFNR. "Vendor sub Total
IF G_SORTV EQ 'X'.
SUM.
IF G_DETAIL EQ 'X'. ULINE. ENDIF.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ SY-VLINE NO-GAP,(15) 'Vendor Total:', I_BSAK_LIFNR-LIFNR.
WRITE: 110 SY-VLINE NO-GAP,(79) I_BSAK_LIFNR-DMBTR NO-GAP
CURRENCY 'USD',SY-VLINE.
ULINE.
ENDIF.
ENDAT. "End of Vendor Total
**** Grand total
AT LAST. "Grand total
SUM.
FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
WRITE:/ SY-VLINE NO-GAP,(107) 'Grand Total:',
SY-VLINE NO-GAP,(79) I_BSAK_LIFNR-DMBTR NO-GAP
CURRENCY 'USD', SY-VLINE.
ULINE.
ENDAT.
ENDLOOP. "End for I_BSAK_LIFNR loop
ENDFORM. " WRITE_DATA_VENDOR
*& Form WRITE_DATA_PROFIT
* text
* --> p1 text
* <-- p2 text
FORM WRITE_DATA_PROFIT .
*** Changed By Samir On 18 Sep 08 (DEVK914685) ***
LOOP AT I_BSAK_PRCTR.
READ TABLE I_BSAK WITH KEY BELNR = I_BSAK_PRCTR-BELNR
GJAHR = I_BSAK_PRCTR-GJAHR.
IF SY-SUBRC = 0.
I_BSAK_PRCTR-LIFNR = I_BSAK-LIFNR.
I_BSAK_PRCTR-NAME1 = I_BSAK-NAME1.
I_BSAK_PRCTR-XBLNR = I_BSAK-XBLNR.
I_BSAK_PRCTR-LAUFD = I_BSAK-LAUFD.
I_BSAK_PRCTR-BLART = I_BSAK-BLART.
I_BSAK_PRCTR-BLDAT = I_BSAK-BLDAT.
I_BSAK_PRCTR-XBLNR1 = I_BSAK-XBLNR1.
MODIFY I_BSAK_PRCTR TRANSPORTING LIFNR NAME1 XBLNR LAUFD BLART BLDAT XBLNR1.
ENDIF.
ENDLOOP.
*** End Of Changes By Samir On 18 Sep 08 ***
SORT I_BSAK_PRCTR BY PRCTR.
LOOP AT I_BSAK_PRCTR.
PERFORM F_COLOR.
IF G_DETAIL = 'X'.
*** Changed By Samir On 18 Sep 08 (DEVK914685) ***
READ TABLE I_SKAT WITH KEY SAKNR = I_BSAK_PRCTR-HKONT BINARY SEARCH.
WRITE:/ SY-VLINE NO-GAP, (10) I_BSAK_PRCTR-LIFNR NO-GAP,
SY-VLINE NO-GAP, (35) I_BSAK_PRCTR-NAME1 NO-GAP,
SY-VLINE NO-GAP, (10) I_BSAK_PRCTR-HKONT NO-GAP,
SY-VLINE NO-GAP, (42) I_SKAT-TXT50 NO-GAP,
SY-VLINE NO-GAP, (07) I_BSAK_PRCTR-PRCTR NO-GAP,
SY-VLINE NO-GAP, (16) I_BSAK_PRCTR-XBLNR NO-GAP, " CREDIT CARD NO.
SY-VLINE NO-GAP, (10) I_BSAK_PRCTR-LAUFD NO-GAP,
SY-VLINE NO-GAP, (08) I_BSAK_PRCTR-BLART NO-GAP,
SY-VLINE NO-GAP, (10) I_BSAK_PRCTR-BLDAT NO-GAP,
SY-VLINE NO-GAP, (16) I_BSAK_PRCTR-XBLNR1 NO-GAP.
WRITE: SY-VLINE NO-GAP, (14) I_BSAK_PRCTR-DMBTR NO-GAP.
WRITE: SY-VLINE.
ENDIF.
*** End Of Changes By Samir On 18 Sep 08 ***
AT END OF PRCTR. "Profit Center sub Total
IF G_SORTP EQ 'X'.
SUM.
IF G_DETAIL EQ 'X'. ULINE. ENDIF.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ SY-VLINE NO-GAP,(07) 'Profit Center Total:', I_BSAK_PRCTR-PRCTR.
WRITE: 110 SY-VLINE NO-GAP,(79) I_BSAK_PRCTR-DMBTR NO-GAP
CURRENCY 'USD',SY-VLINE.
ULINE.
ENDIF.
ENDAT. "End of Profit Center Total
**** Grand total
AT LAST. "Grand total
SUM.
FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
WRITE:/ SY-VLINE NO-GAP,(107) 'Grand Total:',
SY-VLINE NO-GAP,(79) I_BSAK_PRCTR-DMBTR NO-GAP
CURRENCY 'USD', SY-VLINE.
ULINE.
ENDAT.
ENDLOOP. "End for I_BSAK_PRCTR loop
ENDFORM. " WRITE_DATA_PROFIT
*& Form WRITE
* text
* --> p1 text
* <-- p2 text
FORM WRITE .
IF G_DETAIL = 'X'.
IF WA-KTOKK = 'Z001'. " For HR Vendors
PERFORM F_COLOR.
READ TABLE I_BSEG WITH KEY BELNR = WA-BELNR GJAHR = WA-GJAHR BINARY SEARCH .
READ TABLE I_SKAT WITH KEY SAKNR = I_BSEG-HKONT BINARY SEARCH.
WRITE:/ SY-VLINE NO-GAP, (10) WA-LIFNR NO-GAP,
SY-VLINE NO-GAP, (35) WA-NAME1 NO-GAP,
SY-VLINE NO-GAP, (10) I_BSEG-HKONT NO-GAP,
SY-VLINE NO-GAP, (42) I_SKAT-TXT50 NO-GAP,
*** Changed By Samir On 18 Sep 08 (DEVK914685) ***
* SY-VLINE NO-GAP, (07) WA-PRCTR NO-GAP,
SY-VLINE NO-GAP, (07) I_BSEG-PRCTR NO-GAP,
*** End Of Changes By Samir On 18 Sep 08 ***
SY-VLINE NO-GAP, (16) WA-XBLNR NO-GAP, " CREDIT CARD NO.
SY-VLINE NO-GAP, (10) WA-LAUFD NO-GAP,
SY-VLINE NO-GAP, (08) WA-BLART NO-GAP,
SY-VLINE NO-GAP, (10) WA-BLDAT NO-GAP,
SY-VLINE NO-GAP, (16) WA-XBLNR1 NO-GAP.
WRITE: SY-VLINE NO-GAP, (14) WA-DMBTR NO-GAP.
WRITE: SY-VLINE.
ELSE.
LOOP AT I_BSEG WHERE BELNR = WA-BELNR AND GJAHR = WA-GJAHR .
PERFORM F_COLOR.
READ TABLE I_SKAT WITH KEY SAKNR = I_BSEG-HKONT BINARY SEARCH.
WRITE:/ SY-VLINE NO-GAP, (10) WA-LIFNR NO-GAP,
SY-VLINE NO-GAP, (35) WA-NAME1 NO-GAP,
SY-VLINE NO-GAP, (10) I_BSEG-HKONT NO-GAP,
SY-VLINE NO-GAP, (42) I_SKAT-TXT50 NO-GAP,
*** Changed By Samir On 17 Sep 08 (DEVK914671) ***
* SY-VLINE NO-GAP, (07) WA-PRCTR NO-GAP,
SY-VLINE NO-GAP, (07) I_BSEG-PRCTR NO-GAP,
*** End Of Changes By Samir On 17 Sep 08 ***
SY-VLINE NO-GAP, (16) WA-XBLNR NO-GAP, " CREDIT CARD NO.
SY-VLINE NO-GAP, (10) WA-LAUFD NO-GAP,
SY-VLINE NO-GAP, (08) WA-BLART NO-GAP,
SY-VLINE NO-GAP, (10) WA-BLDAT NO-GAP,
SY-VLINE NO-GAP, (16) WA-XBLNR1 NO-GAP.
WRITE: SY-VLINE NO-GAP, (14) I_BSEG-DMBTR NO-GAP.
WRITE: SY-VLINE.
ENDLOOP. "End for I_BSEG loop
ENDIF. "Endif for I_PAYR-KTOKK = 'Z001'
ENDIF. "Endif for g_detail = 'X'.
ENDFORM. " WRITE
*& Form WRITE_DATA_PROFIT_NEW
* text
* --> p1 text
* <-- p2 text
FORM WRITE_DATA_PROFIT_NEW .
REFRESH I_BSEG_COPY.
CLEAR I_BSEG_COPY.
* DATA I_BSEG_COPY LIKE I_BSEG OCCURS 0 WITH HEADER LINE.
* I_BSEG_COPY[] = I_BSEG[].
LOOP AT I_BSEG.
MOVE-CORRESPONDING I_BSEG TO I_BSEG_COPY.
APPEND I_BSEG_COPY.
CLEAR I_BSEG_COPY.
ENDLOOP.
LOOP AT I_BSEG_COPY.
READ TABLE I_BSAK_PRCTR WITH KEY BELNR = I_BSEG_COPY-BELNR GJAHR = I_BSEG_COPY-GJAHR ."HKONT = I_BSEG_COPY-HKONT.
IF SY-SUBRC = 0.
I_BSEG_COPY-LIFNR = I_BSAK_PRCTR-LIFNR.
I_BSEG_COPY-XBLNR = I_BSAK_PRCTR-XBLNR.
I_BSEG_COPY-NAME1 = I_BSAK_PRCTR-NAME1.
I_BSEG_COPY-AUGDT = I_BSAK_PRCTR-AUGDT.
I_BSEG_COPY-AUGBL = I_BSAK_PRCTR-AUGBL.
I_BSEG_COPY-XBLNR1 = I_BSAK_PRCTR-XBLNR1.
I_BSEG_COPY-BLDAT = I_BSAK_PRCTR-BLDAT.
I_BSEG_COPY-BLART = I_BSAK_PRCTR-BLART.
MODIFY I_BSEG_COPY TRANSPORTING LIFNR XBLNR NAME1 AUGDT AUGBL XBLNR1 BLDAT BLART.
ENDIF.
ENDLOOP.
SORT I_BSAK_PRCTR BY PRCTR BELNR.
SORT I_BSEG BY BELNR.
SORT I_BSEG_COPY BY PRCTR.
DATA COUNT TYPE I.
DATA G_BELNR LIKE BSAK-BELNR.
LOOP AT I_BSEG_COPY.
CLEAR G_BELNR.
G_BELNR = I_BSEG_COPY-BELNR.
COUNT = COUNT + 1.
READ TABLE I_BSAK WITH KEY BELNR = I_BSEG_COPY-BELNR.
IF SY-SUBRC <> 0.
DELETE I_BSEG_COPY WHERE BELNR = G_BELNR."INDEX count.
ENDIF.
ENDLOOP.
* LOOP AT I_BSAK_PRCTR.
LOOP AT I_BSEG_COPY.
CLEAR WA.
MOVE-CORRESPONDING I_BSEG_COPY TO WA.
PERFORM WRITE_PRCTR.
AT END OF PRCTR. "Profit center sub Total
IF G_SORTP EQ 'X'.
SUM.
IF G_DETAIL EQ 'X'. ULINE. ENDIF.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ SY-VLINE NO-GAP,(20) 'Profit Center Total:', I_BSEG_COPY-PRCTR.
WRITE: 110 SY-VLINE NO-GAP,(79) I_BSEG_COPY-DMBTR NO-GAP
CURRENCY 'USD',SY-VLINE.
ULINE.
ENDIF.
ENDAT. "End of Vendor Total
**** Grand total
AT LAST. "Grand total
SUM.
FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
WRITE:/ SY-VLINE NO-GAP,(107) 'Grand Total:',
SY-VLINE NO-GAP,(79) I_BSEG_COPY-DMBTR NO-GAP
CURRENCY 'USD', SY-VLINE.
ULINE.
ENDAT.
ENDLOOP. "End for I_BSAK_LIFNR loop
*ENDFORM. " WRITE_DATA_VENDOR
ENDFORM. " WRITE_DATA_PROFIT_NEW
*& Form WRITE_PRCTR
* text
* --> p1 text
* <-- p2 text
FORM WRITE_PRCTR .
IF G_DETAIL = 'X'.
IF WA-KTOKK = 'Z001'. " For HR Vendors
PERFORM F_COLOR.
* READ TABLE I_BSEG WITH KEY BELNR = WA-BELNR GJAHR = WA-GJAHR PRCTR = WA-PRCTR BINARY SEARCH .
READ TABLE I_SKAT WITH KEY SAKNR = WA-HKONT BINARY SEARCH.
WRITE:/ SY-VLINE NO-GAP, (10) WA-LIFNR NO-GAP,
SY-VLINE NO-GAP, (35) WA-NAME1 NO-GAP,
SY-VLINE NO-GAP, (10) WA-HKONT NO-GAP,
SY-VLINE NO-GAP, (42) I_SKAT-TXT50 NO-GAP,
*** Changed By Samir On 18 Sep 08 (DEVK914685) ***
SY-VLINE NO-GAP, (07) WA-PRCTR NO-GAP,
* SY-VLINE NO-GAP, (07) I_BSEG-PRCTR NO-GAP,
*** End Of Changes By Samir On 18 Sep 08 ***
SY-VLINE NO-GAP, (16) WA-XBLNR NO-GAP, " CREDIT CARD NO.
SY-VLINE NO-GAP, (10) WA-LAUFD NO-GAP,
SY-VLINE NO-GAP, (08) WA-BLART NO-GAP,
SY-VLINE NO-GAP, (10) WA-BLDAT NO-GAP,
SY-VLINE NO-GAP, (16) WA-XBLNR1 NO-GAP.
WRITE: SY-VLINE NO-GAP, (14) WA-DMBTR NO-GAP.
WRITE: SY-VLINE.
ELSE.
* LOOP AT I_BSEG WHERE BELNR = WA-BELNR AND GJAHR = WA-GJAHR AND PRCTR = WA-PRCTR .
PERFORM F_COLOR.
READ TABLE I_SKAT WITH KEY SAKNR = WA-HKONT BINARY SEARCH.
WRITE:/ SY-VLINE NO-GAP, (10) WA-LIFNR NO-GAP,
SY-VLINE NO-GAP, (35) WA-NAME1 NO-GAP,
SY-VLINE NO-GAP, (10) WA-HKONT NO-GAP,
SY-VLINE NO-GAP, (42) I_SKAT-TXT50 NO-GAP,
*** Changed By Samir On 17 Sep 08 (DEVK914671) ***
SY-VLINE NO-GAP, (07) WA-PRCTR NO-GAP,
* SY-VLINE NO-GAP, (07) I_BSEG-PRCTR NO-GAP,
*** End Of Changes By Samir On 17 Sep 08 ***
SY-VLINE NO-GAP, (16) WA-XBLNR NO-GAP, " CREDIT CARD NO.
SY-VLINE NO-GAP, (10) WA-LAUFD NO-GAP,
SY-VLINE NO-GAP, (08) WA-BLART NO-GAP,
SY-VLINE NO-GAP, (10) WA-BLDAT NO-GAP,
SY-VLINE NO-GAP, (16) WA-XBLNR1 NO-GAP.
WRITE: SY-VLINE NO-GAP, (14) WA-DMBTR NO-GAP.
WRITE: SY-VLINE.
* ENDLOOP. "End for I_BSEG loop
ENDIF. "Endif for I_PAYR-KTOKK = 'Z001'
ENDIF. "Endif for g_detail = 'X'.
ENDFORM. " WRITE_PRCTR
Thanks in advance
Raj.Ralph,
Thanks for the reply.
I have marked the sql statement in the code that is taking long time to run but Its my mistake not explaining the same in the description.
When I was debugging the code the below sql statement was taking long time.
IF NOT I_BSAK_INIT[] IS INITIAL.
SELECT LIFNR AUGDT AUGBL GJAHR BELNR CPUDT BLDAT XBLNR
BLART SHKZG DMBTR AUGGJ
FROM BSAK
INTO CORRESPONDING FIELDS OF TABLE I_BSAK
FOR ALL ENTRIES IN I_BSAK_INIT
WHERE BUKRS = C_BUKRS AND
AUGBL = I_BSAK_INIT-VBLNR AND
XZAHL <> 'X'.
ENDIF.
Any suggestions on the code?
Regards,
Raj. -
Hyperion System 9.3.1 reports taking longer time for the very first time
We are on Hyperion System 9.3.1. The Financial reports are taking longer time (like 2 to 3 minuter) for the very first time for each login. The subsequest reports are does work faster.
The behaviour is same for the Production and Development environments.
All the reporting services have given enough JVM heap size.
FYI, Reporting and Workspace runngin on the same server. Workspace/Reporting are clusted in two servers. HFM app is running on different server. HFM web is on different server. Shared Services is also on running on different server.
Any help would be greately appreciated.
Thanks.The reason they run quicker the subsequent times, is because the data has already been cached in the system.
You could try the usual tricks to speed the report up:
- move items into POV
- have children and parent in the same row
- arrange dimensions in inverse outline order
- remove excessive formatting
- push report calculations back to the data source
We have found that using lots of dynamically calculated members also slows down reports, so try and limit the number of these.
Hope this helps. If not maybe give us an idea of how the report is created to see if other changes could be made. -
Function taking longer time to execute
Hi,
I have a scenario where i am using a TABLE FUNCTION in a join con condition with a Normal TABLE but its getting longer time to execute:
The function is given below:
CREATE OR REPLACE FUNCTION GET_ACCOUNT_TYPE(
SUBNO VARCHAR2 DEFAULT NULL
RETURN ACCOUNT_TYP_KEY_1 PIPELINED AS
V_SUBNO VARCHAR2(20);
V_SUBS_TYP VARCHAR2(10);
V_ACCOUNT_TYP_KEY VARCHAR2(10);
V_ACCOUNT_TYP_KEY_1 VARCHAR2(10);
V_SUBS_TYP_KEY_1 VARCHAR2(10);
V_VAL1 VARCHAR2(255);
CURSOR C1_REC2 IS SELECT SUBNO,NULL
FROM CTVA_ETL.RA_CRM_USER_INFO
GROUP BY SUBNO,SUBSCR_TYPE;
--CURSOR C1_REC IS SELECT SUBNO,SUBSCR_TYPE,ACCOUNT_TYPE_KEY
--FROM CTVA_ETL.RA_CRM_USER_INFO,DIM_RA_MAST_ACCOUNT_TYPE
--WHERE ACCOUNT_TYPE_KEY=RA_CRM_USER_INFO.SUBSCR_TYPE
--WHERE MSISDN='8615025400109'
--WHERE MSISDN IN ('8615025400068','8615025400083','8615025400101','8615025400132','8615025400109')
CURSOR C1_REC IS SELECT SUBNO,SUBSCR_TYPE--,ACCOUNT_TYPE_KEY
FROM CTVA_ETL.RA_CRM_USER_INFO
GROUP BY SUBNO,SUBSCR_TYPE;
BEGIN
OPEN C1_REC;
LOOP
FETCH C1_REC INTO V_SUBNO ,V_SUBS_TYP;
IF V_SUBS_TYP IS NOT NULL THEN
BEGIN
SELECT
ACCOUNT_TYPE_KEY
INTO
V_ACCOUNT_TYP_KEY
FROM
DIM_RA_MAST_ACCOUNT_TYPE,
RA_CRM_USER_INFO
WHERE
ACCOUNT_TYPE_KEY=V_SUBS_TYP
AND ACCOUNT_TYPE_KEY=RA_CRM_USER_INFO.SUBSCR_TYPE
AND SUBNO=V_SUBNO;
EXCEPTION
WHEN NO_DATA_FOUND THEN
V_ACCOUNT_TYP_KEY := '-99';
V_ACCOUNT_TYP_KEY_1 := V_ACCOUNT_TYP_KEY;
END;
ELSE
V_ACCOUNT_TYP_KEY_1:='-99';
END IF;
FOR CUR IN (select
DISTINCT V_SUBNO SUBNO_TYP_2 ,V_ACCOUNT_TYP_KEY_1 ACCOUNT_TYP
from dual)
LOOP
PIPE ROW (ACCOUNT_TYP_KEY(CUR.SUBNO_TYP_2,CUR.ACCOUNT_TYP));
END LOOP;
END LOOP;
RETURN;
CLOSE C1_REC;
END;
The above function wil return rows with respect to SUBSCRIBER TYPE (if Not Null then it will return the ACCOUNT KEY and SUBNO else '-99').
But its not returning any rows so all the rows will come as
SUBNO ACCOUNT_TYP
21 -99
22 -99
23 -99
24 -99
25 -99
Thanks and RegardsHi LMLobo,
In addition to Sebastian’s answer, you can refer to the document
Server Memory Server Configuration Options to check whether the maximum server memory setting of the SQL Server is changed on the new server. Besides, you can also compare the
network packet size setting of the SQL Server as well as the network connectivity on both servers. Besides, you can refer to the following link to troubleshooting SSIS package performance
issue:
http://technet.microsoft.com/en-us/library/dd795223(v=sql.100).aspx.
Regards,
Mike Yin
TechNet Community Support -
Rag: Query performence - Report taking long time when drill down a Char.
Hi All,
After executing the report when we try to Drilldown PO Char, then the report used to take long time nearly 60 to 90 minutes and thorough an errors that "An error is occurred during loading" or "Connection Timed Out".
The report is created on Multiprovider which is build on 7 infocubes and the data for the PO char is coming from all the 7 cubes.
So we have created Aggregates on the 5 Infocubes based on system proposal.
Then,
We checked in RSRT, the data is coming from all 5 Aggregates and also when we drill down the PO also the data is coming from 5 Aggregates itself.
But,
The report is running fine and also when we drilldown the PO to show all the PO values, then the report showing all the POu2019s details by taking nearly 15 mins only.
Here our concern is why the report is taking 15 mins when we drill a PO char.
Could any one give suggestions please.
Thanks in Adv.
Raju. EHi,
please check this list for query performance:
http://sapbwneelam.blogspot.com/2007/10/checklist-for-query-performance.html
Regards
Erwin -
Hyperion Financial reports-taking long time to open after migrating to 9
Hi,
Financial reports version 7 are migrated to system 9.
Problem that we are facing now is that reports take ling time to open.
Can anyone suggest how to improve the performance .
before migration to system 9 financial reports was working fine but now it is taking a long time to openAre they taking a long time to open in the studio or in the workspace?
There could be lots of reasons:
Have there been server changes with the migration?
Have there been any changes in dynamically calculated dimensions? -
Report Taking Long time Results time out error.
Hi Gurus.
We have a report called Material Variances...
When my user is executing the report its taking morethan 40 mins and resulting in error " Time Out Error ".
But when we executing the report with same selections its opening in 5 mins.
can any one has faced the same issue...
Thanks in advance for your replies.
Regards.
CnaHi,
You can check InfoCube 0TCT_C02. It will provide information about the execution of the query.
Right click on Infocube -> Display data -> input the query you want to check in field Query runtime Object->Input the user that executed the query and faces problems
The Infocube will display information about the query execution like how long the database selection took, how long the OLAP processor lasted, etc.
Important:
BI Statistics have to be activeted in the system in order fot the Infocube to display data
Regards, -
Crystal Report taking long time to load for a particular prompt
Hi Abhilash Kumar,
Really need your help with one issue that we are facing with Crystal Report.
We have a particular Crystal Report that has a main report and three sub-reports.
The scenario is such that the main report and two sub-reports are based out from a universe.
The third sub-report on the other hand, is a combination of a sql query and a database.
The problem that we are facing is with a particular prompt that is taking a huge amount of time to load.
When we check the same query on the database, the results are being displayed. Also, once the report is run, Crystal report shows at the bottom of the page that the records are being read, but it taking time to display the results in the report structure in Crystal Reports.
Again, we have checked for a lot of prompts and everything works and loads data within seconds. It is with this particular prompt.
Could you please help us or guide us in this regard.
Thanks,
Jasmine.Hello Jasmine,
Query executing at Database level generally gives the output promptly.
Below are the points which come into account in crystal report execution:-
1. The output in the crystal report comes after processing the all formulas used in report along with the complex structure.
2. The network issue also come into play in fetching the data from source(Database) to the report.
3. Adding the sub-report makes the report slower. If it is necessary to use, then use it with option "On-Demand".
At last "Crystal report shows at the bottom of the page that the records are being read, but it taking time to display the results in the report structure in Crystal Reports."
It means that the Data is already retrieved but report is taking time for processing then only report will be displayed.
Regards,
Raghwendra -
Report taking long time to load
Hello Everyone,
In my report server there are two folders. both contains 2 reports that are retrieving the data from SQL server database (using procedures with few parameters in it).
but reports in one folder loading(when I clicked on report to load, not at data retrieving time) quickly (in 2 to 3 seconds).
and in another folder same process taking too long almost 2 to 3 minutes.
there is no specific permissions on both folders, I simply created folders & uploaded the reports.
but I am getting different loading time for both folder reports.
pleae tell me if more information is required.
thanks in advanceHi UdayKGR,
As per my understanding, I think this issue can be caused by run folder2 report with a cache (a temporary cope of the report), while folder1 report id render on demand. So the folder2 report render report more quicker than folder1 report. For more
details, please see the following document:
http://msdn.microsoft.com/en-us/library/ms178821.aspx
Besides, the SQL views provide the execution log information. The “2” and “3” views were added in more recent releases and contain new fields or they contain fields with friendlier names than the previous releases. So we can look at the ExecutionLog3
to see the most recent data. Especially the Source field. For more details, please see:
http://technet.microsoft.com/en-us/library/ms159110.aspx
Hope this helps.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Report taking more time to execute
Hi,
I Have created a report on " 0FIGL_O02 " General Ledger: Line Items(DSO)
This report is creates for document details . so using this report i want to creat
jump report. But When i am running the report it is taking more tme.
variable sellections i uesed for this report.
1. company code
2.G/L Account
3.Posting date
there are no caliculations for this report. But it is taaking more time and not getting
executed.
plz sugest.
Regards,
prasad.Hi,
Please rebuild the statistics of the ODS.
Also check the various options available below:
ODS Performance
-Vikram -
Script is taking long time to execute
Hi:
This is the query I am executing, this takes a lot of time, how can I use temp tables to make this work fast:
There are only about 6000 records but even then taking lot of time
SET NOCOUNT ON
DECLARE @SName VARCHAR(40), @ContactNo varchar(11), @Code VARCHAR(20), @EMail VARCHAR(40),@CodeId int
DECLARE C1 CURSOR
STATIC FOR SELECT [Staff Name],[Contact No],[Code],[EMail ID] FROM AB
OPEN C1
IF @@CURSOR_ROWS > 0
FETCH NEXT FROM C1 INTO @SName,@ContactNo,@Code,@EMail
WHILE @@Fetch_status = 0
BEGIN
IF EXISTS (SELECT * FROM AddressBook WHERE
Name=@SName)
BEGIN
UPDATE AddressBook
SET MobileNo=@ContactNo,
EMailId=@EMail
WHERE Name=@SName
END
ELSE
BEGIN
INSERT INTO AddressBook
VALUES(@SName,'',@ContactNo,@EMail,'',GETDATE(),GETDATE(),'','A',8,NULL,NULL)
END
END
CLOSE C1
DEALLOCATE C1
SET NOCOUNT OFFInstead of cursor have you tried to look at MERGE command?
IF OBJECT_ID('t1') IS NOT NULL
DROP TABLE t1
GO
CREATE TABLE t1 (id INT PRIMARY KEY, name1 VARCHAR(10))
INSERT INTO t1
SELECT 1, 'name 1' UNION ALL
SELECT 2, 'name 2' UNION ALL
SELECT 3, 'name 3' UNION ALL
SELECT 4, 'name 4' UNION ALL
SELECT 5, 'name 5'
GO
DECLARE @id INT = 6, @name1 VARCHAR(10) = 'name 6'
MERGE t1
USING (SELECT @id AS id, @name1 AS name1) AS t2 ON t1.id = t2.id
WHEN MATCHED
THEN UPDATE SET t1.name1 = t2.name1
WHEN NOT MATCHED
THEN INSERT VALUES(@id, @name1 );
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence
Maybe you are looking for
-
Error while opening a module. plz help me, very urgent.
when i try to open a module, the following error message appears on my screen. " no j2ee component found in d:\krisp\programs\servlets". i've installed bea in c: drive and my servlet program is in d: drive. plz help me,
-
Hello! I Have weird problem with digital audio output in my MB (alu but not pro). Always i have connect mu MB to the ampli through optical cable (spdif). At about two weeks I have problem witch i try to explain (sorry for my bad english): First, inte
-
T60 2 external screens + internal LCD screen
Hi, I have a T60 with the Advanced mini dock and 2 Lenovo ThinkVision external LCD screens. Can I make both external screens and the internal screen work with this setup? I understand the mini dock can only drive to 2 external screens not the intern
-
How to use javasetters and getters in different classes
how to use setters and getters in different class so that the setvalue in one class is effect in second class for getting
-
Return to vendor from customer-return stock
Hello, I want to know how we can picture to SAP the following scenario. Customer returns 1000 PCs, of material. At stock there are 2 PCs of the same materials with MAP 10E. So if i move the return to own stock i end up with 1002 PCs of value 10.020E.