ABAP Report Performance Problem
Hello Experts,
Check the folowing code and suggest me a solution.
IF BSIS-BLART = 'KR'.
SELECT SINGLE LIFNR AS LIFNR2 FROM BSAK INTO CORRESPONDING FIELDS OF ITAB WHERE BELNR = ITAB-BELNR AND GJAHR = ITAB-GJAHR.
SELECT SINGLE NAME1 AS NAME2 FROM LFA1 INTO CORRESPONDING FIELDS OF ITAB WHERE LIFNR = ITAB-LIFNR2.
WRITE: 42 ITAB-LIFNR2, 56 ITAB-NAME2.
ELSEIF BSIS-BLART = 'SA'.
SELECT SINGLE HKONT FROM BSIS INTO CORRESPONDING FIELDS OF ITAB WHERE BELNR = ITAB-BELNR AND GJAHR =
ITAB-GJAHR AND BUKRS = ITAB-BUKRS .
SELECT SINGLE TXT20 FROM SKAT INTO CORRESPONDING FIELDS OF ITAB WHERE SAKNR = BSIS-HKONT
In the above query, the table BSAK, BSIS and SKAT contains lakhs and lakhs of record, its give time out dump in test server. Kindly provide me a solution for the same.
Regards,
Senthil Kumar
Hi,
its inside a Select .. endselect. like this.
select * from covp where kokrs eq itab-kokrs and
lednr eq '00' and
objnr eq itab-objnr and
versn eq '000' and
wrttp eq '04' and
gjahr ge fyr.
itab-belnr = covp-refbn.
if sy-subrc eq 0.
itab-kstar = covp-kstar.
itab-budat = covp-budat.
itab-refbn = covp-refbn.
itab-gjahr = covp-gjahr.
itab-ebeln = covp-ebeln.
itab-ebelp = covp-ebelp.
itab-awtyp = covp-awtyp.
itab-mbgbtr = covp-mbgbtr.
Here the above coding comes.
endselect.
So, How can i proceed wit this.
Similar Messages
-
Interactive report performance problem over database link - Oracle Gateway
Hello all;
This is regarding a thread Interactive report performance problem over database link that was posted by Samo.
The issue that I am facing is when I use Oracle function like (apex_item.check_box) the query slow down by 45 seconds.
query like this: (due to sensitivity issue, I can not disclose real table name)
SELECT apex_item.checkbox(1,b.col3)
, a.col1
, a.col2
FROM table_one a
, table_two b
WHERE a.col3 = 12345
AND a.col4 = 100
AND b.col5 = a.col5
table_one and table_two are remote tables (non-oracle) which are connected using Oracle Gateway.
Now if I run above queries without apex_item.checkbox function the query return or response is less than a second but if I have apex_item.checkbox then the query run more than 30 seconds. I have resolved the issues by creating a collection but it’s not a good practice.
I would like to get ideas from people how to resolve or speed-up the query?
Any idea how to use sub-factoring for the above scenario? Or others method (creating view or materialized view are not an option).
Thank you.
Shaun S.Hi Shaun
Okay, I have a million questions (could you tell me if both tables are from the same remote source, it looks like they're possibly not?), but let's just try some things first.
By now you should understand the idea of what I termed 'sub-factoring' in a previous post. This is to do with using the WITH blah AS (SELECT... syntax. Now in most circumstances this 'materialises' the results of the inner select statement. This means that we 'get' the results then do something with them afterwards. It's a handy trick when dealing with remote sites as sometimes you want the remote database to do the work. The reason that I ask you to use the MATERIALIZE hint for testing is just to force this, in 99.99% of cases this can be removed later. Using the WITH statement is also handled differently to inline view like SELECT * FROM (SELECT... but the same result can be mimicked with a NO_MERGE hint.
Looking at your case I would be interested to see what the explain plan and results would be for something like the following two statements (sorry - you're going have to check them, it's late!)
WITH a AS
(SELECT /*+ MATERIALIZE */ *
FROM table_one),
b AS
(SELECT /*+ MATERIALIZE */ *
FROM table_two),
sourceqry AS
(SELECT b.col3 x
, a.col1 y
, a.col2 z
FROM table_one a
, table_two b
WHERE a.col3 = 12345
AND a.col4 = 100
AND b.col5 = a.col5)
SELECT apex_item.checkbox(1,x), y , z
FROM sourceqry
WITH a AS
(SELECT /*+ MATERIALIZE */ *
FROM table_one),
b AS
(SELECT /*+ MATERIALIZE */ *
FROM table_two)
SELECT apex_item.checkbox(1,x), y , z
FROM table_one a
, table_two b
WHERE a.col3 = 12345
AND a.col4 = 100
AND b.col5 = a.col5If the remote tables are at the same site, then you should have the same results. If they aren't you should get the same results but different to the original query.
We aren't being told the real cardinality of the inners select here so the explain plan is distorted (this is normal for queries on remote and especially non-oracle sites). This hinders tuning normally but I don't think this is your problem at all. How many distinct values do you normally get of the column aliased 'x' and how many rows are normally returned in total? Also how are you testing response times, in APEX, SQL Developer, Toad SQLplus etc?
Sorry for all the questions but it helps to answer the question, if I can.
Cheers
Ben
http://www.munkyben.wordpress.com
Don't forget to mark replies helpful or correct ;) -
One of our abap report is extremely slow, this report is used by all
branches of our company
and we are facing serious performance problem in this report. I have
analyzed the problem
and noted following things.
1) The report used "BSIS" table for a query.
2) In peak times it is observed lot of IO wait is happening on that
particular report and on
"BSIS" table.
3) After analysis of table BSIS it is noted that table has more than 12
million records and
exceeding table class limit in technical setting of tables.
4) Size of table is 4 GB.
5) Table also does not have other indexes apart from one composite PK-
unique index. This
index is composed of 9 fields.
6) Update Stats is has been taken in 10 minutes of BSIS~0.
We are closely analyzing code and where clause of our report.
I want to ask do we need other indexes specially on DATE field which is
not included in
existing index?
Do we need index rebuild as stats are gathered in 10 minutes which is
quite a long time in
my opinion?
Do we need table partition right now as BSIS has 12 million records and
4 GB of size ?
Best Regards
WaqasHi,
1) table bsis is the table for open items (GL-accounts)
-> perfect state of such a table is that there are <b>zero</b> entries,
because all open items had to be cleared and are moved to table bsas
(cleared items)
-> so 1st there is an organisational problem in your company / account dept.
why there are so many open items?
2) analyse the select statements and the abaps, which fetch bsis-table with
st05
-> check, whether key-fields BUKRS and HKONT are filled in where-clause
3)-> look to wiki- ABAP Performance and Tuning
https://wiki.sdn.sap.com/wiki/display/HOME/ABAPPerformanceand+Tuning#ABAPPerformanceandTuning-Whattoolscanbeusedtohelpwithperformancetuning%3F
regards Andreas -
SQL report performance problem
I have a SQL classic report in Apex 4.0.2 and database 11.2.0.2.0 with a performance problem.
The report is based on a PL/SQL function returning a query. The query is based on a view and pl/sql functions. The Apex parsing schema has select grant on the view only, not the underlying objects.
The generated query runs in 1-2 sec in sqlplus (logged in as the Apex parsing schema user), but takes many minutes in Apex. I have found, by monitoring the database sessions via TOAD, that the explain plan in the Apex and sqlplus sessions are very different.
The summary:
In sqlplus SELECT STATEMENT ALL_ROWS Cost: 3,695
In Apex SELECT STATEMENT ALL_ROWS Cost: 3,108,551
What could be the cause of this?
I found a blog and Metalink note about different explain plans for different users. They suggested to set optimizer_secure_view_merging='FALSE', but that didn't help.Hmmm, it runs fast again in SQL Workshop. I didn't expect that, because both the application and SQL Workshop use SYS.DBMS_SYS_SQL to parse the query.
Only the explain plan doesn't show anything.
To add: I changed the report source to the query the pl/sql function would generate, so the selects are the same in SQL Workshop and in the application. Still in the application it's horribly slow.
So, Apex does do something different in the application compared to SQL Workshop.
Edited by: InoL on Aug 5, 2011 4:50 PM -
Sub Report Performance problem
Our current software configuration is Microsoft SQL Server 2008 R2 (10.0.2531.0) where our data is housed. Our User Interface is Microsoft Visual Studio 2008 (Visual Basic) and Microsoft .NET 3.5 SP1 platform. We use Crystal Reports 2008 (12.0.0.683) to do our reporting.
We upgraded from Crystal Reports XI and our reports are taking a long time to render?... Is there any evidence of other companies experiencing this trouble? Are there any degraded performance issues when moving from XI to 2008?
In some cases we utilizing a small simple sub report.
Any help appreciated. Thanks.Hi Billy,
Subreports in detail sections are never a good idea. Example, you have 100 records returned int he main report and if that field is your subreport link it causes the subreport to run 100 times. Your database is being queried 101 times.
Also, the default time out for database is typically 1 minute, could be you need to verify your report and database so CR can "clean up" any wrong pointers.
It's always better to do the data collection server side if and when possible, after all that's what they do best.
Not much detail to go on so I can't say if it's a report design problem other than the above or not. It could be also that .NET takes time to load all of the CR assemblies so depending on how you have your app configured depends on the delay. If you load a dummy report when your starts up to pre-load CR runtime then subsequent reports will be much faster.
Also check off all of the Verify Database options, you may be telling CR to verify each time which on big databases can cause a delay also.
Thank you
Don -
Hi
My problem is with performance in reports. The reports I use is 'Reports From SQL Query' and I have the following select statement.
select * from lagffastadr
where kommun like :bind_kommun
and adrniva3 like :bind_adrniva3
and adrnr like :bind_adrnr
and adrlitt like :bind_adrlit
and :bind_show = 1
this works fine, but I have one big problem. The user may use wildcard to select all, %, this give me a new problem. The table I use contains NULL values. Then we don't get all the rows by using %, we get all that have a value. This can be solved by adding
where (kommun like :bind_kommun OR kommun IS NULL)
this will give me all the rows. But, then this will take a long time to evaluate since the sql query don't use the index that I have created. Is there another way to solve this or do I have to change all the NULL values in my database? (I rather not).
thanks
/Jvrgen SwensenIt looks more like a query tuning problem. Please try the SQL, PL/SQL forum.
You can expect a better answer there.
Thanx,
Chetan. -
Report performance problems on htmldb 1.6
Hello everybody,
I'm not a guru in both pl-sql and htmldb and I'm having slow performances on two queries, that are similar, so I think the root of the problem is the same..here they are:
This query populates a select list and takes about 2 minutes:
SELECT FLAG_VERBAL,FLAG_NUMBER
FROM DISCHARGE_FLAG
WHERE FLAG_NUMBER IN (SELECT UNIQUE(FLAG) FROM HYDRODATA
WHERE LSFLD_ID IN (SELECT ID FROM DEMO_SIMO_CGMS_UPPDANUBE_ID))This query is in a Report (SQL query Region) and takes about 100 seconds:
SELECT LSFLD_ID, MOMENT, DISCHARGE, FLAG
FROM HYDRODATA
WHERE
FLAG = to_number(:P6_DISCHARGE_TYPE)
AND LSFLD_ID IN(
SELECT ID FROM DEMO_SIMO_CGMS_UPPDANUBE_ID
AND moment >= to_date(:P6_FROM_DATE, 'yyyy-mm-dd')
AND moment <= to_date(:P6_TO_DATE, 'yyyy-mm-dd')
ORDER BY 1,2By my testing, it seems that the problem is correlated to the sub-SELECT inside the main SELECT.
If I substitute the sub-SELECT statement ( SELECT ID FROM DEMO_SIMO_CGMS_UPPDANUBE_ID) with a list of its costant values, the output of those queries appears in few seconds.
Another strange thing is that if I run alone the sub-select SELECT ID FROM DEMO_SIMO_CGMS_UPPDANUBE_ID it also takes few seconds!
So why together they need so much time??
Maybe the problem is in the table DEMO_SIMO_CGMS_UPPDANUBE_ID? It is populated by a process that:
deletes its content and
copies the selected values (by check boxes) of a previous Report :
DELETE FROM DEMO_SIMO_CGMS_UPPDANUBE_ID;
FOR I in 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
INSERT INTO DEMO_SIMO_CGMS_UPPDANUBE_ID(id) VALUES (HTMLDB_APPLICATION.G_F01(i));
END LOOP;Thanks in advance! :DThis is really a SQL question and not a HTML DB question, but I will pose some things for you to consider. Just some high-level tips without getting into the details of your queries.
1) Time your queries in SQL*Plus. I would guess that they are as slow in SQL*Plus as they are in HTML DB
2) Keep in mind that use of functions like TO_NUMBER or TO_CHAR or TO_DATE applied to database columns disables the use of indexing on columns.
3) Look to see if the columns you are joining on are indexed.
4) Use EXPLAIN PLAN and tracing to see what execution plan Oracle is taking.
5) Rewrite your queries. Join your three tables together in one SELECT statement instead of using IN's.
For example change your first query to:
SELECT FLAG_VERBAL,FLAG_NUMBER
FROM DISCHARGE_FLAG df, HYDRODATA h, EMO_SIMO_CGMS_UPPDANUBE_ID e
WHERE df.FLAG_NUMBER = h.FLAG
AND h.LSFLD_ID = e.ID
Mike -
MDM ABAP API Performance Problems
Hi all,
we developed a custom transaction into our ECC 6.0 system to remotely retreive data coming from MDM (7.1 SP05) and show them to the user. The 2 systems phisically reside in different datacenters, so running in the same WAN but in 2 different AD domains and 2 different ip networks.
In short the transaction is working using the standard MDM ABAP API functionalities and getting the MDM data using the following methods:
CALL METHOD lr_api->mo_accessor->connect
CALL METHOD lr_api->mo_core_service->query
CALL METHOD lr_api->mo_core_service->retrieve
CALL METHOD lr_api->mo_accessor->disconnect.
This is working, but with awful performances. for example to get a subset of materials (around 500 codes) it takes more than 1 minute, and the quantity of data transfered from MDM to ECC (around 30 KB) is not justifying this time.
Please be so kind to suggest any kind of activity that I can perform to improve the situation.
Thanks in advance.I am trying to retreieve date from MDM to ECC using ABAP API.I am getting the below dump.
Short text
An exception occurred that was not caught.
What happened?
The exception 'CX_MDM_PROVIDER' was raised, but it was not
along
the call hierarchy.
Since exceptions represent error situations and this error
adequately responded to, the running ABAP program
'CL_MDM_PROVIDER_71_SP00_PL00==CP' has to be
terminated.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can loo
at and manage termination messages, and you can also
keep them for a long time.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_MDM_PROVIDER', was not caught in
procedure "GET_LOC_SUPP" "(METHOD)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Internal error: field 'SEARCH_GROUPS' not found; contact your system
administrator
Please check at this point I am getting dump:
LT_SEARCH_TUPLE_PATH
Table IT_1806[0x12]
\CLASS=CL_MDM_PROVIDER_71_SP00_PL00\METHOD=IF_MDM_CORE_SERVICES~QUERY\DATA=LT_SEARCH_TUPLE_PAT
Table reference: 1612
TABH+ 0(20) = 000000000000000007000000579D710000000000
TABH+ 20(20) = 0000064C0000070E000000000000000CFFFFFFFF
TABH+ 40(16) = 04000138000F44A0000424E403000000
store = 0x0000000000000000
ext1 = 0x07000000579D7100
shmId = 0 (0x00000000)
id = 1612 (0x0000064C)
label = 1806 (0x0000070E)
fill = 0 (0x00000000)
leng = 12 (0x0000000C)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000300
occu = 4 (0x00000004)
accKind = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniNo)
keyKind = 1 (default)
cmpMode = 12 (ILLEGAL)
occu0 = 1
stMode = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
isUsed = 1
isCtfyAble = 1
hasScndKeys = 0
hasRowId = 0
scndKeysOutdated = 0
scndUniKeysOutdated = 0
LV_MESS
field 'SEARCH_GROUPS' not found
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
6666622544544545455522667266766222222222222222222222222222222222222222222222222222222222222222
695C407351238F72F50370EF406F5E4000000000000000000000000000000000000000000000000000000000000000
SY-REPID
I am picking the data from MAIN TABLE MDM_SUPPLIER_MAP and below is the code.
CALL METHOD lv_mdm_api->mo_core_service->query
EXPORTING
*Main Table
iv_object_type_code = 'MDM_SUPPLIER_MAP' "#EC NOTEXT
* it_query = lt_query
IMPORTING
et_result_set = lt_result_set.
Please suggest solution to get the records from MDM to ECC.
When I am tring to replace the abpove with the below code it is working.But in this case I need to retreive all the data instead of using DO and ENDO.Could any please suggest solution.
DO 10 TIMES.
APPEND sy-index TO keys.
ENDDO.
CALL METHOD lv_mdm_api->mo_core_service->retrieve_simple
EXPORTING
iv_object_type_code = 'MDM_SUPPLIER_MAP'
it_keys = keys
IMPORTING
et_ddic_structure = result_ddic -
PowerPivot report performance problem on Sharepoint
Hi everybody,
I have created a PowerPivot report based on SQL Server tables.
When I use this report on my computer the response time are really good.
I get data from two different table which are linked by an integer key in my model.
It means that in my pivot I chose my fields in two different "tables"
Let say I select 10 fields in one table and 2 in the other one
When I put it on the Sharepoint Server the report is not correctly loaded.
When I put calculated columns into my first table and use lookup to get the 2 fields from my second table the performance are far better and the report works on Sharepoint.
I don't understand why.
Any idea?
Thanks
Pete
P.S: I work on PowerPivot for Excel 2010 and SP 2010 ServerThis is an issue my client is having at the moment. As of right now they are going through a MS ticket to resolve it. Will update when I hear more.
-Link -
HR ABAP- Report Performance Issue
Can you please any body tell me how to debug a report program by putting watch points and break points.
Waiting for your Reply.
Anu
BangaloreHi,
If you have programm name then proceed with SE38 or take the programm name from Trasaction code which you are using.
Break Points: If it is performance issue , put external break points around select querie and loop ---end loop.
Watch Points : in the debug screen choose the watch point option and give the field name from your internal table for which you want to put watch point.
After that give the range which you record you want to see in the range options.
for these steps: 1. Execute your programm.
2. In the selection screen enter /h in the command window to start debugging screen or put break points before excuting.
3. Once you are in debug screen then start woring with F5 or F6 or F7 and create watch points where ever you like. -
Interactive report performance problem over database link
Hi gurus,
I have an interactive report that retrieves values from two joined tables both placed on the same remote database. It takes 45 seconds to populate (refresh) a page after issuing a search. If I catch the actual select that is generated by apex ( the one with count(*) over ()...) and run it from sql environment, it takes 1 or 2 seconds. What on earth does consume the rest of the time and how to speed this up? I would like to awoid creating and maintaining local materialized views if possible.
Regards
SamoHi
APEX normally needs to return the full result set for the purposes of pagination (where you have it set to something along the lines of show x-y of z), changing this or the max row count can affect performance greatly.
The driving site hint would need to refer to the name of the view, but can be a bit temperamental with this kind of thing. The materialize hint only works for sub-factored queries (in a 'WITH blah AS(SELECT /*+ MATERIALIZE */ * FROM etc. etc.)). They tend to materialize anyway and its best not to use hints like that for production code unless there is absolutely no other option, but just sub factoring without hints can often have a profound effect on performance. For instance
WITH a AS
SELECT c1,
c2,
c3,
c4,
c5
FROM schema1.view1)
, b AS
SELECT c1,
c2,
c3
FROM schema1.view2)
SELECT *
FROM a, b
WHERE a.c5 = b.c3May produce a different plan or even just sub factoring one of the external tables may have an effect.
You need to try things out here and experiment and keep looking at the execution plans. You should also change Toads row fetch setting to be all 9's to get a real idea of performance.
Let me know how you get on.
Cheers
Ben
http://www.munkyben.wordpress.com
Don't forget to mark replies helpful or correct ;)
Edited by: Munky on Sep 29, 2009 1:41 PM -
I have a report that contains 17 queries, which populate 17 layouts. As you can imagine, it is very slow. It takes about a minute before the report will display on the client PC. In a form which calls this report I have a pl/sql routine that populates some display fields with the same data as the report. This pl/sql trigger returns the data in under a second. What am I doing wrong in the report? How can I improve the performance of the report and thereby shorten the execution time? Please help. Thanks in advance.
Richard,
This is difficult to say because a lot depends on the complexity of the queries and the complexity of the layouts. There are some statistics you can gather from Reports by using the trace profile command (see the online help or the following document for syntax). Download the "Tuning Oracle Reports" from the Reports product page here at OTN. Here is the link http://technet.oracle.com/products/reports/pdf/275641.pdf
The will give you some ideas on how to improve performance of your Report and Thanks for using Oracle Reports.
Regards,
The Oracle Reports Team. -
Hi Friends,
I created a report with 45 ref.cursors,
All ref.cursors are in a Package,
The package is in Database side.
The report is report server.
IF i start to run the report through application
the report is taking 50% of cpu memory around 40 seconds.
is this report performance problem ?
if i have more ref.cursors in report
is there any problem in report performance ?
Can somebody help me ?One performance consideration I'd do is try to avoid multiple similar queries or even repeats of the same query.
Is
from invoice
where trunc(invoice_date) between :date1 and :date2
and currency_code = '$' -- sometimes 'euro' and so no
and ISSUE_PLACE = 'xx'
and investor_code = :investor_code;
return(v_comm*5.5137);
in main query? Can those Formulas be included/replaced into the main query? Are appropriate Indexes created for the joins? -
Serious Performance Problems in ABAP Reports
Hi All,
We are developing ABAP reports for SAP IS-U/CCS Modules and facing Performance issues.Whole scenario is given below.Please suggest some solution.
1. Total No. Of Business Partners = 1500000
2. Reports Selection Criteria are of two types:
a) GSBER(Business Area) - Selection for atleast 200000 Business Partners
b) Cokey(Division) - Selection for around 1000 to 50000 Business Partners
3. For implementing our reports logic we have to access several tables all of which are very large.They are :
Table Name No. of records (Appx)
DBERCHV 20000000
DBERCHZ1 20000000
DBERDLB 20000000
DFKKKO 20000000
DFKKOP 20000000
EANLH 4000000
ERCH 10000000
ERCHC 10000000
ETTIFN 30000000
EVER 1500000
FKKVKP 1500000
TECOKT 500
TGSBT 12
4. Due to large no. of records we are facing problems at two levels:
a) OpenSQL Statement is taking too much time for data selection
b) Since large no. of records are selected Corresponding loops and data processing also takes much time
5. We have tried almost all ABAP Performance optimization techniques such as using Index, SQL optimization techniques,Read Table Optimization, Loop Statement Optimization etc. but there is not much improvement.
6. For example one of our Reports "R15" takes around 1500 seconds for 1000 Business Partners.
Its Code is attached below:
<b>a) ZISU_SCHL_LTR15_BAPI - Program which schedules actual R15 report in background</b>
*& Report ZISU_SCHL_LTR15_BAPI *
*& Developed By : Piyusha Kirwai *
*& Date : 02/12/2005 *
*& Purpose : To Schedule the LT R 15 prog in background and store
*& the File for Manual R-15 into server.
REPORT ZISU_SCHL_LTR15_BAPI NO STANDARD PAGE HEADING.
TABLES ZEVERFKKVKP.
DATA: DYFIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE.
DATA: IT_TAB TYPE FILETABLE,
GD_SUBRC TYPE I.
DATA: LV_GSBER TYPE TGSBT-GSBER.
RANGES R_COKEY FOR ZEVERFKKVKP-COKEY.
DATA: BEGIN OF GT_TECOKT OCCURS 100,
COKEY TYPE TECOKT-COKEY,
LTEXT TYPE TECOKT-LTEXT,
END OF GT_TECOKT,
BEGIN OF GT_TE422 OCCURS 100,
TERMSCHL TYPE TE422-TERMSCHL,
TERMTEXT TYPE TE422-TERMTEXT,
END OF GT_TE422.
DATA: BEGIN OF GWA_MANUAL_DATA,
COL_1(5) TYPE C,
COL_2(10) TYPE C,
COL_3(40) TYPE C,
COL_4(40) TYPE C,
COL_5(10) TYPE C,
COL_6(19) TYPE C,
COL_7(19) TYPE C,
COL_8(19) TYPE C,
COL_9(19) TYPE C,
COL_10(19) TYPE C,
COL_11(19) TYPE C,
COL_12(10) TYPE C,
COL_13(19) TYPE C,
COL_14(19) TYPE C,
COL_15(19) TYPE C,
COL_16(19) TYPE C,
COL_17(19) TYPE C,
COL_18(19) TYPE C,
END OF GWA_MANUAL_DATA,
GT_MANUAL_DATA LIKE GWA_MANUAL_DATA OCCURS 0,
GT_INTERN_DATA TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*&-----FOR UPLOADING FILE TO SERVER------------------------------------*
DATA: LV_SERVER_FILE_PREFIX(60) TYPE C.
DATA: LV_SERVER_DATAFILE_NAME(60) TYPE C.
DATA: LV_SERVER_ERRFILE_NAME(60) TYPE C.
DATA: ENDT LIKE SY-UZEIT,
ENDD LIKE SY-DATUM,
JOBCOUNT TYPE TBTCJOB-JOBCOUNT.
SELECTION-SCREEN BEGIN OF BLOCK 001 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: SO_GSBER FOR ZEVERFKKVKP-GSBER OBLIGATORY,
SO_COKEY FOR ZEVERFKKVKP-COKEY OBLIGATORY,
SO_MRU FOR ZEVERFKKVKP-ABLEINH.
PARAMETERS: P_BMNTH(7) TYPE C OBLIGATORY.
SELECT-OPTIONS: SO_GPART FOR ZEVERFKKVKP-GPART.
SELECTION-SCREEN END OF BLOCK 001.
SELECTION-SCREEN BEGIN OF BLOCK 002 WITH FRAME TITLE TEXT-003.
PARAMETERS: P_COMPUT RADIOBUTTON GROUP R15,
P_INCLUD RADIOBUTTON GROUP R15,
P_FILE TYPE RLGRAP-FILENAME MODIF ID ACT.
SELECTION-SCREEN END OF BLOCK 002.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(83) TEXT-004.
SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
* SELECTION-SCREEN COMMENT 8(40) TEXT-005.
*SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK 003 WITH FRAME TITLE TEXT-002.
PARAMETERS P_SCHL TYPE C AS CHECKBOX.
PARAMETERS : P_IMMED RADIOBUTTON GROUP SCH ,
P_DT_TM RADIOBUTTON GROUP SCH,
P_DATE TYPE SY-DATUM MODIF ID SHL,
P_TIME TYPE SY-UZEIT MODIF ID SHL.
SELECTION-SCREEN END OF BLOCK 003.
AT SELECTION-SCREEN.
AT SELECTION-SCREEN ON SO_GSBER.
IF NOT SO_GSBER-LOW IS INITIAL.
SELECT SINGLE GSBER FROM TGSBT INTO LV_GSBER
WHERE GSBER = SO_GSBER-LOW.
IF SY-SUBRC <> 0.
MESSAGE E007(ZISU).
ENDIF.
ENDIF.
IF NOT SO_GSBER-HIGH IS INITIAL .
SELECT SINGLE GSBER FROM TGSBT INTO LV_GSBER
WHERE GSBER = SO_GSBER-HIGH.
IF SY-SUBRC <> 0.
MESSAGE E007(ZISU).
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON P_BMNTH.
**check the validity of Billing month format and for valid billing month
IF P_BMNTH CO '0123456789/'.
IF P_BMNTH CP '++++/++'.
IF P_BMNTH+5(2) > 12.
MESSAGE E002(ZISU) WITH 'from'.
ENDIF.
** current year is less than year entered
IF SY-DATUM(4) < P_BMNTH(4).
MESSAGE E003(ZISU) WITH 'from'.
ELSEIF SY-DATUM(4) = P_BMNTH(4).
** month in future
IF SY-DATUM+4(2) < P_BMNTH+5(2).
MESSAGE E004(ZISU) WITH 'from'.
ENDIF.
ENDIF.
ELSE.
MESSAGE E001(ZISU) WITH 'from'.
ENDIF.
ELSE.
** entry have some invalid char
MESSAGE E010(ZISU).
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-LOW.
**for geting the CO account assigment key of the entered Business area
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-HIGH.
**for geting the CO account assigment key of the entered Business area
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_MRU-LOW.
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM MRU_DATA_GET CHANGING SO_MRU-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_MRU-HIGH.
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM MRU_DATA_GET CHANGING SO_MRU-HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
REFRESH: IT_TAB.
**Opens File Open Dialog Box for selecting input file.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Select File'
DEFAULT_FILENAME = '*.xls'
MULTISELECTION = ' '
CHANGING
FILE_TABLE = IT_TAB
RC = GD_SUBRC.
LOOP AT IT_TAB INTO P_FILE.
* so_fpath-sign = 'I'.
* so_fpath-option = 'EQ'.
* append so_fpath.
ENDLOOP.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'ACT'.
IF P_INCLUD = ' '.
SCREEN-INPUT = '0'.
ELSE.
SCREEN-INPUT = '1'.
ENDIF.
ENDIF.
IF SCREEN-GROUP1 = 'SHL'.
IF P_DT_TM = 'X'.
SCREEN-INPUT = '1'.
ELSE.
SCREEN-INPUT = '0'.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
INITIALIZATION.
P_DATE = SY-DATUM.
P_TIME = SY-UZEIT + 180.
START-OF-SELECTION.
IF P_INCLUD = 'X' AND P_FILE IS INITIAL.
MESSAGE 'Enter the Manual R-15 File' TYPE 'E'.
ENDIF.
* IF P_INCLUD = 'X'.
* PERFORM UPLOAD_EXCEL_FILE.
* CONCATENATE 'R15' SY-DATUM '-' SY-UZEIT INTO LV_SERVER_FILE_PREFIX.
* CONCATENATE LV_SERVER_FILE_PREFIX '-' 'LT.TMP' INTO
* LV_SERVER_DATAFILE_NAME.
* OPEN DATASET LV_SERVER_DATAFILE_NAME
* FOR OUTPUT
* IN TEXT MODE
* ENCODING DEFAULT.
* LOOP AT GT_MANUAL_DATA INTO GWA_MANUAL_DATA.
* IF ( GWA_MANUAL_DATA-COL_6 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_7 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_8 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_9 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_10 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_11 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_13 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_14 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_15 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_16 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_17 CN '0123456789 '
* AND GWA_MANUAL_DATA-COL_18 CN '0123456789 ' ).
* MESSAGE 'Character Data in Numerical Field' TYPE 'E'.
* ENDIF.
* TRANSFER GWA_MANUAL_DATA TO LV_SERVER_DATAFILE_NAME.
* ENDLOOP.
* CLOSE DATASET LV_SERVER_DATAFILE_NAME.
* ENDIF. " P_INCLUD = 'X'.
IF P_SCHL = 'X'.
IF P_IMMED = 'X'.
CALL FUNCTION 'C14B_ADD_TIME'
EXPORTING
I_STARTTIME = SY-UZEIT
I_STARTDATE = SY-DATUM
I_ADDTIME = '000010'
IMPORTING
E_ENDTIME = ENDT
E_ENDDATE = ENDD.
ELSEIF P_DT_TM = 'X'.
ENDD = P_DATE.
ENDT = P_TIME.
ENDIF.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
* DELANFREP = ' '
* JOBGROUP = ' '
JOBNAME = 'R15JOB'
* SDLSTRTDT = ENDD
* SDLSTRTTM = ENDT
* JOBCLASS =
IMPORTING
JOBCOUNT = JOBCOUNT
* CHANGING
* RET =
* EXCEPTIONS
* CANT_CREATE_JOB = 1
* INVALID_JOB_DATA = 2
* JOBNAME_MISSING = 3
* OTHERS = 4
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF P_INCLUD = 'X'.
PERFORM UPLOAD_EXCEL_FILE.
CONCATENATE 'R15' SY-DATUM '-' SY-UZEIT INTO LV_SERVER_FILE_PREFIX.
CONCATENATE LV_SERVER_FILE_PREFIX '-' JOBCOUNT 'LT.TMP' INTO
LV_SERVER_DATAFILE_NAME.
CONDENSE LV_SERVER_DATAFILE_NAME.
OPEN DATASET LV_SERVER_DATAFILE_NAME
FOR OUTPUT
IN TEXT MODE
ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE 'Error in Creating File on Server' TYPE 'E'.
ENDIF.
LOOP AT GT_MANUAL_DATA INTO GWA_MANUAL_DATA.
IF ( GWA_MANUAL_DATA-COL_6 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_7 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_8 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_9 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_10 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_11 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_13 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_14 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_15 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_16 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_17 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_18 CN '0123456789 ' ).
MESSAGE 'Character Data in Numerical Field' TYPE 'E'.
ENDIF.
TRANSFER GWA_MANUAL_DATA TO LV_SERVER_DATAFILE_NAME.
ENDLOOP.
CLOSE DATASET LV_SERVER_DATAFILE_NAME.
IF SY-SUBRC NE 0.
MESSAGE 'Error in Creating File on Server' TYPE 'E'.
ENDIF.
ENDIF. " P_INCLUD = 'X'.
SUBMIT ZISU_LTR15_TUNE
WITH SO_GSBER IN SO_GSBER
WITH SO_COKEY IN SO_COKEY
WITH SO_MRU IN SO_MRU
WITH SO_GPART IN SO_GPART
WITH P_BMNTH = P_BMNTH
WITH P_COMPUT = P_COMPUT
WITH P_INCLUD = P_INCLUD
WITH P_FILE = LV_SERVER_DATAFILE_NAME
USER SY-UNAME VIA JOB 'R15JOB' NUMBER JOBCOUNT AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
* AT_OPMODE = ' '
* AT_OPMODE_PERIODIC = ' '
* CALENDAR_ID = ' '
* EVENT_ID = ' '
* EVENT_PARAM = ' '
* EVENT_PERIODIC = ' '
JOBCOUNT = JOBCOUNT
JOBNAME = 'R15JOB'
* LASTSTRTDT = NO_DATE
* LASTSTRTTM = NO_TIME
* PRDDAYS = 0
* PRDHOURS = 0
* PRDMINS = 0
* PRDMONTHS = 0
* PRDWEEKS = 0
* PREDJOB_CHECKSTAT = ' '
* PRED_JOBCOUNT = ' '
* PRED_JOBNAME = ' '
SDLSTRTDT = ENDD
SDLSTRTTM = ENDT
* STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
STRTIMMED = P_IMMED
* TARGETSYSTEM = ' '
* START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
* START_ON_WORKDAY_NR = 0
* WORKDAY_COUNT_DIRECTION = 0
* RECIPIENT_OBJ =
* TARGETSERVER = ' '
* DONT_RELEASE = ' '
* TARGETGROUP = ' '
* DIRECT_START =
* IMPORTING
* JOB_WAS_RELEASED =
* CHANGING
* RET =
* EXCEPTIONS
* CANT_START_IMMEDIATE = 1
* INVALID_STARTDATE = 2
* JOBNAME_MISSING = 3
* JOB_CLOSE_FAILED = 4
* JOB_NOSTEPS = 5
* JOB_NOTEX = 6
* LOCK_FAILED = 7
* INVALID_TARGET = 8
* OTHERS = 9
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE. " IF NOT TO RUN IN BACKGROUND
IF P_INCLUD = 'X'.
PERFORM UPLOAD_EXCEL_FILE.
CONCATENATE 'R15' SY-DATUM '-' SY-UZEIT INTO LV_SERVER_FILE_PREFIX.
CONCATENATE LV_SERVER_FILE_PREFIX '-' 'LT.TMP' INTO
LV_SERVER_DATAFILE_NAME.
CONDENSE LV_SERVER_DATAFILE_NAME.
OPEN DATASET LV_SERVER_DATAFILE_NAME
FOR OUTPUT
IN TEXT MODE
ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE 'Error in Creating File on Server' TYPE 'E'.
ENDIF.
LOOP AT GT_MANUAL_DATA INTO GWA_MANUAL_DATA.
IF ( GWA_MANUAL_DATA-COL_6 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_7 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_8 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_9 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_10 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_11 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_13 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_14 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_15 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_16 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_17 CN '0123456789 '
AND GWA_MANUAL_DATA-COL_18 CN '0123456789 ' ).
MESSAGE 'Character Data in Numerical Field' TYPE 'E'.
ENDIF.
TRANSFER GWA_MANUAL_DATA TO LV_SERVER_DATAFILE_NAME.
ENDLOOP.
CLOSE DATASET LV_SERVER_DATAFILE_NAME.
IF SY-SUBRC NE 0.
MESSAGE 'Error in Creating File on Server' TYPE 'E'.
ENDIF.
ENDIF. " P_INCLUD = 'X'.
IF NOT SY-BATCH IS INITIAL.
SUBMIT ZISU_LTR15_TUNE
WITH SO_GSBER IN SO_GSBER
WITH SO_COKEY IN SO_COKEY
WITH SO_MRU IN SO_MRU
WITH SO_GPART IN SO_GPART
WITH P_BMNTH = P_BMNTH
WITH P_COMPUT = P_COMPUT
WITH P_INCLUD = P_INCLUD
WITH P_FILE = LV_SERVER_DATAFILE_NAME
TO SAP-SPOOL WITHOUT SPOOL DYNPRO.
ELSE.
SUBMIT ZISU_LTR15_TUNE
WITH SO_GSBER IN SO_GSBER
WITH SO_COKEY IN SO_COKEY
WITH SO_MRU IN SO_MRU
WITH SO_GPART IN SO_GPART
WITH P_BMNTH = P_BMNTH
WITH P_COMPUT = P_COMPUT
WITH P_INCLUD = P_INCLUD
WITH P_FILE = LV_SERVER_DATAFILE_NAME.
ENDIF.
ENDIF.
*& Form divison_data_get
* text
* <--P_SO_COKEY_LOW text
FORM DIVISON_DATA_GET CHANGING P_SO_COKEY_LOW.
**to get the search help for division
DATA : LV_LINES TYPE SY-TFILL,
LT_RETURN_TAB LIKE DDSHRETVAL OCCURS 0, " with header line.
LWA_RETURN_TAB LIKE DDSHRETVAL.
DATA: LV_COKEY TYPE ZEVERFKKVKP-COKEY.
**according to the Business area entered]
* break csebdev1.
REFRESH R_COKEY[].
DESCRIBE TABLE SO_GSBER LINES LV_LINES.
** when user has neither pressed the enter key nor selected the values
**using search help
IF LV_LINES = 0.
* loop at so_gsber.
CLEAR R_COKEY.
* if so_gsber-high is initial.
* break csebdev1.
DYFIELDS-FIELDNAME = 'SO_GSBER-LOW'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS.
* r_cokey-sign = 'I'.
* r_cokey-option = 'CP'.
*r_cokey-low = so_gsber-low+0(2).
CONCATENATE DYFIELDS-FIELDVALUE+0(2) '*' INTO R_COKEY-LOW.
* elseif not so_gsber-high is initial.
DYFIELDS-FIELDNAME = 'SO_GSBER-HIGH'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS.
IF NOT DYFIELDS-FIELDVALUE IS INITIAL.
CONCATENATE DYFIELDS-FIELDVALUE+0(2) '99999999' INTO R_COKEY-HIGH.
ENDIF.
* endif.
IF NOT R_COKEY-HIGH IS INITIAL.
R_COKEY-SIGN = 'I'.
R_COKEY-OPTION = 'BT'.
ELSEIF R_COKEY-HIGH IS INITIAL.
R_COKEY-SIGN = 'I'.
R_COKEY-OPTION = 'CP'.
ENDIF.
APPEND R_COKEY.
ENDIF.
* endloop.
* APPEND DYFIELDS.
IF LV_LINES > 0.
* break-point.
IF NOT SO_GSBER[] IS INITIAL.
LOOP AT SO_GSBER.
* r_cokey-sign = 'I'.
* r_cokey-option = 'CP'.
*r_cokey-low = so_gsber-low+0(2).
CONCATENATE SO_GSBER-LOW+0(2) '*' INTO R_COKEY-LOW.
IF NOT SO_GSBER-HIGH IS INITIAL.
CONCATENATE SO_GSBER-HIGH+0(2) '99999999' INTO R_COKEY-HIGH.
ENDIF.
IF NOT R_COKEY-HIGH IS INITIAL.
R_COKEY-SIGN = 'I'.
R_COKEY-OPTION = 'BT'.
ELSEIF R_COKEY-HIGH IS INITIAL.
R_COKEY-SIGN = 'I'.
R_COKEY-OPTION = 'CP'.
ENDIF.
APPEND R_COKEY TO R_COKEY.
ENDLOOP.
ENDIF.
ENDIF.
IF NOT R_COKEY[] IS INITIAL.
* break csebdev1.
REFRESH GT_TECOKT[].
SELECT COKEY LTEXT
FROM TECOKT
INTO TABLE GT_TECOKT
WHERE COKEY IN R_COKEY AND SPRAS = 'EN'.
* %_HINTS ORACLE '("TECOKT","TECOKT~1")'.
ENDIF.
**now call the search help
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
RETFIELD = 'COKEY'
* PVALKEY = ' '
* DYNPPROG = ' '
* DYNPNR = ' '
* DYNPROFIELD = ' '
* STEPL = 0
WINDOW_TITLE = 'Division'
VALUE = DYFIELDS-FIELDVALUE
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
VALUE_TAB = GT_TECOKT
* FIELD_TAB =
RETURN_TAB = LT_RETURN_TAB
* DYNPFLD_MAPPING =
* EXCEPTIONS
* PARAMETER_ERROR = 1
* NO_VALUES_FOUND = 2
* OTHERS = 3
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE LT_RETURN_TAB INTO LWA_RETURN_TAB INDEX 1.
LV_COKEY = LWA_RETURN_TAB-FIELDVAL.
*break csebdev1.
ENDFORM. " divison_data_get
*& Form upload_excel_file
* text
* --> p1 text
* <-- p2 text
FORM UPLOAD_EXCEL_FILE .
DATA: LV_INDEX TYPE I.
FIELD-SYMBOLS <VAL> TYPE ANY.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 8
I_END_COL = 18
I_END_ROW = 94
TABLES
INTERN = GT_INTERN_DATA
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF NOT GT_INTERN_DATA[] IS INITIAL.
SORT GT_INTERN_DATA BY ROW COL.
LOOP AT GT_INTERN_DATA.
MOVE GT_INTERN_DATA-COL TO LV_INDEX.
ASSIGN COMPONENT LV_INDEX OF STRUCTURE GWA_MANUAL_DATA TO <VAL>.
MOVE GT_INTERN_DATA-VALUE TO <VAL>.
AT END OF ROW.
APPEND GWA_MANUAL_DATA TO GT_MANUAL_DATA.
CLEAR GWA_MANUAL_DATA.
ENDAT.
ENDLOOP.
ENDIF.
ENDFORM. " upload_excel_file
*& Form MRU_DATA_GET
* text
* <--P_SO_MRU_LOW text
FORM MRU_DATA_GET CHANGING LV_MRU.
**to get the search help for Group
DATA : LV_LINES TYPE SY-TFILL,
LT_RETURN_TAB LIKE DDSHRETVAL OCCURS 0,
LWA_RETURN_TAB LIKE DDSHRETVAL.
* lv_mru_p(3) type c.
RANGES R_MRU FOR EANLH-ABLEINH.
**according to the Business area entered
** break csebdev1.
REFRESH R_MRU[].
DESCRIBE TABLE SO_GSBER LINES LV_LINES.
** when user has neither pressed the enter key nor selected the values
**using search help
IF LV_LINES = 0.
CLEAR R_MRU[].
DYFIELDS-FIELDNAME = 'SO_GSBER-LOW'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS.
CONCATENATE DYFIELDS-FIELDVALUE+0(2) '*' INTO R_MRU-LOW.
DYFIELDS-FIELDNAME = 'SO_GSBER-HIGH'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS.
IF NOT DYFIELDS-FIELDVALUE IS INITIAL.
CONCATENATE DYFIELDS-FIELDVALUE+0(2) '99999999' INTO R_MRU-HIGH.
ENDIF.
IF NOT R_MRU-HIGH IS INITIAL.
R_MRU-SIGN = 'I'.
R_MRU-OPTION = 'BT'.
ELSEIF R_MRU-HIGH IS INITIAL.
R_MRU-SIGN = 'I'.
R_MRU-OPTION = 'CP'.
ENDIF.
APPEND R_MRU.
ENDIF. " end lv_lines =0
IF LV_LINES > 0.
IF NOT SO_GSBER[] IS INITIAL.
LOOP AT SO_GSBER.
CONCATENATE SO_GSBER-LOW+0(2) '*' INTO R_MRU-LOW.
IF NOT SO_GSBER-HIGH IS INITIAL.
CONCATENATE SO_GSBER-HIGH+0(2) '99999999' INTO R_MRU-HIGH.
ENDIF.
IF R_MRU-HIGH IS INITIAL.
R_MRU-SIGN = 'I'.
R_MRU-OPTION = 'CP'.
ELSEIF NOT R_MRU-HIGH IS INITIAL.
R_MRU-SIGN = 'I'.
R_MRU-OPTION = 'BT'.
ENDIF.
APPEND R_MRU.
ENDLOOP.
ENDIF. " end so_GSBER[]
ENDIF. " end lv_lines > 0
IF NOT R_MRU[] IS INITIAL.
* break csebdev1.
REFRESH GT_TE422[].
SELECT TERMSCHL TERMTEXT FROM TE422 INTO CORRESPONDING FIELDS OF
TABLE GT_TE422 WHERE TERMSCHL IN R_MRU .
ENDIF.
**now call the search help
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
RETFIELD = 'TERMSCHL'
* PVALKEY = ' '
* DYNPPROG = ' '
* DYNPNR = ' '
* DYNPROFIELD = ' '
* STEPL = 0
WINDOW_TITLE = 'Group'
VALUE = DYFIELDS-FIELDVALUE
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
VALUE_TAB = GT_TE422
* FIELD_TAB =
RETURN_TAB = LT_RETURN_TAB
* DYNPFLD_MAPPING =
* EXCEPTIONS
* PARAMETER_ERROR = 1
* NO_VALUES_FOUND = 2
* OTHERS = 3
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE LT_RETURN_TAB INTO LWA_RETURN_TAB INDEX 1.
LV_MRU = LWA_RETURN_TAB-FIELDVAL.
ENDFORM. " MRU_DATA_GET
<b>b) ZISU_LTR15_TUNE - Actual R15 report</b>
*& Report ZISU_LTR15_TUNE *
REPORT ZISU_LTR15_TUNE NO STANDARD PAGE HEADING MESSAGE-ID ZISU
LINE-SIZE 250 LINE-COUNT 65.
**Tables
TABLES : EVER,
FKKVKP,
EANLH.
SELECTION-SCREEN BEGIN OF BLOCK SELECTION
WITH FRAME TITLE TEXT-001 . "no intervals.
SELECT-OPTIONS: SO_GSBER FOR EVER-GSBER OBLIGATORY,
SO_COKEY FOR EVER-COKEY,
SO_MRU FOR EANLH-ABLEINH.
PARAMETERS: P_BMNTH(7) TYPE C OBLIGATORY.
PARAMETERS: P_CONT TYPE EVER-VERTRAG.
SELECT-OPTIONS: SO_GPART FOR FKKVKP-GPART.
SELECTION-SCREEN END OF BLOCK SELECTION.
SELECTION-SCREEN BEGIN OF BLOCK PROCESS WITH FRAME.
PARAMETERS: P_COMPUT RADIOBUTTON GROUP R15.
PARAMETERS: P_INCLUD RADIOBUTTON GROUP R15,
P_FILE(60) TYPE C.
SELECTION-SCREEN END OF BLOCK PROCESS.
* Start of Type declaration
TYPES: BEGIN OF ST_TB024 ,
IND_SECTOR TYPE TB024-IND_SECTOR,
TEXTLONG TYPE TB024-TEXTLONG,
END OF ST_TB024,
BEGIN OF ST_TECOKT,
COKEY TYPE TECOKT-COKEY,
LTEXT TYPE TECOKT-LTEXT,
END OF ST_TECOKT,
BEGIN OF ST_TGSBT,
GSBER TYPE TGSBT-GSBER,
GTEXT TYPE TGSBT-GTEXT,
END OF ST_TGSBT,
BEGIN OF ST_TE422,
TERMSCHL TYPE TE422-TERMSCHL,
TERMTEXT TYPE TE422-TERMTEXT,
END OF ST_TE422.
* Start of data declaration
DATA: IT_TAB TYPE FILETABLE,
GD_SUBRC TYPE I.
DATA : GT_TB024 TYPE STANDARD TABLE OF ST_TB024 WITH HEADER LINE
INITIAL SIZE 0,
GT_TECOKT TYPE STANDARD TABLE OF ST_TECOKT
WITH HEADER LINE,
GT_TGSBT TYPE SORTED TABLE OF ST_TGSBT
WITH UNIQUE KEY GSBER WITH HEADER LINE,
GT_TE422 TYPE TABLE OF ST_TE422 WITH HEADER LINE INITIAL SIZE 0,
BEGIN OF GWA_EVER,
VKONT TYPE EVER-VKONTO,
ANLAGE TYPE EVER-ANLAGE,
ABRSPERR TYPE EVER-ABRSPERR,
END OF GWA_EVER,
GT_EVER LIKE TABLE OF GWA_EVER INITIAL SIZE 0,
BEGIN OF GWA_EANLH,
ANLAGE TYPE EANLH-ANLAGE,
BRANCHE TYPE EANLH-BRANCHE,
END OF GWA_EANLH,
GT_EANLH LIKE TABLE OF GWA_EANLH INITIAL SIZE 0,
BEGIN OF GWA_FKKVKP,
VKONT TYPE FKKVKP-VKONT,
KTOKL TYPE FKKVKP-KTOKL,
END OF GWA_FKKVKP,
GT_FKKVKP LIKE TABLE OF GWA_FKKVKP INITIAL SIZE 0,
BEGIN OF GWA_EVER_EANLH_FKKVKP,
VKONT TYPE FKKVKP-VKONT,
ANLAGE TYPE EVER-ANLAGE,
ABRSPERR TYPE EVER-ABRSPERR,
BRANCHE TYPE EANLH-BRANCHE,
KTOKL TYPE FKKVKP-KTOKL,
END OF GWA_EVER_EANLH_FKKVKP,
GT_EVER_EANLH_FKKVKP LIKE TABLE OF GWA_EVER_EANLH_FKKVKP
INITIAL SIZE 0,
GT_EVER_EANLH_FKKVKP_INACT LIKE STANDARD TABLE OF
GWA_EVER_EANLH_FKKVKP INITIAL SIZE 0,
BEGIN OF GWA_ERCH,
BELNR TYPE ERCH-BELNR,
VKONT TYPE ERCH-VKONT,
END OF GWA_ERCH,
GT_ERCH LIKE TABLE OF GWA_ERCH INITIAL SIZE 0,
BEGIN OF GWA_PRINTDOC,
OPBEL TYPE ERDK-OPBEL,
GPART TYPE ERDK-PARTNER,
VKONT TYPE ERDK-VKONT,
BUDAT TYPE ERDK-BUDAT,
FAEDN TYPE ERDK-FAEDN,
END OF GWA_PRINTDOC,
GT_PRINTDOC LIKE TABLE OF GWA_PRINTDOC INITIAL SIZE 0,
BEGIN OF GWA_DBERCHZ1,
BELNR TYPE DBERCHZ1-BELNR,
EIN01 TYPE DBERCHZ1-EIN01,
V_ABRMENGE TYPE DBERCHZ1-V_ABRMENGE,
END OF GWA_DBERCHZ1,
GT_DBERCHZ1 LIKE TABLE OF GWA_DBERCHZ1 INITIAL SIZE 0,
BEGIN OF GWA_ERCHC,
BELNR TYPE ERCHC-BELNR,
OPBEL TYPE ERCHC-OPBEL,
BUDAT TYPE ERCHC-BUDAT,
END OF GWA_ERCHC,
GT_ERCHC LIKE TABLE OF GWA_ERCHC INITIAL SIZE 0,
* arrears for inactive consumers.
BEGIN OF GWA_DFKKOP_INACTIVE_ARR,
OPBEL TYPE DFKKOP-OPBEL,
VKONT TYPE DFKKOP-VKONT,
BETRH TYPE DFKKOP-BETRH,
END OF GWA_DFKKOP_INACTIVE_ARR,
GT_DFKKOP_INACTIVE_ARR LIKE TABLE OF GWA_DFKKOP_INACTIVE_ARR
INITIAL SIZE 0,
BEGIN OF GWA_ETTIFN,
ANLAGE TYPE ETTIFN-ANLAGE,
OPERAND TYPE ETTIFN-OPERAND,
WERT1 TYPE ETTIFN-WERT1,
END OF GWA_ETTIFN,
GT_ETTIFN LIKE SORTED TABLE OF GWA_ETTIFN
WITH NON-UNIQUE KEY ANLAGE OPERAND INITIAL SIZE 0,
BEGIN OF GWA_DBERDLB,
PRINTDOC TYPE DBERDLB-PRINTDOC,
BILLDOC TYPE DBERDLB-BILLDOC,
BILLDOCLINE TYPE DBERDLB-BILLDOCLINE,
NETTOBTR TYPE DBERDLB-NETTOBTR,
END OF GWA_DBERDLB,
GT_DBERDLB LIKE TABLE OF GWA_DBERDLB INITIAL SIZE 0,
BEGIN OF GWA_DBERCHZ1_BILL,
BELNR TYPE DBERCHZ1-BELNR,
BELZEILE TYPE DBERCHZ1-BELZEILE,
TVORG TYPE DBERCHZ1-TVORG,
END OF GWA_DBERCHZ1_BILL,
GT_DBERCHZ1_BILL LIKE TABLE OF GWA_DBERCHZ1_BILL INITIAL SIZE 0,
BEGIN OF GWA_BILLDOC,
PRINTDOC TYPE ERDK-OPBEL,
BILLDOC TYPE DBERDLB-BILLDOC,
END OF GWA_BILLDOC,
GT_BILLDOC LIKE TABLE OF GWA_BILLDOC INITIAL SIZE 0,
BEGIN OF GWA_DBERCHV,
BELNR TYPE DBERCHV-BELNR,
OPERAND TYPE DBERCHV-OPERAND,
EZ_ABRMENGE TYPE DBERCHV-EZ_ABRMENGE,
ABLESGR TYPE DBERCHV-ABLESGR,
ABLESGRV TYPE DBERCHV-ABLESGRV,
END OF GWA_DBERCHV,
GT_DBERCHV LIKE TABLE OF GWA_DBERCHV INITIAL SIZE 0,
BEGIN OF GWA_DFKKOP_ARREAR,
OPBEL TYPE DFKKOP-OPBEL,
VKONT TYPE DFKKOP-VKONT,
HVORG TYPE DFKKOP-HVORG,
TVORG TYPE DFKKOP-TVORG,
BUDAT TYPE DFKKOP-BUDAT,
BETRH TYPE DFKKOP-BETRH,
AUGDT TYPE DFKKOP-AUGDT,
XBLNR TYPE DFKKOP-XBLNR,
END OF GWA_DFKKOP_ARREAR,
GT_DFKKOP_ARREAR LIKE TABLE OF GWA_DFKKOP_ARREAR INITIAL SIZE 0,
BEGIN OF GWA_MASTER_DATA,
SLNO(4) TYPE C,
IND_SECTOR TYPE TB024-IND_SECTOR,
TEXTLONG TYPE TB024-TEXTLONG,
AC_CODE TYPE TFK033D-FUN01,
END OF GWA_MASTER_DATA,
GT_MASTER_DATA LIKE TABLE OF GWA_MASTER_DATA INITIAL SIZE 0,
** internal table for final prepared data
BEGIN OF GWA_FINAL_DATA,
SLNO(4) TYPE C,
IND_SECTOR TYPE TB024-IND_SECTOR, " for testing
INDUSTRY TYPE TB024-TEXTLONG,
AC_CODE TYPE TFK033D-FUN01,
* *for urban partners
UPARTNER TYPE I , "(6) type n,
UBAD_METER TYPE I, "(4) type n,
UINACTIVE TYPE I,
ULOAD(8) TYPE P DECIMALS 2,
UUNITS(8) TYPE P DECIMALS 2,
UDEMANDS(8) TYPE P DECIMALS 2,
UARREARS(8) TYPE P DECIMALS 2, "FKKMAKO-Msalm,
UINACT_ARR(8) TYPE P DECIMALS 2,
BLANK(10) TYPE C,
* *for rural partners
RPARTNER TYPE I , "(6) type n,
RBAD_METER TYPE I , "(4) type n,
RINACTIVE TYPE I,
RLOAD(8) TYPE P DECIMALS 2,
RUNITS(8) TYPE P DECIMALS 2,
RDEMANDS(8) TYPE P DECIMALS 2,
RARREARS(8) TYPE P DECIMALS 2,
RINACT_ARR(8) TYPE P DECIMALS 2,
END OF GWA_FINAL_DATA,
GT_FINAL_DATA LIKE TABLE OF GWA_FINAL_DATA INITIAL SIZE 0,
BEGIN OF GWA_MANUAL_DATA,
COL_1(5) TYPE C,
COL_2(10) TYPE C,
COL_3(40) TYPE C,
COL_4(40) TYPE C,
COL_5(10) TYPE C,
COL_6(19) TYPE C,
COL_7(19) TYPE C,
COL_8(19) TYPE C,
COL_9(19) TYPE C,
COL_10(19) TYPE C,
COL_11(19) TYPE C,
COL_12(10) TYPE C,
COL_13(19) TYPE C,
COL_14(19) TYPE C,
COL_15(19) TYPE C,
COL_16(19) TYPE C,
COL_17(19) TYPE C,
COL_18(19) TYPE C,
END OF GWA_MANUAL_DATA,
GT_MANUAL_DATA LIKE TABLE OF GWA_MANUAL_DATA INITIAL SIZE 0.
** Variables for grand total of all heads.
DATA : GV_T_UPART TYPE I,
GV_T_RPART TYPE I,
GV_T_RINACTIVE TYPE I,
GV_T_UINACTIVE TYPE I,
GV_UDEF_MTR TYPE I,
GV_RDEF_MTR TYPE I,
GV_UCON_LOAD(16) TYPE P DECIMALS 2,
GV_RCON_LOAD(16) TYPE P DECIMALS 2,
GV_UUNITS(16) TYPE P DECIMALS 2,
GV_RUNITS(16) TYPE P DECIMALS 2,
GV_UDEMAND(16) TYPE P DECIMALS 2,
GV_RDEMAND(16) TYPE P DECIMALS 2,
GV_UARREAR(16) TYPE P DECIMALS 2,
GV_RARREAR(16) TYPE P DECIMALS 2,
GV_UINACT_ARR(16) TYPE P DECIMALS 2,
GV_RINACT_ARR(16) TYPE P DECIMALS 2,
GV_U_SD_DMD(16) TYPE P DECIMALS 2,
GV_R_SD_DMD(16) TYPE P DECIMALS 2,
GV_U_SD_ARR(16) TYPE P DECIMALS 2,
GV_R_SD_ARR(16) TYPE P DECIMALS 2,
GV_UR_PART TYPE I,
GV_UR_DEF_MTR TYPE I,
GV_UR_CON_LOAD(16) TYPE P DECIMALS 2,
GV_UR_UNITS(16) TYPE P DECIMALS 2,
GV_UR_DEMAND(16) TYPE P DECIMALS 2,
GV_UR_ARREARS(16) TYPE P DECIMALS 2,
GV_LOWDATE TYPE SY-DATUM,
GV_HIGHDATE TYPE SY-DATUM,
GV_YEAR LIKE DBERCHV-EZ_ABRMENGE,
GV_MONTH LIKE DBERCHZ1-V_ABRMENGE,
GV_MNTH_NAME TYPE T247-KTX.
DATA:
**total meter rent
GV_UTOTMETERRENT TYPE P LENGTH 16 DECIMALS 2,
GV_RTOTMETERRENT TYPE P LENGTH 16 DECIMALS 2,
**for total surcharge
GV_UTOTSURCHRG TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
GV_RTOTSURCHRG TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
**for total ED
GV_UTOTED TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
GV_RTOTED TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
**for total ED Cess
GV_UTOTEDCESS TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
GV_RTOTEDCESS TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
**for total other misc rev
GV_UTOTMISCREV TYPE P LENGTH 16 DECIMALS 2,
GV_RTOTMISCREV TYPE P LENGTH 16 DECIMALS 2,
**for total ED of Free agricultural pump
GV_RTOTEDAGRI TYPE P LENGTH 16 DECIMALS 2,
GV_UTOTEDAGRI TYPE P LENGTH 16 DECIMALS 2,
**for ED cess of Free agriculture pump
GV_RTOTCESSAGRI TYPE P LENGTH 16 DECIMALS 2,
GV_UTOTCESSAGRI TYPE P LENGTH 16 DECIMALS 2,
***data for selection screen data validation
GV_GSBER TYPE EVER-GSBER,
GV_COKEY TYPE EVER-COKEY,
DYFIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
GT_INTERN_DATA TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
RANGES: R_COKEY FOR TECOKT-COKEY.
AT SELECTION-SCREEN.
AT SELECTION-SCREEN ON SO_GSBER.
IF NOT SO_GSBER-LOW IS INITIAL.
SELECT SINGLE GSBER FROM TGSBT INTO GT_TGSBT-GSBER WHERE
GSBER = SO_GSBER-LOW.
IF SY-SUBRC <> 0.
MESSAGE E007.
ENDIF.
ENDIF.
IF NOT SO_GSBER-HIGH IS INITIAL .
SELECT SINGLE GSBER FROM TGSBT INTO GT_TGSBT-GSBER WHERE
GSBER = SO_GSBER-HIGH.
IF SY-SUBRC <> 0.
MESSAGE E007.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON P_BMNTH.
**check the validity of Billing month format and for valid billing month
IF P_BMNTH CO '0123456789/'.
IF P_BMNTH CP '++++/++'.
IF P_BMNTH+5(2) > 12.
MESSAGE E002 WITH 'from'.
ENDIF.
** current year is less than year entered
IF SY-DATUM(4) < P_BMNTH(4).
MESSAGE E003 WITH 'from'.
ELSEIF SY-DATUM(4) = P_BMNTH(4).
** month in future
IF SY-DATUM+4(2) < P_BMNTH+5(2).
MESSAGE E004 WITH 'from'.
ENDIF.
ENDIF.
ELSE.
MESSAGE E001 WITH 'from'.
ENDIF.
ELSE.
** entry have some invalid char
MESSAGE E010.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-LOW.
**for geting the CO account assigment key of the entered Business area
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-HIGH.
CLEAR: DYFIELDS[], DYFIELDS.
PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-HIGH.
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
* REFRESH: IT_TAB.
***Opens File Open Dialog Box for selecting input file.
* CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
* EXPORTING
* WINDOW_TITLE = 'Select File'
* DEFAULT_FILENAME = '*.xls'
* MULTISELECTION = ' '
* CHANGING
* FILE_TABLE = IT_TAB
* RC = GD_SUBRC.
* LOOP AT IT_TAB INTO P_FILE.
** so_fpath-sign = 'I'.
** so_fpath-option = 'EQ'.
** append so_fpath.
* ENDLOOP.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'ACT'.
IF P_INCLUD = ' '.
SCREEN-INPUT = '0'.
ELSE.
SCREEN-INPUT = '1'.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
* End of Selection screen processing
TOP-OF-PAGE.
DATA : LV_TEXT(70) TYPE C.
FORMAT INTENSIFIED OFF.
WRITE:/50 'CHHATTISGARH STATE ELECTRICITY BOARD',
/42 'R-15 REPORT FOR LT CONSUMERS FOR THE MONTH OF',
GV_MNTH_NAME NO-GAP,'-' NO-GAP, P_BMNTH(4) NO-GAP,
180 'PAGE-NO. -', SY-PAGNO LEFT-JUSTIFIED.
SKIP.
WRITE:/2 'RAO', 15 ':'.
LOOP AT GT_TGSBT WHERE GSBER IN SO_GSBER.
IF STRLEN( LV_TEXT ) > 60.
WRITE: 16 LV_TEXT, / ''.
CLEAR LV_TEXT.
ENDIF.
CONCATENATE LV_TEXT GT_TGSBT-GSBER '-' GT_TGSBT-GTEXT
INTO LV_TEXT SEPARATED BY SPACE.
ENDLOOP.
WRITE: 16 LV_TEXT.
CLEAR LV_TEXT.
WRITE: /2 'Division',15 ':'.
LOOP AT GT_TECOKT.
IF STRLEN( LV_TEXT ) > 60.
WRITE: 16 LV_TEXT, /.
CLEAR LV_TEXT.
ENDIF.
CONCATENATE LV_TEXT GT_TECOKT-COKEY '-' GT_TECOKT-LTEXT
INTO LV_TEXT SEPARATED BY SPACE.
ENDLOOP.
WRITE: 16 LV_TEXT.
CLEAR LV_TEXT.
WRITE: /2 'Group',15 ':'.
LOOP AT GT_TE422 .
IF STRLEN( LV_TEXT ) > 60.
WRITE: 16 LV_TEXT, /.
CLEAR LV_TEXT.
ENDIF.
CONCATENATE LV_TEXT GT_TE422-TERMSCHL '-' GT_TE422-TERMTEXT
INTO LV_TEXT SEPARATED BY SPACE.
ENDLOOP.
WRITE: 16 LV_TEXT.
CLEAR LV_TEXT.
**legends
* write :/ text-028, 15 ':',16 text-029.
**now write the headings on every page
SET LEFT SCROLL-BOUNDARY COLUMN 50.
FORMAT COLOR 1 ON.
WRITE :/1(244) SY-ULINE.
WRITE :/1 SY-VLINE,6 SY-VLINE,50 SY-VLINE, 58 SY-VLINE, 59
'<----------------------------------',
'U R B A N A R E A',
'----------------------------------->'.
WRITE : 151 SY-VLINE, 152
'<----------------------------------',
'R U R A L A R E A',
'----------------------------------->',
244 SY-VLINE.
WRITE :/1 SY-VLINE,
2 'Slno',
6 SY-VLINE,
7 'Revenue Category',
50 SY-VLINE,
51 'A/C',
58 SY-VLINE,
59 'Cons-',
67 SY-VLINE,
68 'Deff',
75 SY-VLINE,
76 'Conn',
89 SY-VLINE,
90 'Sold',
108 SY-VLINE,
109 'Demand',
129 SY-VLINE,
130 'Previous',
151 SY-VLINE,
152 'Cons-',
160 SY-VLINE,
161 'Deff',
168 SY-VLINE,
169 'Conn',
182 SY-VLINE,
183 'Sold',
201 SY-VLINE,
202 'Demand',
222 SY-VLINE,
223 'Previous',
244 SY-VLINE.
WRITE :/1 SY-VLINE,
6 SY-VLINE,
50 SY-VLINE,
51 'Code',
58 SY-VLINE,
59 'umers',
67 SY-VLINE,
68 'mtrs',
75 SY-VLINE,
76 'Load-KW',
89 SY-VLINE,
90 'Units',
108 SY-VLINE,
129 SY-VLINE,
130 'Arrear',
151 SY-VLINE,
152 'umers',
160 SY-VLINE,
161 'mtrs',
168 SY-VLINE,
169 'Load-KW',
182 SY-VLINE,
183 'Units',
201 SY-VLINE,
222 SY-VLINE,
223 'Arrear',
244 SY-VLINE.
WRITE :/1(244) SY-ULINE.
SET LEFT SCROLL-BOUNDARY COLUMN 59.
* Start of Data Selection
START-OF-SELECTION.
SELECT GSBER GTEXT INTO TABLE GT_TGSBT FROM TGSBT
WHERE SPRAS = SY-LANGU.
SELECT IND_SECTOR TEXTLONG INTO TABLE GT_TB024
FROM TB024 WHERE SPRAS = SY-LANGU
AND ( ( IND_SECTOR >= '01' AND IND_SECTOR <= '55' )
OR ( IND_SECTOR = '57' OR IND_SECTOR = '58'
OR IND_SECTOR = '94' ) ).
SELECT SINGLE KTX INTO GV_MNTH_NAME FROM T247
WHERE MNR = P_BMNTH+5(2) AND SPRAS = SY-LANGU.
***master data selection
PERFORM CONSUMER_DATA_SELECTION.
*&--Get Meter Status Connected Load & MF for each installation
PERFORM OPERAND_DATA_SELECTION.
*&--Get the Demand corresponding to each Print documents selected
PERFORM BILLING_DATA_SELECTION.
*&--Get the arrears corresponding to each Print document selected
PERFORM ARREAR_DATA_SELECTION.
*&--To include Mannual R-15 into computerized R-15.
IF P_INCLUD = 'X'.
OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET P_FILE INTO GWA_MANUAL_DATA.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
APPEND GWA_MANUAL_DATA TO GT_MANUAL_DATA.
ENDIF.
ENDDO.
CLOSE DATASET P_FILE.
DELETE DATASET P_FILE.
ENDIF.
END-OF-SELECTION.
* End of data Selection
* Start of Data Processing
PERFORM FINAL_TABLE_PREPARE.
PERFORM FINAL_OUTPUT_PREPARE.
PERFORM FINAL_OUTPUT_DISPLAY.
* End of Data Processing
PERFORM FREE_MEMORY.
*& Form master_data_selection
* text
* --> p1 text
* <-- p2 text
FORM CONSUMER_DATA_SELECTION .
DATA: LV_MAX_DAYS TYPE I,
LV_LAST_DAY(2) TYPE C,
LV_IMONTH TYPE I,
LV_IYEAR TYPE I,
LV_BMNTH TYPE ZERDK_ERCHC-V_ABRMENGE,
LV_BYEAR TYPE ZERDK_ERCHC-EZ_ABRMENGE,
*&----Temporary tables for global internal tables.
LT_DBERCHZ1_TEMP LIKE TABLE OF GWA_DBERCHZ1,
LWA_DBERCHZ1_TEMP LIKE GWA_DBERCHZ1,
LT_ERCH LIKE TABLE OF GWA_ERCH,
LWA_ERCH LIKE GWA_ERCH,
LT_EVER LIKE TABLE OF GWA_EVER.
*DATA: lt_ever_fkkvkp like gwa_ever_eanlh_fkkvkp occurs 0.
LV_IMONTH = P_BMNTH+5(2).
LV_IYEAR = P_BMNTH(4).
LV_BMNTH = P_BMNTH+5(2).
LV_BYEAR = P_BMNTH(4).
CALL FUNCTION 'RTP_US_API_MAX_DAYS_IN_MONTH'
EXPORTING
I_DATE_MONTH = LV_IMONTH
I_DATE_YEAR = LV_IYEAR
IMPORTING
E_MAX_DAYS = LV_MAX_DAYS.
LV_LAST_DAY = LV_MAX_DAYS.
CONCATENATE P_BMNTH(4) P_BMNTH+5(2) LV_LAST_DAY INTO GV_HIGHDATE.
IF SO_GPART[] IS INITIAL.
SELECT VKONTO ANLAGE ABRSPERR
INTO TABLE GT_EVER
FROM EVER
WHERE GSBER IN SO_GSBER
AND COKEY IN SO_COKEY
AND BUKRS = 'CSEB'
AND SPARTE = '01'
AND KOFIZ = '02'.
**get installation no from contract data and check biling class in eanlh
IF GT_EVER[] IS INITIAL.
MESSAGE 'No Business Partner exist for entered selection data' TYPE 'A'.
ENDIF.
IF NOT GT_EVER[] IS INITIAL.
SELECT VKONT KTOKL INTO TABLE GT_FKKVKP
FROM FKKVKP
FOR ALL ENTRIES IN GT_EVER
WHERE VKONT = GT_EVER-VKONT
AND GPART IN SO_GPART.
IF GT_FKKVKP[] IS INITIAL.
MESSAGE 'No Business Partner exist for entered Selection' TYPE 'A'.
ENDIF.
ENDIF.
ELSE.
SELECT VKONT KTOKL INTO TABLE GT_FKKVKP
FROM FKKVKP
WHERE GPART IN SO_GPART.
IF NOT GT_FKKVKP[] IS INITIAL.
SELECT VKONTO ANLAGE INTO TABLE GT_EVER
FROM EVER
FOR ALL ENTRIES IN GT_FKKVKP
WHERE VKONTO EQ GT_FKKVKP-VKONT
AND GSBER IN SO_GSBER
AND COKEY IN SO_COKEY
AND BUKRS EQ 'CSEB'
AND SPARTE EQ '01'
AND KOFIZ EQ '02'.
ENDIF.
ENDIF.
IF GT_EVER[] IS INITIAL AND GT_FKKVKP[] IS INITIAL.
MESSAGE 'No Business Partner exist for entered Selection' TYPE 'A'.
ENDIF.
SELECT ANLAGE BRANCHE INTO TABLE GT_EANLH
FROM EANLH
FOR ALL ENTRIES IN GT_EVER
WHERE ANLAGE EQ GT_EVER-ANLAGE
AND ABLEINH IN SO_MRU
AND AKLASSE EQ'0002'
AND AB <= GV_HIGHDATE
AND BIS => GV_HIGHDATE.
IF GT_EANLH[] IS INITIAL.
MESSAGE 'No Business Partner exist for entered Selection' TYPE 'A'.
ENDIF.
SORT : GT_EVER BY VKONT ANLAGE,
GT_FKKVKP BY VKONT,
GT_EANLH BY ANLAGE.
LOOP AT GT_EANLH INTO GWA_EANLH.
READ TABLE GT_EVER INTO GWA_EVER WITH KEY ANLAGE = GWA_EANLH-ANLAGE.
IF SY-SUBRC = 0.
READ TABLE GT_FKKVKP INTO GWA_FKKVKP
WITH KEY VKONT = GWA_EVER-VKONT.
IF SY-SUBRC = 0.
GWA_EVER_EANLH_FKKVKP-VKONT = GWA_EVER-VKONT.
GWA_EVER_EANLH_FKKVKP-ANLAGE = GWA_EVER-ANLAGE.
GWA_EVER_EANLH_FKKVKP-ABRSPERR = GWA_EVER-ABRSPERR.
GWA_EVER_EANLH_FKKVKP-BRANCHE = GWA_EANLH-BRANCHE.
GWA_EVER_EANLH_FKKVKP-KTOKL = GWA_FKKVKP-KTOKL.
APPEND GWA_EVER_EANLH_FKKVKP TO GT_EVER_EANLH_FKKVKP.
CLEAR GWA_EVER_EANLH_FKKVKP.
ENDIF.
ENDIF.
ENDLOOP.
IF GT_EVER_EANLH_FKKVKP[] IS INITIAL.
MESSAGE 'No Business Partner exist for Selection Data' TYPE 'A'.
ENDIF.
*&----get all the billdocuments for the busines partner's contract
*&----account
SELECT BELNR VKONT INTO TABLE GT_ERCH
FROM ERCH
FOR ALL ENTRIES IN GT_EVER_EANLH_FKKVKP
WHERE VKONT EQ GT_EVER_EANLH_FKKVKP-VKONT.
*&----get the BILL MONTH & BILL YEAR FOR THE BILLDOCUMENTS.
IF NOT GT_ERCH[] IS INITIAL.
SELECT BELNR EIN01 V_ABRMENGE INTO TABLE GT_DBERCHZ1
FROM DBERCHZ1
FOR ALL ENTRIES IN GT_ERCH
WHERE BELNR EQ GT_ERCH-BELNR
AND AKLASSE = '0002'
AND ( ( EIN01 = 'BILL_MNTH1'
AND V_ABRMENGE = P_BMNTH+5(2) )
OR ( EIN01 = 'BILL_YEAR1'
AND V_ABRMENGE = P_BMNTH(4) ) ).
*&---- GET THOSE BILL DOCUMENTS WHICH ARE FOR THE ENTERED BILL MONTH
IF NOT GT_DBERCHZ1[] IS INITIAL.
LOOP AT GT_DBERCHZ1 INTO GWA_DBERCHZ1 WHERE EIN01 = 'BILL_MNTH1'
AND V_ABRMENGE = P_BMNTH+5(2).
READ TABLE GT_DBERCHZ1 INTO LWA_DBERCHZ1_TEMP
WITH KEY BELNR = GWA_DBERCHZ1-BELNR EIN01 = 'BILL_YEAR1'
V_ABRMENGE = P_BMNTH(4).
IF SY-SUBRC = 0.
APPEND LWA_DBERCHZ1_TEMP TO LT_DBERCHZ1_TEMP.
CLEAR: LWA_DBERCHZ1_TEMP.
ENDIF.
ENDLOOP.
GT_DBERCHZ1[] = LT_DBERCHZ1_TEMP[].
ENDIF.
ENDIF.
*&---NOW FIND THE PRINT DOCUMENTS FOR THE SELECTED BILLDOCUMENTS.
IF NOT GT_DBERCHZ1[] IS INITIAL.
SELECT BELNR OPBEL BUDAT FROM ERCHC
INTO TABLE GT_ERCHC
FOR ALL ENTRIES IN GT_DBERCHZ1
WHERE BELNR = GT_DBERCHZ1-BELNR
AND INTOPBEL EQ SPACE
AND SIMULATED EQ SPACE
AND INVOICED EQ 'X'.
ENDIF.
IF NOT GT_ERCHC[] IS INITIAL.
LOOP AT GT_ERCHC INTO GWA_ERCHC.
READ TABLE GT_ERCH INTO GWA_ERCH WITH KEY BELNR = GWA_ERCHC-BELNR.
IF SY-SUBRC = 0.
APPEND GWA_ERCH TO LT_ERCH.
CLEAR GWA_ERCH.
ENDIF.
CLEAR GWA_ERCHC.
ENDLOOP.
ENDIF.
GT_ERCH[] = LT_ERCH[].
FREE: LT_ERCH, LT_DBERCHZ1_TEMP,LWA_DBERCHZ1_TEMP.
LOOP AT GT_EVER_EANLH_FKKVKP INTO GWA_EVER_EANLH_FKKVKP.
* READ TABLE gt_erdk_erchc INTO gwa_erdk_erchc
* WITH KEY vkont = gwa_ever_eanlh_fkkvkp-vkont.
READ TABLE GT_ERCH INTO GWA_ERCH
WITH KEY VKONT = GWA_EVER_EANLH_FKKVKP-VKONT.
IF SY-SUBRC <> 0.
IF GWA_EVER_EANLH_FKKVKP-ABRSPERR = SPACE.
GWA_EVER_EANLH_FKKVKP-ABRSPERR = '01'.
MODIFY GT_EVER_EANLH_FKKVKP FROM GWA_EVER_EANLH_FKKVKP
TRANSPORTING ABRSPERR.
APPEND GWA_EVER_EANLH_FKKVKP TO GT_EVER_EANLH_FKKVKP_INACT.
ENDIF.
ELSE.
IF GWA_EVER_EANLH_FKKVKP-ABRSPERR <> SPACE.
GWA_EVER_EANLH_FKKVKP-ABRSPERR = SPACE.
MODIFY GT_EVER_EANLH_FKKVKP FROM GWA_EVER_EANLH_FKKVKP
TRANSPORTING ABRSPERR.
ENDIF.
ENDIF.
CLEAR GWA_ERCH.
ENDLOOP.
REFRESH GT_TECOKT[].
IF NOT SO_COKEY[] IS INITIAL.
SELECT COKEY LTEXT INTO TABLE GT_TECOKT
FROM TECOKT
WHERE COKEY IN SO_COKEY
AND SPRAS = SY-LANGU .
* %_HINTS ORACLE '("TECOKT","TECOKT~1")'.
ENDIF.
IF NOT SO_MRU[] IS INITIAL.
SELECT TERMSCHL TERMTEXT INTO TABLE GT_TE422
FROM TE422
WHERE TERMSCHL IN SO_MRU.
ENDIF.
*FREE lt_ever_fkkvkp[].
ENDFORM. " consumer_data_selection
*& Form Operand_data_selection
* text
* --> p1 text
* <-- p2 text
FORM OPERAND_DATA_SELECTION .
DATA: LT_EVER_EANLH_FKKVKP_ACT LIKE TABLE OF GWA_EVER_EANLH_FKKVKP.
* SORT gt_ever_eanlh_fkkvkp BY vkont.
CHECK NOT GT_EVER_EANLH_FKKVKP[] IS INITIAL.
**now depending upon the billing month check the time slice date
**the last date of the billing month or the range of billing month
*should fall in between the time slice of the installation
** billing month to is space
**now select operands for processed installation
LT_EVER_EANLH_FKKVKP_ACT[] = GT_EVER_EANLH_FKKVKP[].
DELETE LT_EVER_EANLH_FKKVKP_ACT WHERE ABRSPERR NE SPACE.
IF NOT LT_EVER_EANLH_FKKVKP_ACT[] IS INITIAL.
SELECT ANLAGE OPERAND WERT1
FROM ETTIFN
INTO TABLE GT_ETTIFN
FOR ALL ENTRIES IN LT_EVER_EANLH_FKKVKP_ACT
WHERE ANLAGE = LT_EVER_EANLH_FKKVKP_ACT-ANLAGE
AND OPERAND IN ('MTR_STS','CONN_LOAD','LOAD_CODE','KWH_MF')
AND ( AB <= GV_HIGHDATE AND BIS >= GV_HIGHDATE ).
* %_HINTS ORACLE '("ETTIFN","ETTIFN~003")'.
ENDIF.
ENDFORM. " Operand_data_selection
*& Form billing_data_selection
*&------------------------------Hi,
Please do run time analysis as Rob correctly mentioned or do SQL trace(ST05) to find where the program is consuming more time.
Lanka -
Performance problems with abap report SAPLPRGN_STRUCTURE during users login
Hello,
after patchimport of SAP BASIS level 21 and SAPABAP level 21 our SAP Production System (ECC6-UNICODE KERNEL 240) denote a performance problems. A lot of ours users during logon phase must wait until 10-12 minutes before that the navigation menu is displayed. The problem is generated by the slow performance of the standard SAP REPORT SAPLPRGN_STRUCTURE that require a lot time. Any idea?
ThanksHi Pat,
I would stop SAP and use DLTR3PKG, If this doesn't help, you need to investigate, if it is a CPU or DB-Time issue in ST03. Then you have to handle accordingly ...
Regards
Volker Gueldenpfennig, consolut international ag
http://www.consolut.net - http://www.4soi.de - http://www.easymarketplace.de
Maybe you are looking for
-
Hi, Thanks in advance. EDI 856 program was extracted from Oracle by passing the customer name as parameter, however one of the delivery number for that partcular customer was never made available for EDI to pick up to generate a flatfile. Can anyone
-
Folio Producer Editor: Missing or unable to load layout
I have an ongoing problem. I have rebuilt from scratch the folio and article of my app multiple times, but once I view the folio in the Folio Producer Editor I receive the error "Missing or unable to load layout." The folio and articles get loaded
-
Start event from case structure
I'm running my main programm inside an event of an eventstructure. Beside this main event I additionally have 3 other events in this event structure. To save "screen space" I would like to start indirectly one of my other events from a case placed in
-
Another "Dark Prints" with Lightroom discussion
Ok, i've read every post on the internet on this topic. I've tried EVERY combination and solution out there. I have an Epson rx580 photo printer with iBook G4. Prints great in PSE4 and other apps (iphoto, etc). When printing in Lightroom...everything
-
New user: Printing & tables
I installed the iWork08 demo earlier, which I'm considering buying, but it's very annoying that I can't save or print as it means I can't test it out properly because each day I'm effectively back to square one. What is the point in a trial 30 days l