Cube Refresh Performance Issue
We are facing a strange performance issue related to cube refresh. The cube which used to take 1 hr to refresh is taking around 3.5 to 4 hr without any change in the environment. Also, the data that it processes is almost the same before and now. Only these cube out of all the other cubes in the workspace is suffering the performance issue over a period of time.
Details of the cube:
This cube has 7 dimensions and 11 measures (mix of sum and avg as aggregation algorithm). No compression. Cube is partioned (48 partitions). Main source of the data is a materialized view which is partitioned in the same way as the cube.
Data Volume: 2480261 records in the source to be processed daily (almost evenly distributed across the partition)
Cube is refreshed with the below script
DBMS_CUBE.BUILD(<<cube_name>>,'SS',true,5,false,true,false);
Has anyone faced similar issue? Please can advise on what might be the cause for the performance degradation.
Environment - Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
AWM - awm11.2.0.2.0A
Take a look at DBMS_CUBE.BUILD documentation at http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_cube.htm#ARPLS218 and DBMS_CUBE_LOG documentation at http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_cube_log.htm#ARPLS72789
You can also search this forum for more questions/examples about DBMS_CUBE.BUILD
David Greenfield has covered many Cube loading topics in the past on this forum.
Mapping to Relational tables
Re: Enabling materialized view for fast refresh method
DBMS CUBE BUILD
CUBE_DFLT_PARTITION_LEVEL in 11g?
Reclaiming space in OLAP 11.1.0.7
Re: During a cube build how do I use an IN list for dimension hierarchy?
.
Similar Messages
-
Performance issue in browsing SSAS cube using Excel for first time after cube refresh
Hello Group Members,
This is a continuation of my earlier blog question -
https://social.msdn.microsoft.com/Forums/en-US/a1e424a2-f102-4165-a597-f464cf03ebb5/cache-and-performance-issue-in-browsing-ssas-cube-using-excel-for-first-time?forum=sqlanalysisservices
As that thread is marked as answer, but my issue is not resolved, I am creating a new thread.
I am facing a cache and performance issue for the first time when I try to open a SSAS cube connection using Excel (using Data tab -> From Other Sources --> From Analysis Services) after daily cube refresh. In end users system (8 GB RAM but around
4GB available RAM), for the first time, it takes 10 minutes to open the cube. From next run onwards, its open up quickly within 10 secs.
We have daily ETL process running in high end servers. The configuration of dedicated SSAS cube server is 8 core, 64GB RAM. In total we have 4 cube DB - out of which for 3 is full cube refresh and 1 is incremental refresh. We have seen after daily cube
refresh, it takes 10 odd minutes to open the cube in end users system. From next time onwards, it opens up really fast with 10 secs. After cube refresh, in server systems (32 GB RAM, around 4GB available RAM), it takes 2 odd minutes to open the cube.
Is there, any way we could reduce the time taken for first attempt ?
As mentioned in my previous thread, we have already implemented a cube wraming cache. But, there is no improvement.
Currently, the cumulative size of the all 4 cube DB are more than 9 GB in Production and each cube DB having 4 individual cubes in average with highest cube DB size is 3.5 GB. Now, the question is how excel works with SSAS cube after
daily cube refresh?
Is it Excel creates a cache of the schema and data after each time cube is refreshed and in doing so it need to download the cube schema in Excel's memory? Now to download the the schema and data of each cube database from server to client, it will take
a significant time based on the bandwidth of the network and connection.
Is it anyway dependent to client system RAM ? Today the bigest cube DB size is 3.5 GB, tomorrow it will be 5-6 GB. Now, though client system RAM is 8 GB, the available or free RAM would be around 4 GB. So, what will happen then ?
Best Regards, Arka Mitra.Could you run the following two DMV queries filling in the name of the cube you're connecting to. Then please post back the row count returned from each of them (by copying them into Excel and counting the rows).
I want to see if this is an issue I've run across before with thousands of dimension attributes and MDSCHEMA_CUBES performance.
select [HIERARCHY_UNIQUE_NAME]
from $system.mdschema_hierarchies
where CUBE_NAME = 'YourCubeName'
select [LEVEL_UNIQUE_NAME]
from $system.mdschema_levels
where CUBE_NAME = 'YourCubeName'
Also, what version of Analysis Services is it? If you connect Object Explorer in Management Studio to SSAS, what's the exact version number it says on the top server node?
http://artisconsulting.com/Blogs/GregGalloway -
Cache and performance issue in browsing SSAS cube using Excel for first time
Hello Group Members,
I am facing a cache and performance issue for the first time, when I try to open a SSAS cube connection using Excel (using Data tab -> From Other Sources --> From Analysis Services) after daily cube refresh. In end users
system (8 GB RAM), for the first time, it takes 10 minutes to open the cube. From next run onwards, its open up quickly within 10 secs.
We have daily ETL process running in high end servers. The configuration of dedicated SSAS cube server is 8 core, 64GB RAM. In total we have 4 cubes - out of which for 3 is full cube refresh and 1 is incremental refresh. We have seen after
daily cube refresh, it takes 10 odd minutes to open the cube in end users system. From next time onwards, it opens up really fast with 10 secs. After cube refresh, in server systems (16 GB RAM), it takes 2 odd minutes to open the cube.
Is there, any way we could reduce the time taken for first attempt ?
Best Regards, Arka Mitra.Thanks Richard and Charlie,
We have implemented the solution/suggestions in our DEV environment and we have seen a definite improvement. We are waiting this to be deployed in UAT environment to note down the actual performance and time improvement while browsing the cube for the
first time after daily cube refresh.
Guys,
This is what we have done:
We have 4 cube databases and each cube db has 1-8 cubes.
1. We are doing daily cube refresh using SQL jobs as follows:
<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200">
<Object>
<DatabaseID>FINANCE CUBES</DatabaseID>
</Object>
<Type>ProcessFull</Type>
<WriteBackTableCreation>UseExisting</WriteBackTableCreation>
</Process>
</Parallel>
</Batch>
2. Next we are creating a separate SQL job (Cache Warming - Profitability Analysis) for cube cache warming for each single cube in each cube db like:
CREATE CACHE FOR [Profit Analysis] AS
{[Measures].members}
*[TIME].[FINANCIAL QUARTER].[FINANCIAL QUARTER]
3. Finally after each cube refresh step, we are creating a new step of type T-SQL where we are calling these individual steps:
EXEC dbo.sp_start_job N'Cache Warming - Profit Analysis';
GO
I will update the post after I receive the actual im[provement from UAT/ Production environment.
Best Regards, Arka Mitra. -
BPC 10.0 Input Schedule refresh : investigating performance issues on frontend side
Hello,
We are running SAP BPC NW 10.0 SPS8.
We recieve a lot of complaints regarding performance issues.
More specifically BPC Input Schedule refresh takes ages (11 minutes actually)
I am a SAP Basis Administartor with some solid BW experience, but very linited BPC knowledge.
So raf we have tried the following :
* BPC Full and light ptmimize of the BPC Cubes.
* Updating Oracle Statistics
* Activating ABAP/SQL traces*
* Checking USJTAT Logs
Then it rutned out that the perfromance problems werre not caused by the backend SAP BW server (only 9 seconds of bakend processing are displayed in UJSTAT).
The overwhelming majority of the processing is spent on the frontend side : on the computer of the user.
We really would like to know what is happening on BPC Frontend side, but are really lacking any investigative method .....
other that checking memory/CPU usage o nthe frontend computer.
From your experience, is there any tool/method to allow to conduct some investigation on what is going on the frontend side, when a BPC Input Schedule is refreshed ?
Thank you for your attention.Hello Vadim,
We still need to get confirmation from the external consultants who developed the BPC solution, but as far as I can understand it :
We do not use use member formulas
We are indeed talking about EPM (without EPMRetrieveData functions)
The perfromance problems occur in DEV and QAS , after a restore of the BPC environment (backup from PRD)
We already had the problem in the past, but we never knew precisely how to solve it, it is as if there was some missing links between the restored BPC environment from PRD and the DEV/QAS system
One additional information, we checked the EPM CLient Log , and here are the errors displayed while refreshing the input schedule :
The thing is that I have no idea what it means ...
?FILE_TYPE:DAAA96DE-B0FB-4c6e-AF7B-A445F5BF9BE2
RECORD_SEPARATOR:35
COLUMN_SEPARATOR:124
COLUMNS:Time|Severity|Category|Method|User|DSRRootContextID|DSRTransactionID|DSRConnectionID|DSRCounter|Thread|Text
SEVERITY_MAP:DEBUG|Debug|INFO|Information|VERBOSE|Verbose|WARNING|Warning|ERROR|Error|FATAL|Fatal
HEADER_END
2014-04-18 08:41:17,446|ERROR|ReportManagement|FPMXLClient.Office.EPMExcelReportManagerRepository.GetReportManager|BPCUSER|||||1|Unable to get the Object property of the OLEObject class#
2014-04-18 08:41:18,613|ERROR|ReportManagement|FPMXLClient.Office.EPMExcelReportManagerRepository.GetReportManager|BPCUSER|||||1|Unable to get the Object property of the OLEObject class#
2014-04-18 08:41:18,630|ERROR|ReportManagement|FPMXLClient.Office.EPMExcelReportManagerRepository.GetReportManager|BPCUSER|||||1|Unable to get the Object property of the OLEObject class#
2014-04-18 08:41:18,648|ERROR|ReportManagement|FPMXLClient.Office.EPMExcelReportManagerRepository.GetReportManager|BPCUSER|||||1|Unable to get the Object property of the OLEObject class#
2014-04-18 08:41:18,731|ERROR|ReportManagement|FPMXLClient.Office.EPMExcelReportManagerRepository.GetReportManager|BPCUSER|||||1|Unable to get the Object property of the OLEObject class#
2014-04-18 08:41:37,171|ERROR|ReportManagement|FPMXLClient.ReportManagement.DynamicReport.Load|BPCUSER|||||1|bytes = 1#
2014-04-18 08:41:39,348|ERROR|ReportManagement|FPMXLClient.ReportManagement.DynamicReport.Load|BPCUSER|||||1|bytes = 0#
2014-04-18 08:41:39,474|ERROR|ReportManagement|FPMXLClient.ReportManagement.DynamicReport.Load|BPCUSER|||||1|bytes = 0#
2014-04-18 08:41:39,536|ERROR|ReportManagement|FPMXLClient.ReportManagement.DynamicReport.Load|BPCUSER|||||1|bytes = 0#
2014-04-18 08:41:39,597|ERROR|ReportManagement|FPMXLClient.ReportManagement.DynamicReport.Load|BPCUSER|||||1|bytes = 0#
2014-04-18 09:00:22,088|ERROR|Dataservice|FPMXLClient.BPCProxy.MetaData_Data.DataServiceHelper.ExecuteReportAsStream|BPCUSER|||||ServerCallThread_666f378d-d824-4a8a-bf38-0da8493e2382|An error has occured on the server#
2014-04-18 09:00:22,252|ERROR|BPC10Connection|FPMXLClient.Connection.RESTConnection.ExecuteReport|BPCUSER|||||ServerCallThread_666f378d-d824-4a8a-bf38-0da8493e2382|An error has occured on the server#
2014-04-18 09:00:22,268|ERROR|OfficeWrappers|FPMXLClient.Office.EPMReportManager.ExecuteReport|BPCUSER|||||1|An error has occured on the server#
2014-04-18 09:00:22,317|ERROR|OfficeWrappers|FPMXLClient.Office.EPMExcelReportManager.RefreshReports|BPCUSER|||||1|An error has occured on the server#
2014-04-18 09:00:22,447|ERROR|AnalyzerOne|FPMXLClient.AddIn.RefreshSheetWithScan|BPCUSER|||||1|Execution of Report Default Report failed : #
2014-04-18 09:00:22,537|ERROR|Automation|FPMXLClient.EPMAddInAutomation.RefreshActiveSheet|BPCUSER|||||1|Execution of Report Default Report failed : # -
Inventory Cube performance Issue
Hi All,
This is not something new, but an old issue traditionally with this cube. I have customized 0IC_C03 for my requirement and having serious performance issues. It has 0CALDAY, 0MATERIAL, 0PLANT as non-cumulative value parameters. i hav eadded movement types (temproarily for validation purpose). But my query always timed out, unless I specify the material. There are close to 40K materials are being maintained. The values are all fine between ECC and BI afterdata loads. So we are thinking may be snap shot approach would hlp us resolve the performanc eissues.
Anybody has implementeted snap-shot approach for inventory? I know it is a loading issue, but we think we could deal with that rather than performanc eissue when the users execute the query.
if anybody has done it, could ou provide the steps?
Thanks,
Alex.Hi Jameson - Thanks for your response.
We thought that would be the case. Have raised a SR with oracle and they are investigating on it. We have also sent an EIFF file to Oracle for investigation.
Both the DBs are in the same environment (AIX 6.1) and DBAs have confirmed both the DBs have the same system parameters.
Even if we keep aside comparing to 11.2.0.1, for some reason 11.2.0.3 seems to be very slow. Even a simple cube (2 Dim and 2 Measures) with 9K records takes around 15 min to get refreshed and it takes ages to view the data.
Havent generated the AWR report, will see if we can do the same.
rgds,
Prakash S -
BW BCS cube(0bcs_vc10 ) Report huge performance issue
Hi Masters,
I am working out for a solution for BW report developed in 0bcs_vc10 virtual cube.
Some of the querys is taking more 15 to 20 minutes to execute the report.
This is huge performance issue. We are using BW 3.5, and report devloped in bex and published thru portal. Any one faced similar problem please advise how you tackle this issue. Please give the detail analysis approach how you resolved this issue.
Current service pack we are using is
SAP_BW 350 0016 SAPKW35016
FINBASIS 300 0012 SAPK-30012INFINBASIS
BI_CONT 353 0008 SAPKIBIFP8
SEM-BW 400 0012 SAPKGS4012
Best of Luck
Chris
BW BCS cube(0bcs_vc10 ) Report huge performance issueRavi,
I already did that, it is not helping me much for the performance. Reports are taking 15 t0 20 minutes. I wanted any body in this forum have the same issue how
they resolved it.
Regards,
Chris -
Building a new Cube Vs Restricted Key figure in Query - Performance issue
Hi,
I have a requirement to create a OPEX restricted key figure in Query. The problem is that the key figure should be restricted to about 30 GL Accounts and almost 300 Cost centers.
I do not know if this might cause performance issue in the query. At the moment, I am thinking of creating a new OPEX cube and load only those 30 GL Accounts, 300 cost centers and Amount. and include OPEX in multiprovider in order to get OPEX
amount in the report.
whats the best solution - creating OPEX restricted key figure or OPEX cube ?
thanks,
BhatI think you should go for cube as all the restrcited key figure are calculated at OLAP runtime so it will definitely affect the query performance.There are a lot of costcenter for which you have to restrict it so definitely during the runtime of query it will take a lot of time to fetch tha data from infoprovider.Its better that you create a cube with the restrictions and include it in MP.It will definitely save a lot of time during query execution
Edited by: shyam agarwal on Feb 29, 2012 10:26 AM -
We have been working on 2 ASO cubes, performance was great. No modification hasn't been done ever since, but we have been experiencing performance issue now. What could be the possible cause or how I could resolve this. Thank you.
'Performance issue' isn't very descriptive - performance of what? Query? Data load? Aggregation? Restructure?
As a start, has the volume of data (input data cells) been increasing significantly? -
Essbase performance issue when calc scripts are run on FDM cube on same server
We have a large Essbase application which has high usage on a daily basis, which is being impacted when we run Calc scripts on an FDM forecast cube which is on the same server. The large application is on EIS 11.1.2 and the FDM cubes are being migrated to the same server and also being upgraded from EIS 7.1 on Unix to EIS 11.1.2 on NT. Every time the Calc scripts are run on the FDM cube, the performance of the Essbase application is degraded and it shuts down after some time.
Sudhir,
Do you work at a help desk or are you a consultant? you ask such a varied range of questions I think the former. If you do work at a help desk, don't you have a next level support that could help you? If you are a consultant, I suggest getting together with another consultant that actually knows more. You might also want to close some of your questions,. You have 24 open and perhaps give points to those that helped you. -
We are facing a performance issue related to cube refresh. Even a small cube consumes around 70% of the CPU while refreshing.
Details of the cube: This cube has 10 dimensions and 46 straight forward measures (mix of sum and avg as aggregation algorithm). No compression. Cube is partitioned (48 partitions). Main source of the data is a materialized view which is partitioned in the same way as the cube.
Data Volume: 1200 records in the source to be processed daily (almost evenly distributed across the partition)
Cube is refreshed using: DBMS_CUBE.BUILD(<<cube_name>>,'SS',true,5,false,true,false);
Environment - Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 (on AIX 6.1 64 bit), AWM - awm11.2.0.2.0A
Hardware Configuration
4.2 GHz, 3.5 CPU Core 32 GB RAM
Has anyone faced similar kind of issue? Is there any server level / database level parameter that needs tweaking to control this behaviour?Here is another trick to combine sum and average measures in the same cube. It relies on the AGGCOUNT function in OLAP DML, which you can look up in the reference guide.
Suppose that you have a cube with two measures, A and B, and that you want to aggregate A using SUM and aggregate B using AVG.
Step 1: Make the cube be compressed and aggregate all measures (A and B) using SUM.
If you do this using AWM, then the solve specification should include a MAINTAIN COUNT clause. To double check, look at the user_cubes view for your cube (TEST in my example).
select consistent_solve_spec from user_cubes where cube_name = 'TEST';
CONSISTENT_SOLVE_SPEC
SOLVE
SUM
MAINTAIN COUNT
ALLOW OVERFLOW
ALLOW DIVISION BY ZERO
IGNORE NULLS OVER ALL
)You can hand edit the XML for the cube if this hasn't happened. Here is what you want to see in the XML for the cube.
<ConsistentSolve>
<![CDATA[SOLVE
SUM
MAINTAIN COUNT
OVER ALL
)]]>Don't worry about the slight difference in syntax -- this is due to different printing routines in the client Java and the server c code.
Step 2: Verify that the cube's VARIABLE has the WITH AGGCOUNT option.
My cube is named TEST, so the variable is named TEST_STORED, and my cube is dimensioned by TIME and PRODUCT. You can run this in the OLAP Worksheet.
dsc test_stored
DEFINE TEST_STORED VARIABLE LOCKDFN NUMBER WITH NULLTRACKING WITH AGGCOUNT CHANGETRACKING <TEST_PRT_TEMPLATE <TEST_MEASURE_DIM TIME PRODUCT>>
Step 3: Define a new Calculated Measure, B_AVG, in the cube to get the average for measure B.
Select "OLAP DML Expression" as the "Calculation Type" and enter the following expression. Obviously you need to adjust for the cube and measure names. I am putting new lines into this for readability.
QUAL(
NVL2(AGGCOUNT(TEST_STORED), TEST_STORED / AGGCOUNT(TEST_STORED), TEST_STORED),
TEST_MEASURE_DIM 'B')
Step 4: Specify the $LOOP_VAR on the new measure
Execute the following in the OLAP Worksheet. (Again, correct for measure and cube names.) It instructs the server to loop the cube sparsely. If you don't do this, you will get dense looping and poor query performance. You only need to do this once (per calculated measure). If you save the AW to XML after this, then the LOOP_VAR value will be saved in the XML itself.
call set_property('$LOOP_VAR' 'TEST' 'B_AVG' 'TEST_STORED')For reporting purposes you should look at measures A and B_AVG. -
Performance issues with SAP BPC 7.0/7.5 (SP06, 07, 08) NW
Hi Experts
There are some performance issues with SAP BPC 7.5/7.0 NW, users are saying they are not getting data or there are some issues while getting data from R/3 system or ECC 6.0. Then what things do I need to consider to check, such as what DataSources or Cubes I need to check? So, how to solve this issue?
What things I need to consider for SAP NW BI 7.0 u2013 SAP BPC 7.5 NW (SP06, 07, 08) Implementation?
Your help is greatly appreciated.
Regards,
QadeerHi,
New SP was released in February, and now most of the new bugs should been caught ,This has a Central Note. For SP06 it's Note 1527325 - Planning and Consolidation 7.5 SP06 NetWeaver Central Note to fix any issues. Most of the improvements in SP06 were related to performance, especially when logging on from the BPC clients.There you should be able to find a big list of fixes/improvements and Notes that describe those. Some of the Notes even have test description how to reproduce that issue in the old version.
hope this will help you
Regards
Rv -
Hi,
The program(developed by someother person) which was given to me is having performance issue. Its giving RUNTIME ERROR 'TIME LIMIT EXCEEDED'. Can u please suggest me in what way i can improve the performance of the program.
please help me in resolving this.
Helpful answers will be rewarded.
TABLES : MARA, "General Material Data
MARC, "Plant Data for Material
VBAP, "Sales Document: Item Data
MARD, "Storage Location Data for Material
MAST, "Material to BOM Link
MKPF, "Header: Material Document
MSEG, "Document Segment: Material
PKHD, "Control Cycle
PKPS, "Control Cycle Item / Kanban
PVBE, "Supply area
ZTGRP, "Wabco Technology Group table
ZZC10. "Kanban status table
I N T E R N A L T A B L E D E C L A R A T I O N *
INTERNAL TABLE FOR TECH.GROUP AND PLANT
DATA: BEGIN OF IT_MARC_ZTGRP OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
ZZPTG LIKE ZTGRP-ZZPTG,
ZZPTD LIKE ZTGRP-ZZPTD,
END OF IT_MARC_ZTGRP.
INTERNAL TABLE FOR RETURN VALUES
DATA IT_RETURN LIKE TABLE OF BAPIRET2 WITH HEADER LINE.
INTERNAL TABLE FOR SUBASSEMBLY AND FINISHED GOOD
DATA: BEGIN OF IT_MATERIAL OCCURS 0,
IDNRK LIKE STPO-IDNRK,
MATNR LIKE MAST-MATNR,
END OF IT_MATERIAL.
INTERNAL TABLE FOR OUTPUT YESTERDAY
DATA: BEGIN OF IT_KBED_KAKO OCCURS 0,
KBEAREST LIKE KBED-KBEAREST,
KRUEREST LIKE KBED-KRUEREST,
KEINH LIKE KBED-KEINH,
END OF IT_KBED_KAKO.
INTERNAL TABLE FOR MATERIAL AND PLANT
DATA: BEGIN OF IT_PLANT OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
END OF IT_PLANT.
DATA: BEGIN OF IT_COBK OCCURS 0,
RUECK LIKE COBK-REFBN,
END OF IT_COBK.
DATA: BEGIN OF IT_COEPL OCCURS 0,
KOKRS LIKE COEPL-KOKRS,
BELNR LIKE COEPL-BELNR,
END OF IT_COEPL.
DATA: BEGIN OF IT_CAPACITIES OCCURS 0,
LSBBTR LIKE COEPL-LSBBTR,
MEINB LIKE COEPL-MEINB,
END OF IT_CAPACITIES.
DATA: BEGIN OF IT_MKPF_MSEG OCCURS 0,
MBLNR LIKE MKPF-MBLNR,
MJAHR LIKE MKPF-MJAHR,
BUDAT LIKE MKPF-BUDAT,
BWART LIKE MSEG-BWART,
MATNR LIKE MSEG-MATNR,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
DMBTR LIKE MSEG-DMBTR,
WERKS LIKE MSEG-WERKS,
END OF IT_MKPF_MSEG.
INTERNAL TABLE FOR MATERIAL-TO-BOM LINK
DATA: IT_MAST LIKE MAST OCCURS 0 WITH HEADER LINE.
INTERNAL TABLE FOR MATERIAL
DATA: BEGIN OF IT_MAT OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF IT_MAT.
INTERNAL TABLE FOR STORAGE LOCATION DATA FOR SUBASSEMBLY
DATA: BEGIN OF IT_MARD OCCURS 0,
LABST LIKE MARD-LABST,
END OF IT_MARD.
INTERNAL TABLE FOR PLANT FOR MATERIALS
DATA IT_MARC LIKE MARC OCCURS 0 WITH HEADER LINE.
INTERNAL TABLE FOR BOM ITEM DATA
DATA: IT_STPO LIKE STPO OCCURS 0 WITH HEADER LINE.
INTERNAL TABLE FOR KANBAN STATUS DATA
DATA IT_ZZC10 LIKE ZZC10 OCCURS 0 WITH HEADER LINE.
TEMPORARY INTERNAL TABLE FOR KANBAN STATUS DATA
DATA IT_ZZC10_TEMP LIKE ZZC10 OCCURS 0 WITH HEADER LINE.
INTERNAL TABLE FOR CONTROL CYCLE
DATA IT_PKHD LIKE PKHD OCCURS 0 WITH HEADER LINE.
INTERNAL TABLE FOR CONTROL CYCLE ITEM
DATA IT_PKPS LIKE PKPS OCCURS 0 WITH HEADER LINE.
INTERNAL TABLE FOR MATERIAL DOCUMENT HEADER
DATA IT_MKPF LIKE MKPF OCCURS 0 WITH HEADER LINE.
INTERNAL TABLE FOR MATERIAL DOCUMENT ITEM
DATA IT_MSEG LIKE MSEG OCCURS 0 WITH HEADER LINE.
TEMPORARY INTERNAL TABLE FOR ACTUAL QUANTITY
DATA : BEGIN OF IT_TEMP OCCURS 0,
TECH LIKE ZTGRP-ZZPTD,
MATNR LIKE ZZC10-MATNR,
FINISHED LIKE MAST-MATNR,
PKNUM LIKE PKHD-PKNUM,
WERKS LIKE ZZC10-WERKS,
GSMNG LIKE PLAF-GSMNG,
MEINS LIKE PLAF-MEINS,
BEHAZ LIKE PKHD-BEHAZ,
BEHMG LIKE PKHD-BEHMG,
PKBMG LIKE ZZC10-PKBMG,
LATEHOURS LIKE PKHD-KWBZM,
FILLRATE TYPE P DECIMALS 2,
REPL_LEAD_TIME TYPE P DECIMALS 3,
QTY_1 LIKE PLAF-GSMNG,
QTY_2 LIKE PLAF-GSMNG,
QTY_3 LIKE PLAF-GSMNG,
QTY_4 LIKE PLAF-GSMNG,
QTY_5 LIKE PLAF-GSMNG,
QTY_6 LIKE PLAF-GSMNG,
GSMNG_OUTY LIKE PLAF-GSMNG,
MEINS_OUTY LIKE PLAF-MEINS,
KAPBD_OUTY LIKE COEPL-LSTBTR,
KEINH_OUTY LIKE COEPL-MEINH,
GSMNG_OUTM LIKE MSEG-MENGE,
MEINS_OUTM LIKE MSEG-MEINS,
KAPBD_OUTM LIKE COEPL-LSTBTR,
KEINH_OUTM LIKE COEPL-MEINH,
GSMNG_BORD LIKE PLAF-GSMNG,
MEINS_BORD LIKE MSEG-MEINS,
KAPBD_BORD LIKE KBED-KBEAREST,
KEINH_BORD LIKE COEPL-MEINH,
GSMNG_TDAY LIKE PLAF-GSMNG,
KAPBD_TDAY LIKE KBED-KBEAREST,
GSMNG_DAY1 LIKE PLAF-GSMNG,
KAPBD_DAY1 LIKE KBED-KBEAREST,
GSMNG_DAY2 LIKE PLAF-GSMNG,
KAPBD_DAY2 LIKE KBED-KBEAREST,
GSMNG_DAY3 LIKE PLAF-GSMNG,
KAPBD_DAY3 LIKE KBED-KBEAREST,
GSMNG_DAY4 LIKE PLAF-GSMNG,
KAPBD_DAY4 LIKE KBED-KBEAREST,
GSMNG_DAY5 LIKE PLAF-GSMNG,
KAPBD_DAY5 LIKE KBED-KBEAREST,
STOCK_PO01 LIKE MARD-LABST,
F_GSMNG_BORD LIKE PLAF-GSMNG,
F_MEINS_BORD LIKE MSEG-MEINS,
F_KAPBD_BORD LIKE KBED-KBEAREST,
F_KEINH_BORD LIKE COEPL-MEINH,
F_GSMNG_TDAY LIKE PLAF-GSMNG,
F_MEINS_TDAY LIKE MSEG-MEINS,
F_KAPBD_TDAY LIKE KBED-KBEAREST,
F_KEINH_TDAY LIKE COEPL-MEINH,
F_GSMNG_DAY1 LIKE PLAF-GSMNG,
F_MEINS_DAY1 LIKE MSEG-MEINS,
F_KAPBD_DAY1 LIKE KBED-KBEAREST,
F_KEINH_DAY1 LIKE COEPL-MEINH,
F_GSMNG_DAY2 LIKE PLAF-GSMNG,
F_MEINS_DAY2 LIKE MSEG-MEINS,
F_KAPBD_DAY2 LIKE KBED-KBEAREST,
F_KEINH_DAY2 LIKE COEPL-MEINH,
F_GSMNG_DAY3 LIKE PLAF-GSMNG,
F_MEINS_DAY3 LIKE MSEG-MEINS,
F_KAPBD_DAY3 LIKE KBED-KBEAREST,
F_KEINH_DAY3 LIKE COEPL-MEINH,
F_GSMNG_DAY4 LIKE PLAF-GSMNG,
F_MEINS_DAY4 LIKE MSEG-MEINS,
F_KAPBD_DAY4 LIKE KBED-KBEAREST,
F_KEINH_DAY4 LIKE COEPL-MEINH,
F_GSMNG_DAY5 LIKE PLAF-GSMNG,
F_MEINS_DAY5 LIKE MSEG-MEINS,
F_KAPBD_DAY5 LIKE KBED-KBEAREST,
F_KEINH_DAY5 LIKE COEPL-MEINH,
F_GSMNG_OUTM LIKE MSEG-MENGE,
F_MEINS_OUTM LIKE MSEG-MEINS,
F_KAPBD_OUTM LIKE COEPL-LSTBTR,
F_KEINH_OUTM LIKE COEPL-MEINH,
F_GSMNG_OUTN LIKE MSEG-MENGE,
F_MEINS_OUTN LIKE MSEG-MEINS,
F_KAPBD_OUTN LIKE KBED-KBEAREST,
F_KEINH_OUTN LIKE COEPL-MEINH,
END OF IT_TEMP.
INTERNAL TABLE FOR PLANNED DATA
DATA IT_PLAF LIKE PLAF OCCURS 0 WITH HEADER LINE.
INTERNAL TABLE FOR FACTORY CALENDER AND CURRENCY
DATA: BEGIN OF IT_T001W OCCURS 0,
WERKS LIKE T001W-WERKS,
BWKEY LIKE T001W-BWKEY,
FABKL LIKE T001W-FABKL,
END OF IT_T001W.
V A R I A B L E S *
DATA: AUX_BORD LIKE SY-DATUM,
AUX_YDAY LIKE SY-DATUM,
AUX_TDAY LIKE SY-DATUM,
AUX_DAY1 LIKE SY-DATUM,
AUX_DAY2 LIKE SY-DATUM,
AUX_DAY3 LIKE SY-DATUM,
AUX_DAY4 LIKE SY-DATUM,
AUX_DAY5 LIKE SY-DATUM,
AUX_CURRENT LIKE SY-DATUM,
AUX_PREVIOUS LIKE SY-DATUM,
AUX_TECH LIKE ZTGRP-ZZPTD,
AUX_BUDAT LIKE MKPF-BUDAT,
AUX_LOW LIKE MKPF-BUDAT,
AUX_HIGH LIKE MKPF-BUDAT,
AUX_MNG LIKE MSEG-MENGE,
AUX_MENGE LIKE MSEG-MENGE,
AUX_QUANT LIKE PLAF-GSMNG,
AUX_SUM_UNIT LIKE UMADD-MSEHI,
AUX_TIMESTAMP1 LIKE CCUPEAKA-TIMESTAMP,
AUX_TIMESTAMP2 LIKE CCUPEAKA-TIMESTAMP,
AUX_BUKRS LIKE T001K-BUKRS,
AUX_BWKEY LIKE T001W-BWKEY,
AUX_GSMNG LIKE PLAF-GSMNG,
AUX_PKBMG LIKE ZZC10-PKBMG,
AUX_FILL LIKE ZZC10-PKBMG,
AUX_TOTAL LIKE ZZC10-PKBMG,
AUX_FABKL LIKE SCAL-FCALID,
AUX_WAERS LIKE MSEG-WAERS,
AUX_ZZC10_HR TYPE P DECIMALS 3,
AUX_PLAF_HR TYPE P DECIMALS 3,
AUX_KAPBD_OUTY TYPE P DECIMALS 3,
AUX_KAPBD_OUTM TYPE P DECIMALS 3,
AUX_KAPBD_BORD TYPE P DECIMALS 3,
AUX_F_KAPBD_BORD TYPE P DECIMALS 3,
AUX_F_KAPBD_TDAY TYPE P DECIMALS 3,
AUX_F_KAPBD_DAY1 TYPE P DECIMALS 3,
AUX_F_KAPBD_DAY2 TYPE P DECIMALS 3,
AUX_F_KAPBD_DAY3 TYPE P DECIMALS 3,
AUX_F_KAPBD_DAY4 TYPE P DECIMALS 3,
AUX_F_KAPBD_DAY5 TYPE P DECIMALS 3,
AUX_F_KAPBD_OUTM TYPE P DECIMALS 3,
AUX_F_KAPBD_OUTN TYPE P DECIMALS 3,
AUX_PKHD_TIME TYPE P DECIMALS 3,
AUX_LATEHOURS TYPE P DECIMALS 3,
AUX_DIFF TYPE I,
AUX_FLAG TYPE C,
AUX_SET TYPE C,
AUX_DATUMABSOLUT(5) TYPE P,
AUX_FDAY LIKE SY-DATUM,
AUX_DAYS LIKE PKHD-KWBZD,
AUX_HOURS LIKE IT_ZZC10-TIME_EMPTY,
AUX_TIME LIKE PKHD-KWBZM,
AUX_PKHD_DAYS LIKE PKHD-KWBZD,
AUX_PKHD_HOURS LIKE PKHD-KWBZM,
AUX_TMP_DAYS LIKE PKHD-KWBZM VALUE 24,
AUX_TMP_HRS LIKE PKHD-KWBZM,
AUX_FILL_DAYS LIKE PKHD-KWBZD,
AUX_FILL_HOURS LIKE AUX_HOURS,
AUX_FILL_TIME LIKE PKHD-KWBZM,
AUX_TOTAL_QTY LIKE PKHD-BEHMG,
AUX_RATID LIKE PLAF-RATID,
AUX_MATNR LIKE PLAF-MATNR,
AUX_HEADER LIKE MARA-MATNR,
AUX_ZZPTG LIKE MARC-ZZPTG,
AUX_PEDTR LIKE PLAF-PEDTR,
AUX_KRUEREST LIKE KBED-KRUEREST,
AUX_KBEAREST LIKE KBED-KBEAREST,
AUX_KRUEREST_T LIKE KBED-KRUEREST,
AUX_KBEAREST_T LIKE KBED-KBEAREST,
AUX_KEINH LIKE KBED-KEINH,
AUX_KAPBD LIKE KBED-KBEAREST,
AUX_ARBPL LIKE MKAL-MDV01,
AUX_ARBID LIKE CRHD-OBJID,
AUX_QUALF LIKE CRHD-QUALF,
AUX_SAT1800 LIKE SY-UZEIT VALUE '180000'.
S E L E C T I O N S C R E E N *
INPUT SELECTION
SELECTION-SCREEN : BEGIN OF BLOCK BL0 WITH FRAME TITLE TEXT-000.
SELECT-OPTIONS : SO_PRVBE FOR PVBE-PRVBE,
SO_MATNR FOR MARA-MATNR,
SO_ZZPTG FOR MARC-ZZPTG OBLIGATORY,
SO_WERKS FOR MARC-WERKS OBLIGATORY,
SO_BUDAT FOR MKPF-BUDAT OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK BL0.
I N I T I A L I Z A T I O N *
INITIALIZATION.
MOVE SY-DATUM TO AUX_CURRENT.
AUX_PREVIOUS = AUX_CURRENT - 1.
MOVE SY-DATUM TO SO_BUDAT-LOW.
MOVE '01' TO SO_BUDAT-LOW+6(2).
APPEND SO_BUDAT.
AUX_PREVIOUS = AUX_CURRENT - 1.
A T S E L E C T I O N - S C R E E N *
AT SELECTION-SCREEN.
CHECK ON SELECTION SCREEN
PERFORM CHECK_ON_SELECTION.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
CHECK IF BOM EXISTS FOR THE COMPONENTS
PERFORM CHECK_BOM_EXISTENCE.
GET FINISHED PRODUCT NUMBER FOR THE SUBASSEMBLIES
IF NOT IT_MARC_ZTGRP[] IS INITIAL.
LOOP AT IT_MARC_ZTGRP.
PERFORM GET_HEADER_MATERIAL USING IT_MARC_ZTGRP-MATNR.
IF NOT IT_MAT[] IS INITIAL.
PERFORM GET_FINISHED_GOOD TABLES IT_MAT.
ENDIF.
CLEAR IT_MARC_ZTGRP.
ENDLOOP.
ELSE.
MESSAGE S010 WITH 'No data present for given selection'.
ENDIF.
CHECK IF SALES DATA EXIST FOR THE FINISHED GOOD
PERFORM CHECK_SALESDATA_EXISTENCE.
GET CONTROL CYCLE AND KANBAN DATA
PERFORM GET_KANBAN_DATA.
GET VALUATION AREA DATA
PERFORM GET_VALUATION_AREA.
GET MATERIAL DOCUMENT DATA
PERFORM GET_MATERIAL_DOC_DATA.
GET KANBAN DETAILS
PERFORM GET_KANBAN_DETAILS.
E N D O F S E L E C T I O N *
END-OF-SELECTION.
IF NOT IT_TEMP[] IS INITIAL.
DISPLAY OUTPUT
PERFORM DISPLAY_OUTPUT.
ENDIF.
*& Form CHECK_ON_SELECTION
text
--> p1 text
<-- p2 text
FORM CHECK_ON_SELECTION .
CHECK IF ENTERED PLANT IS VALID
IF NOT SO_WERKS-LOW IS INITIAL AND SO_WERKS-HIGH IS INITIAL.
SELECT SINGLE * FROM MARC WHERE WERKS EQ SO_WERKS-LOW.
IF SY-SUBRC NE 0.
SET CURSOR FIELD 'SO_WERKS-LOW'.
MESSAGE E010 WITH 'Please enter a valid Plant'.
ENDIF.
ENDIF.
CHECK IF SUPPLY AREA AND PLANT IS VALID
IF NOT SO_PRVBE-LOW IS INITIAL AND SO_PRVBE-HIGH IS INITIAL.
IF NOT SO_WERKS IS INITIAL AND SO_WERKS-HIGH IS INITIAL.
SELECT SINGLE * FROM PVBE WHERE WERKS EQ SO_WERKS-LOW
AND PRVBE EQ SO_PRVBE-LOW.
IF SY-SUBRC NE 0.
SET CURSOR FIELD 'SO_PRVBE-LOW'.
MESSAGE E010 WITH 'Supply Area' SO_PRVBE-LOW 'donot belong to'
SO_WERKS-LOW.
ENDIF.
ENDIF.
ENDIF.
CHECK IF ENTERED MATERIAL NUMBER IS VALID
IF NOT SO_MATNR-LOW IS INITIAL AND SO_MATNR-HIGH IS INITIAL.
SELECT SINGLE * FROM MARA WHERE MATNR EQ SO_MATNR-LOW.
IF SY-SUBRC NE 0.
SET CURSOR FIELD 'SO_MATNR-LOW'.
MESSAGE E010 WITH 'Please enter a valid Material Number'.
ELSE.
IF NOT SO_WERKS-LOW IS INITIAL AND SO_WERKS-HIGH IS INITIAL.
SELECT SINGLE * FROM MARC WHERE MATNR EQ SO_MATNR-LOW
AND WERKS EQ SO_WERKS-LOW.
IF SY-SUBRC NE 0.
SET CURSOR FIELD 'SO_MATNR-LOW'.
MESSAGE E010 WITH 'Material' SO_MATNR-LOW
'doesnot belong to plant' SO_WERKS-LOW.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CHECK IF TECHNOLOGY GROUP AND PLANT IS VALID
IF NOT SO_ZZPTG-LOW IS INITIAL AND SO_ZZPTG-HIGH IS INITIAL.
IF NOT SO_WERKS-LOW IS INITIAL AND SO_WERKS-HIGH IS INITIAL.
SELECT SINGLE * FROM MARC WHERE WERKS EQ SO_WERKS-LOW
AND ZZPTG EQ SO_ZZPTG-LOW.
IF SY-SUBRC NE 0.
SET CURSOR FIELD 'SO_ZZPTG-LOW'.
MESSAGE E010 WITH 'Tech.Group' SO_ZZPTG-LOW 'doesnot belong to plant'
SO_WERKS-LOW.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " CHECK_ON_SELECTION
*& Form CHECK_BOM_EXISTENCE
text
--> p1 text
<-- p2 text
FORM CHECK_BOM_EXISTENCE .
JOIN MARC AND ZTGRP TABLES TO GET THE COMPONENTS BASED ON THE INPUT
CRITERIA
REFRESH IT_MARC_ZTGRP.
SELECT MARCMATNR MARCWERKS ZTGRPZZPTG ZTGRPZZPTD
INTO TABLE IT_MARC_ZTGRP
FROM MARC INNER JOIN ZTGRP
ON MARCWERKS EQ ZTGRPWERKS AND
MARCZZPTG EQ ZTGRPZZPTG
WHERE MARC~WERKS IN SO_WERKS
AND MARC~ZZPTG IN SO_ZZPTG
AND MARC~MATNR IN SO_MATNR
AND MARC~LVORM NE 'X'
AND ( MARC~BESKZ EQ 'E' OR
MARC~BESKZ EQ 'X' ).
IF NOT IT_MARC_ZTGRP[] IS INITIAL.
CHECK THE EXISTENCE OF BOM FOR THE SELECTED COMPONENTS.
IF NOT PRESENT, DELETE THE ENTRY FROM INTERNAL TABLE
LOOP AT IT_MARC_ZTGRP.
REFRESH IT_RETURN.
CALL FUNCTION 'BAPI_MAT_BOM_EXISTENCE_CHECK'
EXPORTING
MATERIAL = IT_MARC_ZTGRP-MATNR
PLANT = IT_MARC_ZTGRP-WERKS
BOMUSAGE = '1'
TABLES
RETURN = IT_RETURN.
IF NOT IT_RETURN[] IS INITIAL.
DELETE IT_MARC_ZTGRP WHERE MATNR EQ IT_MARC_ZTGRP-MATNR
AND WERKS EQ IT_MARC_ZTGRP-WERKS
AND ZZPTG EQ IT_MARC_ZTGRP-ZZPTG.
ENDIF.
CLEAR IT_MARC_ZTGRP.
ENDLOOP.
ELSE.
MESSAGE S010 WITH 'No data present for given selection'.
ENDIF.
ENDFORM. " CHECK_BOM_EXISTENCE
*& Form GET_HEADER_MATERIAL
text
-->P_IT_MARC_ZTGRP_MATNR text
FORM GET_HEADER_MATERIAL USING P_MATNR.
REFRESH IT_STPO.
GET BOM ITEM DATA FOR THE COMPONENT
SELECT * FROM STPO INTO TABLE IT_STPO WHERE IDNRK EQ P_MATNR
AND DATUV LE SO_BUDAT-LOW
AND LKENZ NE 'X'.
IF NOT IT_STPO[] IS INITIAL.
IF BOM ITEM DATA IS PRESENT FOR THE COMPONENT
REFRESH IT_MAST.
GET MATERIAL TO BOM LINK
SELECT * FROM MAST INTO TABLE IT_MAST FOR ALL ENTRIES IN IT_STPO
WHERE STLNR EQ IT_STPO-STLNR.
IF NOT IT_MAST[] IS INITIAL.
SORT IT_MAST BY MATNR.
DELETE ADJACENT DUPLICATES FROM IT_MAST COMPARING MATNR.
LOOP AT IT_MAST.
CLEAR AUX_SET.
REFRESH IT_PLANT.
GET ALL THE PLANTS FOR THE COMPONENT
SELECT MATNR WERKS FROM MARC INTO TABLE IT_PLANT
WHERE MATNR EQ IT_MAST-MATNR.
LOOP AT IT_PLANT.
REFRESH IT_RETURN.
CHECK FOR BOM EXISTENCE FOR MATERIAL IN ALL PLANTS
CALL FUNCTION 'BAPI_MAT_BOM_EXISTENCE_CHECK'
EXPORTING
MATERIAL = IT_MAST-MATNR
PLANT = IT_PLANT-WERKS
BOMUSAGE = '1'
TABLES
RETURN = IT_RETURN.
IF IT_RETURN[] IS INITIAL.
MOVE 'X' TO AUX_SET.
ENDIF.
CLEAR IT_PLANT.
ENDLOOP.
IF BOM EXISTS FOR THE COMPONENT IN ANY PLANT, MOVE THE COMPONENT
TO INTERNAL TABLE IT_MAT
IF AUX_SET EQ 'X'.
MOVE IT_MAST-MATNR TO IT_MAT-MATNR.
APPEND IT_MAT.
CLEAR IT_MAT.
ELSE.
IF BOM DOESNOT EXISTS FOR THE COMPONENT IN ALL PLANTS,
SELECT THE COMPONENT AS THE FINISHED PRODUCT
CLEAR MARA.
SELECT SINGLE * FROM MARA WHERE MATNR EQ IT_MAST-MATNR.
IF SY-SUBRC EQ 0 AND MARA-LVORM NE 'X'.
MOVE: IT_MARC_ZTGRP-MATNR TO IT_MATERIAL-IDNRK,
IT_MAST-MATNR TO IT_MATERIAL-MATNR.
APPEND IT_MATERIAL.
CLEAR IT_MATERIAL.
ENDIF.
ENDIF.
CLEAR IT_MAST.
ENDLOOP.
ENDIF.
ELSE.
IF BOM ITEM DATA DOESNOT PRESENT FOR THE COMPONENT,
CONSIDER THE COMPONENT AS FINISHED PRODUCT
CLEAR MARA.
SELECT SINGLE * FROM MARA WHERE MATNR EQ P_MATNR.
IF SY-SUBRC EQ 0 AND MARA-LVORM NE 'X'.
MOVE: IT_MARC_ZTGRP-MATNR TO IT_MATERIAL-IDNRK,
P_MATNR TO IT_MATERIAL-MATNR.
APPEND IT_MATERIAL.
CLEAR IT_MATERIAL.
ENDIF.
ENDIF.
ENDFORM. " GET_HEADER_MATERIAL
*& Form GET_FINISHED_GOOD
text
-->P_IT_MAT text
FORM GET_FINISHED_GOOD TABLES P_IT_MAT LIKE IT_MAT[].
LOOP AT P_IT_MAT.
PERFORM GET_HEADER_MATERIAL USING P_IT_MAT-MATNR.
DELETE P_IT_MAT INDEX 1.
CLEAR P_IT_MAT.
ENDLOOP.
ENDFORM. " GET_FINISHED_GOOD
*& Form CHECK_SALESDATA_EXISTENCE
text
--> p1 text
<-- p2 text
FORM CHECK_SALESDATA_EXISTENCE .
IF NOT IT_MATERIAL[] IS INITIAL.
LOOP AT IT_MATERIAL.
CLEAR VBAP.
SELECT SINGLE * FROM VBAP WHERE MATNR EQ IT_MATERIAL-MATNR.
IF SY-SUBRC NE 0.
DELETE IT_MATERIAL WHERE IDNRK EQ IT_MATERIAL-IDNRK
AND MATNR EQ IT_MATERIAL-MATNR.
ENDIF.
CLEAR IT_MATERIAL.
ENDLOOP.
ENDIF.
ENDFORM. " CHECK_SALESDATA_EXISTENCE
*& Form GET_KANBAN_DATA
text
--> p1 text
<-- p2 text
FORM GET_KANBAN_DATA.
SORT IT_MATERIAL BY IDNRK MATNR.
DELETE ADJACENT DUPLICATES FROM IT_MATERIAL COMPARING ALL FIELDS.
IF NOT IT_MATERIAL[] IS INITIAL.
GET CONTROL CYCLE HEADER DATA
SELECT * FROM PKHD INTO TABLE IT_PKHD
FOR ALL ENTRIES IN IT_MATERIAL
WHERE WERKS IN SO_WERKS
AND MATNR EQ IT_MATERIAL-IDNRK
AND PRVBE IN SO_PRVBE.
IF NOT IT_PKHD[] IS INITIAL.
GET CONTROL CYCLE ITEM DATA
SELECT * FROM PKPS INTO TABLE IT_PKPS
FOR ALL ENTRIES IN IT_PKHD
WHERE PKNUM EQ IT_PKHD-PKNUM.
IF NOT IT_PKPS[] IS INITIAL.
GET KANBAN STATUS DATA
SELECT * FROM ZZC10 INTO TABLE IT_ZZC10_TEMP
FOR ALL ENTRIES IN IT_PKPS
WHERE PKKEY EQ IT_PKPS-PKKEY
AND PKNUM EQ IT_PKPS-PKNUM
AND ZDATE BETWEEN SO_BUDAT-LOW AND SY-DATUM
AND STATUS EQ '5'.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " GET_KANBAN_DATA
*& Form GET_VALUATION_AREA
text
--> p1 text
<-- p2 text
FORM GET_VALUATION_AREA.
IF NOT IT_MARC_ZTGRP[] IS INITIAL.
SELECT WERKS BWKEY FABKL FROM T001W INTO TABLE IT_T001W
FOR ALL ENTRIES IN IT_MARC_ZTGRP
WHERE WERKS EQ IT_MARC_ZTGRP-WERKS.
ENDIF.
ENDFORM. " GET_VALUATION_AREA
*& Form GET_MATERIAL_DOC_DATA
text
--> p1 text
<-- p2 text
FORM GET_MATERIAL_DOC_DATA.
GET MATERIAL DOCUMENT HEADER DATA
SELECT * FROM MKPF INTO TABLE IT_MKPF
WHERE BUDAT IN SO_BUDAT.
IF NOT IT_MKPF[] IS INITIAL.
GET MATERIAL DOCUMENT ITEM DATA
SELECT * FROM MSEG INTO TABLE IT_MSEG
FOR ALL ENTRIES IN IT_MKPF
WHERE MBLNR EQ IT_MKPF-MBLNR
AND WERKS IN SO_WERKS
AND MJAHR EQ SY-DATUM+0(4)
AND ( BWART EQ '131' OR BWART EQ '132' ).
IF NOT IT_MATERIAL[] IS INITIAL.
LOOP AT IT_MSEG.
READ TABLE IT_MATERIAL WITH KEY IDNRK = IT_MSEG-MATNR.
IF SY-SUBRC NE 0.
DELETE IT_MSEG WHERE MATNR EQ IT_MSEG-MATNR.
ENDIF.
CLEAR: IT_MATERIAL, IT_MSEG.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " GET_MATERIAL_DOC_DATA
*& Form GET_KANBAN_DETAILS
text
--> p1 text
<-- p2 text
FORM GET_KANBAN_DETAILS .
SORT IT_PKHD BY PKNUM.
IF NOT IT_ZZC10_TEMP[] IS INITIAL.
LOOP AT IT_ZZC10_TEMP.
CLEAR: AUX_FILL, AUX_PKBMG.
MOVE IT_ZZC10_TEMP] TO IT_ZZC10[.
DELETE IT_ZZC10 WHERE MATNR NE IT_ZZC10_TEMP-MATNR
AND WERKS NE IT_ZZC10_TEMP-WERKS.
LOOP AT IT_ZZC10.
CLEAR: AUX_TIMESTAMP1, AUX_TIMESTAMP2, AUX_ZZC10_HR, AUX_DIFF.
EMPTY DATE GREATER THAN FULL DATE
IF IT_ZZC10-DATE_EMPTY GT IT_ZZC10-DATE_FULL.
CONCATENATE IT_ZZC10-DATE_EMPTY IT_ZZC10-TIME_EMPTY
INTO AUX_TIMESTAMP1.
CONCATENATE IT_ZZC10-DATE_FULL IT_ZZC10-TIME_FULL
INTO AUX_TIMESTAMP2.
CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'
EXPORTING
TIMESTAMP1 = AUX_TIMESTAMP1
TIMESTAMP2 = AUX_TIMESTAMP2
IMPORTING
DIFFERENCE = AUX_DIFF.
AUX_ZZC10_HR = AUX_DIFF / 3600.
FULL DATE GREATER THAN EMPTY DATE
ELSEIF IT_ZZC10-DATE_FULL GT IT_ZZC10-DATE_EMPTY.
CONCATENATE IT_ZZC10-DATE_EMPTY IT_ZZC10-TIME_EMPTY
INTO AUX_TIMESTAMP2.
CONCATENATE IT_ZZC10-DATE_FULL IT_ZZC10-TIME_FULL
INTO AUX_TIMESTAMP1.
CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'
EXPORTING
TIMESTAMP1 = AUX_TIMESTAMP1
TIMESTAMP2 = AUX_TIMESTAMP2
IMPORTING
DIFFERENCE = AUX_DIFF.
AUX_ZZC10_HR = AUX_DIFF / 3600.
FULL DATE EQUAL TO EMPTY DATE
ELSEIF IT_ZZC10-DATE_FULL EQ IT_ZZC10-DATE_EMPTY.
EMPTY TIME GREATER THAN FULL TIME
IF IT_ZZC10-TIME_EMPTY GT IT_ZZC10-TIME_FULL.
CONCATENATE IT_ZZC10-DATE_EMPTY IT_ZZC10-TIME_EMPTY
INTO AUX_TIMESTAMP1.
CONCATENATE IT_ZZC10-DATE_FULL IT_ZZC10-TIME_FULL
INTO AUX_TIMESTAMP2.
CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'
EXPORTING
TIMESTAMP1 = AUX_TIMESTAMP1
TIMESTAMP2 = AUX_TIMESTAMP2
IMPORTING
DIFFERENCE = AUX_DIFF.
AUX_ZZC10_HR = AUX_DIFF / 3600.
FULL TIME GREATER THAN EMPTY TIME
ELSEIF IT_ZZC10-TIME_FULL GT IT_ZZC10-TIME_EMPTY.
CONCATENATE IT_ZZC10-DATE_EMPTY IT_ZZC10-TIME_EMPTY
INTO AUX_TIMESTAMP2.
CONCATENATE IT_ZZC10-DATE_FULL IT_ZZC10-TIME_FULL
INTO AUX_TIMESTAMP1.
CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'
EXPORTING
TIMESTAMP1 = AUX_TIMESTAMP1
TIMESTAMP2 = AUX_TIMESTAMP2
IMPORTING
DIFFERENCE = AUX_DIFF.
AUX_ZZC10_HR = AUX_DIFF / 3600.
FULL TIME EQUAL TO EMPTY TIME
ELSEIF IT_ZZC10-TIME_FULL EQ IT_ZZC10-TIME_EMPTY.
AUX_ZZC10_HR = 0.
ENDIF.
ENDIF.
READ TABLE IT_PKHD WITH KEY PKNUM = IT_ZZC10-PKNUM
BINARY SEARCH.
IF SY-SUBRC EQ 0.
CLEAR: AUX_TIMESTAMP1, AUX_TIMESTAMP2,
AUX_PKHD_DAYS, AUX_PKHD_HOURS, AUX_TMP_DAYS,
AUX_PKHD_TIME.
AUX_PKHD_DAYS = IT_PKHD-KWBZD.
AUX_PKHD_HOURS = IT_PKHD-KWBZM.
IF AUX_PKHD_DAYS NE 0.
AUX_TMP_DAYS = AUX_PKHD_DAYS * 24.
AUX_PKHD_TIME = AUX_TMP_DAYS + AUX_PKHD_HOURS.
ELSE.
AUX_PKHD_TIME = AUX_PKHD_HOURS.
ENDIF.
COMPARE STATUS CHANGE TIME WITH REPLENISHMENT LEAD TIME
IF AUX_ZZC10_HR GT AUX_PKHD_TIME.
CLEAR: AUX_LATEHOURS.
LATE HOURS
AUX_LATEHOURS = AUX_ZZC10_HR - AUX_PKHD_TIME.
LATE QUANTITY FOR +1 DAY
IF AUX_LATEHOURS LE 24.
IT_TEMP-QTY_1 = IT_TEMP-QTY_1 + IT_ZZC10-PKBMG.
LATE QUANTITY FOR +2 DAYS
ELSEIF AUX_LATEHOURS GT 24
AND AUX_LATEHOURS LE 48.
IT_TEMP-QTY_2 = IT_TEMP-QTY_2 + IT_ZZC10-PKBMG.
LATE QUANTITY FOR +3 DAYS
ELSEIF AUX_LATEHOURS GT 48
AND AUX_LATEHOURS LE 72.
IT_TEMP-QTY_3 = IT_TEMP-QTY_3 + IT_ZZC10-PKBMG.
LATE QUANTITY FOR +4 DAYS
ELSEIF AUX_LATEHOURS GT 72
AND AUX_LATEHOURS LE 96.
IT_TEMP-QTY_4 = IT_TEMP-QTY_4 + IT_ZZC10-PKBMG.
LATE QUANTITY FOR +5 DAYS
ELSEIF AUX_LATEHOURS GT 96
AND AUX_LATEHOURS LE 120.
IT_TEMP-QTY_5 = IT_TEMP-QTY_5 + IT_ZZC10-PKBMG.
LATE QUANTITY FOR MORE THAN 5 DAYS
ELSEIF AUX_LATEHOURS GT 120.
IT_TEMP-QTY_6 = IT_TEMP-QTY_6 + IT_ZZC10-PKBMG.
ENDIF.
TOTAL KANBAN LATE QUANTITIES
AUX_PKBMG = AUX_PKBMG + IT_ZZC10-PKBMG.
ELSE.
AUX_FILL = AUX_FILL + IT_ZZC10-PKBMG.
CONTINUE.
ENDIF.
ENDIF.
ENDLOOP.
SUBASSEMBLY PART NUMBER
IT_TEMP-MATNR = IT_ZZC10-MATNR.
FINISHED GOOD
READ TABLE IT_MATERIAL WITH KEY IDNRK = IT_ZZC10-MATNR.
IT_TEMP-FINISHED = IT_MATERIAL-MATNR.
TECHNOLOGY GROUP
READ TABLE IT_MARC_ZTGRP WITH KEY WERKS = IT_ZZC10-WERKS
MATNR = IT_ZZC10-MATNR.
IF SY-SUBRC EQ 0.
MOVE IT_MARC_ZTGRP-ZZPTD TO IT_TEMP-TECH.
ENDIF.
NUMBER OF KANBAN CONTAINERS
IT_TEMP-BEHAZ = IT_PKHD-BEHAZ.
KANBAN QUANTITY
IT_TEMP-BEHMG = IT_PKHD-BEHMG.
LATE HOURS
AUX_LATEHOURS = AUX_ZZC10_HR - AUX_PKHD_TIME.
IT_TEMP-LATEHOURS = AUX_LATEHOURS.
REPLENISHMENT LEAD TIME
IT_TEMP-REPL_LEAD_TIME = AUX_PKHD_TIME.
KANBAN LATE QUANTITIES
IT_TEMP-GSMNG = AUX_PKBMG.
FILL RATE
AUX_TOTAL = AUX_PKBMG + AUX_FILL.
IT_TEMP-FILLRATE = ( AUX_FILL / AUX_TOTAL ) * 100.
GET STOCK IN PO01
REFRESH IT_MARD.
SELECT LABST FROM MARD INTO TABLE IT_MARD
WHERE MATNR EQ IT_ZZC10-MATNR
AND WERKS EQ IT_ZZC10-WERKS.
IF SY-SUBRC EQ 0.
LOOP AT IT_MARD.
SUM.
ENDLOOP.
MOVE IT_MARD-LABST TO IT_TEMP-STOCK_PO01.
CLEAR IT_MARD.
ENDIF.
GET YESTERDAY'S OUTPUT QUANTITY
PERFORM GET_YESTERDAY_QTY.
CUMULATIVE OUTPUT FOR ACTUAL MONTH
PERFORM GET_CUMULATIVE_OUTPUT.
GET BACKORDER SUBASSEMBLY DATA
PERFORM GET_BACKORDER_QTY.
GET BACKORDER FINISHED GOODS, TODAY, +1, +2, +3, +4, +5
AND AVERAGE OUPTUT NEEDED DATA
PERFORM GET_FINISHEDGOODS_DATA.
GET DATA FOR ACTUAL MONTH DELIVERED
PERFORM GET_ACTUAL_MONTH_DATA.
APPEND IT_TEMP.
CLEAR IT_TEMP.
DELETE IT_ZZC10_TEMP WHERE MATNR EQ IT_ZZC10_TEMP-MATNR
AND WERKS EQ IT_ZZC10_TEMP-WERKS.
CLEAR: IT_ZZC10, IT_ZZC10_TEMP, IT_PKHD.
ENDLOOP.
ENDIF.
ENDFORM. " GET_KANBAN_DETAILS
*& Form GET_YESTERDAY_QTY
text
--> p1 text
<-- p2 text
FORM GET_YESTERDAY_QTY .
CLEAR: AUX_BUKRS, AUX_WAERS.
READ TABLE IT_T001W WITH KEY WERKS = IT_PKHD-WERKS.
IF SY-SUBRC EQ 0.
CLEAR AUX_FABKL.
MOVE IT_T001W-FABKL TO AUX_FABKL.
SELECT SINGLE BUKRS INTO AUX_BUKRS FROM T001K
WHERE BWKEY = IT_T001W-BWKEY.
IF SY-SUBRC EQ 0.
SELECT SINGLE WAERS INTO AUX_WAERS FROM T001
WHERE BUKRS = AUX_BUKRS.
ENDIF.
IF 'WD;WF;WN;WP;WU' CS AUX_FABKL.
AUX_FABKL(1) = 'P'.
ENDIF.
MOVE SY-DATUM TO AUX_DATUMABSOLUT.
PERFORM WEEKDAY USING AUX_DATUMABSOLUT.
MOVE 'W' TO AUX_FLAG.
PERFORM CHECK_WORKING_DAY CHANGING AUX_FLAG.
IF AUX_DATUMABSOLUT = 0.
AUX_YDAY = SY-DATUM.
ELSEIF AUX_DATUMABSOLUT = 1.
AUX_YDAY = SY-DATUM - 1.
ELSEIF AUX_FLAG = 'F'.
AUX_YDAY = SY-DATUM.
ENDIF.
IF AUX_DATUMABSOLUT = 0 OR
AUX_DATUMABSOLUT = 1 OR
AUX_FLAG = 'F'.
PERFORM DATE_WITH_OFFSET USING 0 CHANGING AUX_TDAY.
PERFORM DATE_WITH_OFFSET USING 1 CHANGING AUX_DAY1.
PERFORM DATE_WITH_OFFSET USING 2 CHANGING AUX_DAY2.
PERFORM DATE_WITH_OFFSET USING 3 CHANGING AUX_DAY3.
PERFORM DATE_WITH_OFFSET USING 4 CHANGING AUX_DAY4.
PERFORM DATE_WITH_OFFSET USING 5 CHANGING AUX_DAY5.
ELSE.
PERFORM DATE_WITH_OFFSET USING 0 CHANGING AUX_YDAY.
PERFORM DATE_WITH_OFFSET USING 1 CHANGING AUX_TDAY.
PERFORM DATE_WITH_OFFSET USING 2 CHANGING AUX_DAY1.
PERFORM DATE_WITH_OFFSET USING 3 CHANGING AUX_DAY2.
PERFORM DATE_WITH_OFFSET USING 4 CHANGING AUX_DAY3.
PERFORM DATE_WITH_OFFSET USING 5 CHANGING AUX_DAY4.
PERFORM DATE_WITH_OFFSET USING 6 CHANGING AUX_DAY5.
ENDIF.
AUX_BORD = '19000101'.
GET PLANNED ORDER DATA FOR YESTERDAY
REFRESH IT_PLAF.
CLEAR: AUX_KAPBD, AUX_KBEAREST, AUX_KRUEREST, AUX_GSMNG.
SELECT * FROM PLAF INTO TABLE IT_PLAF
WHERE MATNR EQ IT_PKHD-MATNR
AND PLWRK EQ IT_PKHD-WERKS
AND ( PAART EQ 'KD' OR PAART EQ 'PE' )
AND RATID GT 0
AND PEDTR EQ AUX_YDAY.
IF NOT IT_PLAF[] IS INITIAL.
LOOP AT IT_PLAF.
REFRESH IT_KBED_KAKO.
SELECT KBED~KBEAREST KBED~KRUEREST KBED~KEINH
FROM KBED INNER JOIN KAKO
ON KBED~KAPID EQ KAKO~KAPID
INTO TABLE IT_KBED_KAKO
WHERE KBED~BEDID = IT_PLAF-RATID
AND KAKO~KAPAR = '001'.
IF NOT IT_KBED_KAKO[] IS INITIAL.
LOOP AT IT_KBED_KAKO.
IF IT_KBED_KAKO-KEINH NE 'STD'.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = IT_KBED_KAKO-KBEAREST
UNIT_IN = IT_KBED_KAKO-KEINH
UNIT_OUT = 'STD'
IMPORTING
OUTPUT = IT_KBED_KAKO-KBEAREST.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = IT_KBED_KAKO-KRUEREST
UNIT_IN = IT_KBED_KAKO-KEINH
UNIT_OUT = 'STD'
IMPORTING
OUTPUT = IT_KBED_KAKO-KRUEREST.
ENDIF.
ADD IT_KBED_KAKO-KBEAREST TO AUX_KBEAREST.
ADD IT_KBED_KAKO-KRUEREST TO AUX_KRUEREST.
CLEAR IT_KBED_KAKO.
ENDLOOP.
AUX_KAPBD = AUX_KBEAREST + AUX_KRUEREST.
ENDIF.
CLEAR IT_PLAF.
ENDLOOP.
ENDIF.
READ TABLE IT_KBED_KAKO INDEX 1.
MOVE: AUX_KAPBD TO IT_TEMP-KAPBD_OUTY,
IT_KBED_KAKO-KEINH TO IT_TEMP-KEINH_OUTY.
GET OUTPUT QUANTITY FOR YESTERDAY
REFRESH: IT_MKPF, IT_MSEG.
CLEAR: AUX_MENGE.
SELECT * FROM MKPF INTO TABLE IT_MKPF
WHERE BUDAT EQ AUX_PREVIOUS.
IF NOT IT_MKPF[] IS INITIAL.
GET MATERIAL DOCUMENT ITEM DATA
SELECT * FROM MSEG INTO TABLE IT_MSEG
FOR ALL ENTRIES IN IT_MKPF
WHERE MBLNR EQ IT_MKPF-MBLNR
AND MATNR IN SO_MATNR
AND WERKS IN SO_WERKS
AND MJAHR EQ SY-DATUM+0(4)
AND ( BWART EQ '131' OR BWART EQ '132' ).
IF NOT IT_MSEG[] IS INITIAL.
LOOP AT IT_MSEG.
AUX_MENGE = AUX_MENGE + IT_MSEG-MENGE.
CLEAR IT_MSEG.
ENDLOOP.
ENDIF.
ENDIF.
READ TABLE IT_MSEG INDEX 1.
MOVE: AUX_MENGE TO IT_TEMP-GSMNG_OUTY,
IT_MSEG-MEINS TO IT_TEMP-MEINS_OUTY.
CLEAR IT_T001W.
ENDIF.
ENDFORM. " GET_YESTERDAY_QTY
*& Form GET_BACKORDER_QTY
text
--> p1 text
<-- p2 text
FORM GET_BACKORDER_QTY .
GET PLANNED ORDER DATA FOR BACKORDER
REFRESH IT_PLAF.
CLEAR: AUX_KAPBD, AUX_KBEAREST, AUX_KRUEREST, AUX_GSMNG, AUX_QUANT.
SELECT * FROM PLAF INTO TABLE IT_PLAF
WHERE MATNR EQ IT_ZZC10-MATNR
AND PLWRK EQ IT_ZZC10-WERKS
AND ( PAART EQ 'KD' OR PAART EQ 'PE' )
AND RATID GT 0
AND PEDTR GE SO_BUDAT-LOW
AND PEDTR LE SY-DATUM.
IF NOT IT_PLAF[] IS INITIAL.
LOOP AT IT_PLAF.
CLEAR: AUX_TIMESTAMP1, AUX_TIMESTAMP2, AUX_PLAF_HR, AUX_DIFF.
EMPTY DATE GREATER THAN FULL DATE
CONCATENATE SY-DATUM SY-UZEIT
INTO AUX_TIMESTAMP1.
CONCATENATE IT_PLAF-PEDTR IT_PLAF-PEDTI
INTO AUX_TIMESTAMP2.
CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'
EXPORTING
TIMESTAMP1 = AUX_TIMESTAMP1
TIMESTAMP2 = AUX_TIMESTAMP2
IMPORTING
DIFFERENCE = AUX_DIFF.
AUX_PLAF_HR = AUX_DIFF / 3600.
IF AUX_PLAF_HR > AUX_PKHD_TIME.
AUX_GSMNG = AUX_GSMNG + IT_PLAF-GSMNG.
REFRESH IT_KBED_KAKO.
SELECT KBEDKBEAREST KBEDKRUEREST KBED~KEINH
FROM KBED INNER JOIN KAKO
ON KBEDKAPID EQ KAKOKAPID
INTO TABLE IT_KBED_KAKO
WHERE KBED~BEDID = IT_PLAF-RATID
AND KAKO~KAPAR = '001'.
IF NOT IT_KBED_KAKO[] IS INITIAL.
LOOP AT IT_KBED_KAKO.
IF IT_KBED_KAKO-KEINH NE 'STD'.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = IT_KBED_KAKO-KBEAREST
UNIT_IN = IT_KBED_KAKO-KEINH
UNIT_OUT = 'STD'
IMPORTING
OUTPUT = IT_KBED_KAKO-KBEAREST.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = IT_KBED_KAKO-KRUEREST
UNIT_IN = IT_KBED_KAKO-KEINH
UNIT_OUT = 'STD'
IMPORTING
OUTPUT = IT_KBED_KAKO-KRUEREST.
ENDIF.
AUX_KBEAREST = AUX_KBEAREST + IT_KBED_KAKO-KBEAREST.
AUX_KRUEREST = AUX_KRUEREST + IT_KBED_KAKO-KRUEREST.
CLEAR IT_KBED_KAKO.
ENDLOOP.
AUX_KAPBD = AUX_KBEAREST + AUX_KRUEREST.
ENDIF.
ENDIF.
ENDLOOP.
READ TABLE IT_PLAF INDEX 1.
MOVE: AUX_GSMNG TO IT_TEMP-GSMNG_BORD,
IT_PLAF-MEINS TO IT_TEMP-MEINS_BORD.
READ TABLE IT_KBED_KAKO INDEX 1.
MOVE: AUX_KAPBD TO IT_TEMP-KAPBD_BORD,
IT_KBED_KAKO-KEINH TO IT_TEMP-KEINH_BORD.
ENDIF.
ENDFORM. " GET_BACKORDER_QTY
*& Form WEEKDAY
text
-->P_AUX_DATUMABSOLUT text
FORM WEEKDAY USING P_DATUMABSOLUT.
P_DATUMABSOLUT = P_DATUMABSOLUT MOD 7.
ENDFORM. " WEEKDAY
*& Form CHECK_WORKING_DAY
text
<--P_AUX_FLAG text
FORM CHECK_WORKING_DAY CHANGING P_FLAG.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
DATE = SY-DATUM
FACTORY_CALENDAR_ID = AUX_FABKL
IMPORTING
DATE = AUX_FDAY
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
IF AUX_FDAY NE SY-DATUM.
AUX_FLAG = 'F'.
ENDIF.
ENDFORM. " CHECK_WORKING_DAY
*& Form DATE_WITH_OFFSET
text
-->P_0 text
<--P_AUX_TDAY text
FORM DATE_WITH_OFFSET USING AUX_OFFSET
CHANGING P_TDAY.
DATA:
AUX_CALENDARDATE LIKE SCAL-DATE,
AUX_FACTORYDATE LIKE SCAL-FACDATE.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
DATE = SY-DATUM
FACTORY_CALENDAR_ID = AUX_FABKL
IMPORTING
FACTORYDATE = AUX_FACTORYDATE
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
AUX_FACTORYDATE = AUX_FACTORYDATE + AUX_OFFSET.
CALL FUNCTION 'FACTORYDATE_CONVERT_TO_DATE'
EXPORTING
FACTORYDATE = AUX_FACTORYDATE
FACTORY_CALENDAR_ID = AUX_FABKL
IMPORTING
DATE = AUX_CALENDARDATE
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
FACTORYDATE_AFTER_RANGE = 2
FACTORYDATE_BEFORE_RANGE = 3
FACTORYDATE_INVALID = 4
FACTORY_CALENDAR_ID_MISSING = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
P_TDAY = AUX_CALENDARDATE.
ENDFORM. " DATE_WITH_OFFSET
*& Form GET_CUMULATIVE_OUTPUT
text
--> p1 text
<-- p2 text
FORM GET_CUMULATIVE_OUTPUT .
CLEAR: AUX_LOW, AUX_HIGH.
MOVE: SY-DATUM TO AUX_LOW,
SY-DATUM TO AUX_HIGH.
MOVE: '01' TO AUX_LOW+6(2),
'31' TO AUX_HIGH+6(2).
REFRESH IT_MKPF_MSEG.
CLEAR AUX_MNG.
SELECT MKPFMBLNR MKPFMJAHR MKPF~BUDAT
MSEGBWART MSEGMATNR MSEGMENGE MSEGMEINS MSEGDMBTR MSEGWERKS
INTO TABLE IT_MKPF_MSEG
FROM MKPF JOIN MSEG
ON MKPFMBLNR EQ MSEGMBLNR
WHERE MKPF~BUDAT BETWEEN AUX_LOW AND AUX_HIGH
AND MKPF~MJAHR EQ AUX_CURRENT+0(4)
AND MKPF~VGART EQ 'WS'
AND MSEG~ZEILE EQ 1
AND MSEG~WERKS EQ SO_WERKS
AND MSEG~MATNR EQ IT_PKHD-MATNR
AND MSEG~BWART IN ('131', '132').
IF NOT IT_MKPF_MSEG[] IS INITIAL.
LOOP AT IT_MKPF_MSEG.
AUX_MNG = AUX_MNG + IT_MKPF_MSEG-MENGE.
CLEAR IT_MKPF_MSEG.
ENDLOOP.
ENDIF.
MOVE AUX_MNG TO IT_TEMP-GSMNG_OUTM.
READ TABLE IT_MKPF_MSEG INDEX 1.
MOVE IT_MKPF_MSEG-MEINS TO IT_TEMP-MEINS_OUTM.
REFRESH IT_COBK.
SELECT DISTINCT BLPP~RUECK FROM BLPK INNER JOIN BLPP
ON BLPKPRTNR EQ BLPPPRTNR
INTO TABLE IT_COBK
WHERE BLPK~WERKS EQ SO_WERKS
AND BLPK~MATNR EQ SO_MATNR
AND BLPK~DATUM BETWEEN AUX_LOW
AND AUX_HIGH
AND BLPP~PRTPS EQ '0002'.
IF NOT IT_COBK[] IS INITIAL.
REFRESH IT_COEPL.
SELECT KOKRS BELNR FROM COBK
INTO CORRESPONDING FIELDS OF TABLE IT_COEPL
FOR ALL ENTRIES IN IT_COBK
WHERE REFBT EQ 'R'
AND REFBN EQ IT_COBK-RUECK
AND BLDAT BETWEEN AUX_LOW AND AUX_HIGH.
CLEAR IT_CAPACITIES.
REFRESH IT_CAPACITIES.
LOOP AT IT_COEPL.
SELECT LSBBTR MEINB FROM COEPL
APPENDING CORRESPONDING FIELDS OF TABLE IT_CAPACITIES
WHERE KOKRS EQ IT_COEPL-KOKRS
AND BELNR EQ IT_COEPL-BELNR
AND OBJNR LIKE '%DLABOR'.
CALL FUNCTION 'UNIT_SUM'
IMPORTING
QUANTITY_SUM = IT_TEMP-KAPBD_OUTM
UNIT_SUM = AUX_SUM_UNIT
TABLES
QUANTITIES_UNITS = IT_CAPACITIES.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = IT_TEMP-KAPBD_OUTM
UNIT_IN = AUX_SUM_UNIT
UNIT_OUT = 'STD'
IMPORTING
OUTPUT = IT_TEMP-KAPBD_OUTM.
ENDLOOP.
READ TABLE IT_CAPACITIES INDEX 1.
MOVE IT_CAPACITIES-MEINB TO IT_TEMP-KEINH_OUTM.
ENDIF.
ENDFORM. " GET_CUMULATIVE_OUTPUT
*& Form GET_FINISHEDGOODS_DATA
text
--> p1 text
<-- p2 text
FORM GET_FINISHEDGOODS_DATA .
GET PLANNED ORDER DATA
REFRESH IT_PLAF.
CLEAR: AUX_KAPBD, AUX_KBEAREST, AUX_KRUEREST, AUX_GSMNG.
SELECT * FROM PLAF INTO TABLE IT_PLAF
WHERE MATNR EQ IT_TEMP-FINISHED
AND ( PAART EQ 'KD' OR PAART EQ 'PE' )
AND RATID GT 0
AND PEDTR GE AUX_BORD
AND PEDTR LE AUX_DAY5.
IF NOT IT_PLAF[] IS INITIAL.
LOOP AT IT_PLAF.
CLEAR: AUX_KAPBD, AUX_GSMNG.
REFRESH IT_KBED_KAKO.
SELECT KBEDKBEAREST KBEDKRUEREST KBED~KEINH
FROM KBED INNER JOIN KAKO
ON KBEDKAPID EQ KAKOKAPID
INTO TABLE IT_KBED_KAKO
WHERE KBED~BEDID = IT_PLAF-RATID
AND KAKO~KAPAR = '001'.
IF NOT IT_KBED_KAKO[] IS INITIAL.
CLEAR AUX_KAPBD.
LOOP AT IT_KBED_KAKO.
IF IT_KBED_KAKO-KEINH NE 'STD'.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = IT_KBED_KAKO-KBEAREST
UNIT_IN = IT_KBED_KAKO-KEINH
UNIT_OUT = 'STD'
IMPORTING
OUTPUT = IT_KBED_KAKO-KBEAREST.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = IT_KBED_KAKO-KRUEREST
UNIT_IN = IT_KBED_KAKO-KEINH
UNIT_OUT = 'STD'
IMPORTING
OUTPUT = IT_KBED_KAKO-KRUEREST.
ENDIF.
ADD IT_KBED_KAKO-KBEAREST TO AUX_KBEAREST.
ADD IT_KBED_KAKO-KRUEREST TO AUX_KRUEREST.
CLEAR IT_KBED_KAKO.
ENDLOOP.
AUX_KAPBD = AUX_KBEAREST + AUX_KRUEREST.
ENDIF.
READ TABLE IT_KBED_KAKO INDEX 1.
CASE IT_PLAF-PEDTR.
WHEN AUX_DAY5.
AUX_GSMNG = IT_PLAF-GSMNG.
IT_TEMP-F_GSMNG_DAY5 = IT_TEMP-F_GSMNG_DAY5 + AUX_GSMNG.
IT_TEMP-F_MEINS_DAY5 = IT_PLAF-MEINS.
IT_TEMP-F_KAPBD_DAY5 = IT_TEMP-F_KAPBD_DAY5 + AUX_KAPBD.
IT_TEMP-F_KEINH_DAY5 = IT_KBED_KAKO-KEINH.
WHEN AUX_DAY4.
AUX_GSMNG = IT_PLAF-GSMNG.
IT_TEMP-F_GSMNG_DAY4 = IT_TEMP-F_GSMNG_DAY4 + AUX_GSMNG.
IT_TEMP-F_MEINS_DAY4 = IT_PLAF-MEINS.
IT_TEMP-F_KAPBD_DAY4 = IT_TEMP-F_KAPBD_DAY4 + AUX_KAPBD.
IT_TEMP-F_KEINH_DAY4 = IT_KBED_KAKO-KEINH.
WHEN AUX_DAY3.
AUX_GSMNG = IT_PLAF-GSMNG.
IT_TEMP-F_GSMNG_DAY3 = IT_TEMP-F_GSMNG_DAY3 + AUX_GSMNG.
IT_TEMP-F_MEINS_DAY3 = IT_PLAF-MEINS.
IT_TEMP-F_KAPBD_DAY3 = IT_TEMP-F_KAPBD_DAY3 + AUX_KAPBD.
IT_TEMP-F_KEINH_DAY3 = IT_KBED_KAKO-KEINH.
WHEN AUX_DAY2.
AUX_GSMNG = IT_PLAF-GSMNG.
IT_TEMP-F_GSMNG_DAY2 = IT_TEMP-F_GSMNG_DAY2 + AUX_GSMNG.
IT_TEMP-F_MEINS_DAY2 = IT_PLAF-MEINS.
IT_TEMP-F_KAPBD_DAY2 = IT_TEMP-F_KAPBD_DAY2 + AUX_KAPBD.
IT_TEMP-F_KEINH_DAY2 = IT_KBED_KAKO-KEINH.
WHEN AUX_DAY1.
AUX_GSMNG = IT_PLAF-GSMNG.
IT_TEMP-F_GSMNG_DAY1 = IT_TEMP-F_GSMNG_DAY1 + AUX_GSMNG.
IT_TEMP-F_MEINS_DAY1 = IT_PLAF-MEINS.
IT_TEMP-F_KAPBD_DAY1 = IT_TEMP-F_KAPBD_DAY1 + AUX_KAPBD.
IT_TEMP-F_KEINH_DAY1 = IT_KBED_KAKO-KEINH.
WHEN AUX_TDAY.
AUX_GSMNG = IT_PLAF-GSMNG.
IT_TEMP-F_GSMNG_TDAY = IT_TEMP-F_GSMNG_TDAY + AUX_GSMNG.
IT_TEMP-F_MEINS_TDAY = IT_PLAF-MEINS.
IT_TEMP-F_KAPBD_TDAY = IT_TEMP-F_KAPBD_TDAY + AUX_KAPBD.
IT_TEMP-F_KEINH_TDAY = IT_KBED_KAKO-KEINH.
WHEN OTHERS.
AUX_GSMNG = IT_PLAF-GSMNG.
IT_TEMP-F_GSMNG_BORD = IT_TEMP-F_GSMNG_BORD + AUX_GSMNG.
IT_TEMP-F_MEINS_BORD = IT_PLAF-MEINS.
IT_TEMP-F_KAPBD_BORD = IT_TEMP-F_KAPBD_BORD + AUX_KAPBD.
IT_TEMP-F_KEINH_BORD = IT_KBED_KAKO-KEINH.
ENDCASE.
IT_TEMP-F_GSMNG_OUTN = IT_TEMP-F_GSMNG_OUTN + AUX_GSMNG.
IT_TEMP-F_KAPBD_OUTN = IT_TEMP-F_KAPBD_OUTN + AUX_KAPBD.
ENDLOOP.
READ TABLE IT_PLAF INDEX 1.
MOVE IT_PLAF-MEINS TO IT_TEMP-F_MEINS_OUTN.
READ TABLE IT_KBED_KAKO INDEX 1.
MOVE IT_KBED_KAKO-KEINH TO IT_TEMP-F_KEINH_OUTN.
ENDIF.
ENDFORM. " GET_FINISHEDGOODS_DATA
*& Form GET_ACTUAL_MONTH_DATA
text
--> p1 text
<-- p2 text
FORM GET_ACTUAL_MONTH_DATA .
CLEAR: AUX_LOW, AUX_HIGH.
MOVE: '01' TO SO_BUDAT-LOW+6(2),
SO_BUDAT-LOW TO AUX_LOW,
'31' TO SO_BUDAT-LOW+6(2),
SO_BUDAT-LOW TO AUX_HIGH.
REFRESH IT_MKPF_MSEG.
CLEAR AUX_MNG.
SELECT MKPFMBLNR MKPFMJAHR MKPF~BUDAT
MSEGBWART MSEHi Ramya,
Your program contains a lot of BIG standard tables, these tables
usually contain huge amount of data,
plus you have used SELECT * in many places, try to avoid that and replace with only those field names that are reqd.
even the joins are on huge tables, performance could improve on those if you can put some more conditions or keys to the joins to make it more specific.
even after that if it gives the Runtime Error then you have 2 options:
1. Ask your Basis to increase Time limit for program executing in foreground.
2. Execute your program in Background Mode.
Regards,
Samson Rodrigues. -
ITunes on Windows 7 performance issues - slow and hangs
Is there any way to improve performance of iTunes running on Windows 7?
It has always been slow with lots of application hangs and stalls that will resolve themselves if you wait for iTunes to catch up, but I find it incredibly frustrating.
For example, when iTunes starts and if it is checking podcasts, the entire application is unresponsive until it finishes checking and refreshing podcasts.
Alternately, when viewing my iPad Air and looking at the list of apps installed via iTunes it can take 30 seconds before iTunes responds.
Considering that this is running on a system with a quad-core Haswell processor at 3.2Ghz, 16GB of RAM and Windows 7 x64 it is pretty unacceptable.
The efficiency at which iTunes operates is just appalling. I can run Adobe Photoshop and many more memory hungry and processor intensive applications than iTunes and get better performance than what I see in iTunes.
This is not specific to my system either. All of my family members have iPhones and their own computers and this performance issue exists on every computer I have ever run iTunes on.
Is there any way to manually tune performance because this is pretty crappy. It's been bugging me for years, but today just kind of feels like the last straw.I guess the answer is, "It's terribad, live with it"
-
Performance Issue in a ABAP Report
Hi All,
I am facing a big performance issue in a abap program which produce the cash flow details our group of company. This is the logic I used to develop the report. (It is a SAP Script)
- First I am getting the closed customer payment records from the table BSAD ( eg: - Type 'DZ')
- Then I am getting the correcponding invoices from the BSAD using the same BELNR ( eg :- Type <> 'DZ')
- Then checking the GL Entry (BSIS) for the correspongding records which select in the second stage.
- In a Z tabel I am keeping the account list by grouping seperate section ( Eg: - Customer recipts, fixed assets...etc).
I have done the same thing to get the open Item balances also.
Report is correct and running perfectly, but my issue is it's takeing long time to process. Because of this I made this report to run as a background job. But still it is taking such a long time. ( For Eg: - If 1000 records selected from the first stage, it will take about more than onr hour to process, which is not good enough to run in a live environment)
Pls advice me how to improve the preformance of this.Hi Ravi,
I am sorry I had problem in my internet connection yesterday, because of that i couldn't reply u. Here is my code. I don't is there any way to send the code as a attachement since it is a little bit big one. I am going to paste that here any way.
Here zcashflow_matrix is the "Z" table where I am going to keep my account details by grouping.
REPORT ZCASH_FLOW.
INCLUDE <%_LIST>.
* Author Thanura ....... *
TYPES :BEGIN OF ty_voucher1,
kunnr LIKE bseg-kunnr,
dmbtr LIKE bseg-dmbtr,
belnr LIKE bseg-belnr,
hkont LIKE bseg-hkont,
shkzg LIKE bseg-shkzg,
xblnr LIKE bsad-xblnr,
budat LIKE bsad-bldat,
blart LIKE bsad-blart,
bldat LIKE bsad-bldat,
lifnr LIKE bseg-lifnr,
END OF ty_voucher1.
DATA :it_voucher1 TYPE STANDARD TABLE OF ty_voucher1 ,
wa_voucher1 TYPE ty_voucher1.
DATA : it_voucher2 TYPE STANDARD TABLE OF ty_voucher1,
wa_voucher2 TYPE ty_voucher1.
DATA : it_voucher3 TYPE STANDARD TABLE OF ty_voucher1,
wa_voucher3 TYPE ty_voucher1.
Data : w_ITCPO type ITCPO.
Data : w_ITCPP type ITCPP.
DATA : w_Rcptamt LIKE bseg-dmbtr,
w_Netamt LIKE bseg-dmbtr,
w_IntIncomeAmt LIKE bseg-dmbtr,
w_IntIncome LIKE bseg-dmbtr,
w_FixedAmt LIKE bseg-dmbtr,
w_fixedasst LIKE bseg-dmbtr,
w_Sundry LIKE bseg-dmbtr,
w_SundryAmt LIKE bseg-dmbtr,
w_SuppayAmt LIKE bseg-dmbtr,
w_Suppay LIKE bseg-dmbtr,
w_SuppayAmt1 LIKE bseg-dmbtr,
w_Suppay1 LIKE bseg-dmbtr,
w_DutyAmt LIKE bseg-dmbtr,
w_Duty LIKE bseg-dmbtr,
w_SalaryAmt LIKE bseg-dmbtr,
w_Salary LIKE bseg-dmbtr,
w_TaxAmt LIKE bseg-dmbtr,
w_Tax LIKE bseg-dmbtr,
w_TaxAmt1 LIKE bseg-dmbtr,
w_Tax1 LIKE bseg-dmbtr,
w_SellAmt LIKE bseg-dmbtr,
w_Sell LIKE bseg-dmbtr,
w_AdminAmt LIKE bseg-dmbtr,
w_Admin LIKE bseg-dmbtr,
w_loanAmt LIKE bseg-dmbtr,
w_loan LIKE bseg-dmbtr,
w_ManAmt LIKE bseg-dmbtr,
w_Man LIKE bseg-dmbtr,
w_CapitalAmt LIKE bseg-dmbtr,
w_Capital LIKE bseg-dmbtr,
w_GroupAmt LIKE bseg-dmbtr,
w_Group LIKE bseg-dmbtr,
w_IntAmt LIKE bseg-dmbtr,
w_Int LIKE bseg-dmbtr,
w_InterAmt LIKE bseg-dmbtr,
w_Inter LIKE bseg-dmbtr,
w_AdPayAmt LIKE bseg-dmbtr,
w_AdPay LIKE bseg-dmbtr,
w_GTotal LIKE bseg-dmbtr,
W_COMPANYNAME like zcompany-copmname.
DATA : w_ORcptamt LIKE bseg-dmbtr,
w_ONetamt LIKE bseg-dmbtr,
w_OIntIncomeAmt LIKE bseg-dmbtr,
w_OIntIncome LIKE bseg-dmbtr,
w_OFixedAmt LIKE bseg-dmbtr,
w_Ofixedasst LIKE bseg-dmbtr,
w_OSundry LIKE bseg-dmbtr,
w_OSundryAmt LIKE bseg-dmbtr,
w_OSuppayAmt LIKE bseg-dmbtr,
w_OSuppay LIKE bseg-dmbtr,
w_OSuppayAmt1 LIKE bseg-dmbtr,
w_OSuppay1 LIKE bseg-dmbtr,
w_ODutyAmt LIKE bseg-dmbtr,
w_ODuty LIKE bseg-dmbtr,
w_OSalaryAmt LIKE bseg-dmbtr,
w_OSalary LIKE bseg-dmbtr,
w_OTaxAmt LIKE bseg-dmbtr,
w_OTax LIKE bseg-dmbtr,
w_OTaxAmt1 LIKE bseg-dmbtr,
w_OTax1 LIKE bseg-dmbtr,
w_OSellAmt LIKE bseg-dmbtr,
w_OSell LIKE bseg-dmbtr,
w_OAdminAmt LIKE bseg-dmbtr,
w_OAdmin LIKE bseg-dmbtr,
w_OloanAmt LIKE bseg-dmbtr,
w_Oloan LIKE bseg-dmbtr,
w_OManAmt LIKE bseg-dmbtr,
w_OMan LIKE bseg-dmbtr,
w_OCapitalAmt LIKE bseg-dmbtr,
w_OCapital LIKE bseg-dmbtr,
w_OGroupAmt LIKE bseg-dmbtr,
w_OGroup LIKE bseg-dmbtr,
w_OIntAmt LIKE bseg-dmbtr,
w_OInt LIKE bseg-dmbtr,
w_OInterAmt LIKE bseg-dmbtr,
w_OInter LIKE bseg-dmbtr,
w_OAdPayAmt LIKE bseg-dmbtr,
w_OAdPay LIKE bseg-dmbtr.
DATA : w_NNetamt LIKE bseg-dmbtr,
w_NIntIncome LIKE bseg-dmbtr,
w_Nfixedasst LIKE bseg-dmbtr,
w_NSundry LIKE bseg-dmbtr,
w_NSuppay LIKE bseg-dmbtr,
w_NSuppay1 LIKE bseg-dmbtr,
w_NDuty LIKE bseg-dmbtr,
w_NSalary LIKE bseg-dmbtr,
w_NTax LIKE bseg-dmbtr,
w_NTax1 LIKE bseg-dmbtr,
w_NSell LIKE bseg-dmbtr,
w_NAdmin LIKE bseg-dmbtr,
w_Nloan LIKE bseg-dmbtr,
w_NMan LIKE bseg-dmbtr,
w_NCapital LIKE bseg-dmbtr,
w_NGroup LIKE bseg-dmbtr,
w_NInt LIKE bseg-dmbtr,
w_NInter LIKE bseg-dmbtr,
w_NAdPay LIKE bseg-dmbtr.
RANGES : r_bwart FOR bsad-blart.
TABLES: bsad.
* Internal tables Begin with IT_ *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_bukrs LIKE bsad-bukrs OBLIGATORY.
SELECT-OPTIONS: s_bldat FOR bsad-bldat OBLIGATORY.
* SELECT-OPTIONS: s_hkont FOR bsad-hkont .
PARAMETERS: p_gjahr LIKE bkpf-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1 .
* PARAMETERS : w_local TYPE char1 RADIOBUTTON GROUP g1 DEFAULT 'X'. .
* PARAMETERS : w_curr TYPE char1 RADIOBUTTON GROUP g1 .
w_ITCPO-TDNEWID = 'X'.
*w_itcpo-tdgetotf = 'X'.
*opern form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
* APPLICATION = 'TX'
* ARCHIVE_INDEX =
* ARCHIVE_PARAMS =
* DEVICE = 'PRINTER'
* DIALOG = ' '
form = 'ZCASHFLOW_FORM1'
* LANGUAGE = SY-LANGU
OPTIONS = w_ITCPO
* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJECT =
* RAW_DATA_INTERFACE = '*'
* SPONUMIV =
* IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
* RESULT =
* EXCEPTIONS
* CANCELED = 1
* DEVICE = 2
* FORM = 3
* OPTIONS = 4
* UNCLOSED = 5
* MAIL_OPTIONS = 6
* ARCHIVE_ERROR = 7
* INVALID_FAX_NUMBER = 8
* MORE_PARAMS_NEEDED_IN_BATCH = 9
* SPOOL_ERROR = 10
* CODEPAGE = 11
* OTHERS = 12
IF sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM select_data_closed.
PERFORM select_data_open.
* calculate the net figures
w_NNetamt = w_Netamt + w_ONetamt.
w_NIntIncome = w_IntIncome + w_OIntIncome.
*w_NInCompRct = w_InCompRct + w_OInCompRct.
w_NfixedAsst = w_fixedAsst + w_OfixedAsst.
w_NSundry = w_Sundry + w_OSundry.
w_NSuppay = w_Suppay + w_OSuppay.
w_NSuppay1 = w_Suppay1 + w_OSuppay1.
w_NDuty = w_Duty + w_ODuty.
w_NSalary = w_Salary + w_OSalary.
w_NTax = w_Tax + w_OTax.
w_NTax1 = w_Tax1 + w_OTax1.
w_NSell = w_Sell + w_OSell.
w_NAdmin = w_Admin + w_OAdmin.
w_NCapital = w_Capital + w_OCapital.
w_Nloan = w_loan + w_Oloan.
w_NMan = w_Man + w_OMan.
w_NGroup = w_Group + w_OGroup.
w_NInt = w_Int + w_OInt.
w_NInter = w_Inter + w_OInter.
w_NAdPay = w_AdPay + w_OAdPay.
w_GTotal = ( w_NNetamt + w_NIntIncome + w_NfixedAsst + w_NSundry ) - (
w_NSuppay + w_NSuppay1 + w_NDuty + w_NSalary + w_NTax + w_NTax1 +
w_NSell + w_NAdmin + w_NCapital + w_Nloan + w_NMan + w_NGroup + w_NInt +
w_NInter + w_NAdPay ).
* Write the Main Account Balance
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAIN'
function = 'SET'
type = 'BODY'
window = 'MAIN'.
IF sy-subrc <> 0.
** message id sy-msgid type sy-msgty number sy-msgno
** with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_ITCPP-TDNEWID = 'X'.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = w_ITCPP
* RDI_RESULT =
* TABLES
* OTFDATA =
* EXCEPTIONS
* UNOPENED = 1
* BAD_PAGEFORMAT_FOR_PRINT = 2
* SEND_ERROR = 3
* SPOOL_ERROR = 4
* CODEPAGE = 5
* OTHERS = 6
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM select_data_closed.
SELECT SINGLE copmname INTO w_companyname
FROM zcompany
WHERE copcode = p_bukrs.
* Select the receipts
SELECT SUM( dmbtr ) AS dmbtr belnr kunnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher3
FROM bsad
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart = 'DZ'
* AND blart = 'DZ' and shkzg = 'S'
GROUP BY kunnr belnr hkont shkzg xblnr budat blart bldat.
SORT it_voucher3 BY kunnr.
LOOP AT it_voucher3 INTO wa_voucher3.
* Select the invoices
SELECT SUM( dmbtr ) AS dmbtr belnr kunnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher1
FROM bsad
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart <> 'DZ' AND
augbl = wa_voucher3-belnr AND
kunnr = wa_voucher3-kunnr
GROUP BY belnr kunnr hkont shkzg xblnr budat blart bldat.
LOOP AT it_voucher1 INTO wa_voucher1.
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_Rcptamt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_Rcptamt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Netamt = w_Netamt + w_Rcptamt.
continue.
ENDIF.
ELSE.
w_Netamt = w_Netamt + w_Rcptamt.
continue.
ENDIF.
* Interest Income
SELECT SINGLE dmbtr FROM bsis INTO w_IntIncomeAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_IntIncomeAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_IntIncome = w_IntIncome + w_IntIncomeAmt.
continue.
ENDIF.
ELSE.
w_IntIncome = w_IntIncome + w_IntIncomeAmt.
continue.
ENDIF.
* Sale Of fixed Assets
SELECT SINGLE dmbtr FROM bsis INTO w_FixedAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_FixedAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_fixedasst = w_fixedasst + w_FixedAmt.
continue.
ENDIF.
ELSE.
w_fixedasst = w_fixedasst + w_FixedAmt.
continue.
ENDIF.
* Gl Receipts ( Sundry Income)
SELECT SINGLE dmbtr FROM bsis INTO w_SundryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_SundryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Sundry = w_Sundry + w_SundryAmt.
continue.
ENDIF.
ELSE.
w_Sundry = w_Sundry + w_SundryAmt.
continue.
ENDIF.
ENDLOOP.
ENDLOOP.
*Out Flow
r_bwart-sign = 'I'. r_bwart-option = 'EQ'. r_bwart-low = 'KZ'.
APPEND r_bwart TO r_bwart.
r_bwart-sign = 'I'. r_bwart-option = 'EQ'. r_bwart-low = 'VZ'.
APPEND r_bwart TO r_bwart.
SELECT SUM( dmbtr ) AS dmbtr belnr lifnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher3
FROM bsak
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart IN r_bwart
* AND blart = 'DZ' and shkzg = 'S'
GROUP BY lifnr belnr hkont shkzg xblnr budat blart bldat.
SORT it_voucher3 BY lifnr.
LOOP AT it_voucher3 INTO wa_voucher3.
* Select the invoices
SELECT SUM( dmbtr ) AS dmbtr belnr lifnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher1
FROM bsak
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart NOT IN r_bwart AND
augbl = wa_voucher3-belnr AND
lifnr = wa_voucher3-lifnr
GROUP BY belnr lifnr hkont shkzg xblnr budat blart bldat.
LOOP AT it_voucher1 INTO wa_voucher1.
* Supplier Payments (LOCAL)
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_SupPayAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_SupPayAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_SupPay = w_SupPay + w_SupPayAmt.
continue.
ENDIF.
ELSE.
w_SupPay = w_SupPay + w_SupPayAmt.
continue.
ENDIF.
* supplier Payments (Foreign )
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_SupPayAmt1 WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_SupPayAmt1 WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_SupPay1 = w_SupPay1 + w_SupPayAmt1.
continue.
ENDIF.
ELSE.
w_SupPay1 = w_SupPay1 + w_SupPayAmt1.
continue.
ENDIF.
* duty/clearing expenses
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_DutyAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY003' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_DutyAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY003' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Duty = w_Duty + w_DutyAmt.
continue.
ENDIF.
ELSE.
w_Duty = w_Duty + w_DutyAmt.
continue.
ENDIF.
* Salary /EPF/ETF/MSPS/OVERTIME
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_SalaryAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_SalaryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Salary = w_Salary + w_SalaryAmt.
continue.
ENDIF.
ELSE.
w_Salary = w_Salary + w_SalaryAmt.
continue.
ENDIF.
* Income Taxes
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_TaxAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_TaxAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Tax = w_Tax + w_TaxAmt.
continue.
ENDIF.
ELSE.
w_Tax = w_Tax + w_TaxAmt.
continue.
ENDIF.
* other taxes ( VAT: TT:Debit tax )
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_TaxAmt1 WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY006' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_TaxAmt1 WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY006' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Tax1 = w_Tax1 + w_TaxAmt1.
continue.
ENDIF.
ELSE.
w_Tax1 = w_Tax1 + w_TaxAmt1.
continue.
ENDIF.
* Selling & Promotional Costs
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_SellAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY007' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_SellAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY007' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Sell = w_Sell + w_SellAmt.
continue.
ENDIF.
ELSE.
w_Sell = w_Sell + w_SellAmt.
continue.
ENDIF.
* Admistration costs
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_AdminAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY008' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_AdminAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY008' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Admin = w_Admin + w_AdminAmt.
continue.
ENDIF.
ELSE.
w_Admin = w_Admin + w_AdminAmt.
continue.
ENDIF.
* Capital Expenditure
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_CapitalAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY009' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_CapitalAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY009' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Capital = w_Capital + w_CapitalAmt.
continue.
ENDIF.
ELSE.
w_Capital = w_Capital + w_CapitalAmt.
continue.
ENDIF.
* Loan repayments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_LoanAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY010' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_LoanAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY010' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Loan = w_Loan + w_LoanAmt.
continue.
ENDIF.
ELSE.
w_Loan = w_Loan + w_LoanAmt.
continue.
ENDIF.
* maangment fees
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_ManAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY011' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_ManAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY011' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Man = w_Man + w_ManAmt.
continue.
ENDIF.
ELSE.
w_Man = w_Man + w_ManAmt.
continue.
ENDIF.
* Group charges
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_GroupAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY012' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_GroupAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY012' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Group = w_Group + w_GroupAmt.
continue.
ENDIF.
ELSE.
w_Group = w_Group + w_GroupAmt.
continue.
ENDIF.
* Interest Payments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_IntAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY013' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_IntAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY013' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Int = w_Int + w_IntAmt.
continue.
ENDIF.
ELSE.
w_Int = w_Int + w_IntAmt.
continue.
ENDIF.
* Other Intercompany payments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_InterAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY014' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_InterAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY014' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Inter = w_Inter + w_InterAmt.
continue.
ENDIF.
ELSE.
w_Inter = w_Inter + w_InterAmt.
continue.
ENDIF.
* Advacnes/Prepayments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_AdPayAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY015' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_AdPayAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY015' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_AdPay = w_AdPay + w_AdPayAmt.
continue.
ENDIF.
ELSE.
w_AdPay = w_AdPay + w_AdPayAmt.
continue.
ENDIF.
ENDLOOP.
ENDLOOP.
* Open Item Balances
ENDFORM. " Select_Data
FORM select_data_Open.
* SELECT SINGLE copmname INTO w_companyname
* FROM zcompany
* WHERE copcode = p_bukrs.
* Select the receipts
SELECT SUM( dmbtr ) AS dmbtr belnr kunnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher3
FROM bsid
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart = 'DZ'
* AND blart = 'DZ' and shkzg = 'S'
GROUP BY kunnr belnr hkont shkzg xblnr budat blart bldat.
SORT it_voucher3 BY kunnr.
LOOP AT it_voucher3 INTO wa_voucher3.
* Select the invoices
SELECT SUM( dmbtr ) AS dmbtr belnr kunnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher1
FROM bsid
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart <> 'DZ' AND
augbl = wa_voucher3-belnr AND
kunnr = wa_voucher3-kunnr
GROUP BY belnr kunnr hkont shkzg xblnr budat blart bldat.
LOOP AT it_voucher1 INTO wa_voucher1.
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_ORcptamt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_ORcptamt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_ONetamt = w_ONetamt + w_ORcptamt.
continue.
ENDIF.
ELSE.
w_ONetamt = w_ONetamt + w_ORcptamt.
continue.
ENDIF.
* Interest Income
SELECT SINGLE dmbtr FROM bsis INTO w_OIntIncomeAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OIntIncomeAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OIntIncome = w_OIntIncome + w_OIntIncomeAmt.
continue.
ENDIF.
ELSE.
w_OIntIncome = w_OIntIncome + w_OIntIncomeAmt.
continue.
ENDIF.
* Sale Of fixed Assets
SELECT SINGLE dmbtr FROM bsis INTO w_OFixedAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OFixedAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_Ofixedasst = w_Ofixedasst + w_OFixedAmt.
continue.
ENDIF.
ELSE.
w_Ofixedasst = w_Ofixedasst + w_OFixedAmt.
continue.
ENDIF.
* Gl Receipts ( Sundry Income)
SELECT SINGLE dmbtr FROM bsis INTO w_OSundryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OSundryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'XX005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OSundry = w_OSundry + w_OSundryAmt.
continue.
ENDIF.
ELSE.
w_OSundry = w_OSundry + w_OSundryAmt.
continue.
ENDIF.
ENDLOOP.
ENDLOOP.
*Out Flow
Clear r_bwart.
refresh r_bwart.
r_bwart-sign = 'I'. r_bwart-option = 'EQ'. r_bwart-low = 'KZ'.
APPEND r_bwart TO r_bwart.
r_bwart-sign = 'I'. r_bwart-option = 'EQ'. r_bwart-low = 'VZ'.
APPEND r_bwart TO r_bwart.
SELECT SUM( dmbtr ) AS dmbtr belnr lifnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher3
FROM bsik
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart IN r_bwart
* AND blart = 'DZ' and shkzg = 'S'
GROUP BY lifnr belnr hkont shkzg xblnr budat blart bldat.
SORT it_voucher3 BY lifnr.
LOOP AT it_voucher3 INTO wa_voucher3.
* Select the invoices
SELECT SUM( dmbtr ) AS dmbtr belnr lifnr hkont shkzg xblnr budat
blart bldat
INTO CORRESPONDING FIELDS OF TABLE it_voucher1
FROM bsik
WHERE bukrs = p_bukrs AND gjahr = p_gjahr
AND augdt IN s_bldat
AND blart NOT IN r_bwart AND
augbl = wa_voucher3-belnr AND
lifnr = wa_voucher3-lifnr
GROUP BY belnr lifnr hkont shkzg xblnr budat blart bldat.
LOOP AT it_voucher1 INTO wa_voucher1.
* Supplier Payments (LOCAL)
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OSupPayAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OSupPayAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY001' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OSupPay = w_OSupPay + w_OSupPayAmt.
continue.
ENDIF.
ELSE.
w_OSupPay = w_OSupPay + w_OSupPayAmt.
continue.
ENDIF.
* supplier Payments (Foreign )
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OSupPayAmt1 WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OSupPayAmt1 WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY002' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OSupPay1 = w_OSupPay1 + w_OSupPayAmt1.
continue.
ENDIF.
ELSE.
w_OSupPay1 = w_OSupPay1 + w_OSupPayAmt1.
continue.
ENDIF.
* duty/clearing expenses
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_ODutyAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY003' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_ODutyAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY003' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_ODuty = w_ODuty + w_ODutyAmt.
continue.
ENDIF.
ELSE.
w_ODuty = w_ODuty + w_ODutyAmt.
continue.
ENDIF.
* Salary /EPF/ETF/MSPS/OVERTIME
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OSalaryAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OSalaryAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY004' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OSalary = w_OSalary + w_OSalaryAmt.
continue.
ENDIF.
ELSE.
w_OSalary = w_OSalary + w_OSalaryAmt.
continue.
ENDIF.
* Income Taxes
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OTaxAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OTaxAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY005' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OTax = w_OTax + w_OTaxAmt.
continue.
ENDIF.
ELSE.
w_OTax = w_OTax + w_OTaxAmt.
continue.
ENDIF.
* other taxes ( VAT: TT:Debit tax )
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OTaxAmt1 WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY006' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OTaxAmt1 WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY006' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OTax1 = w_OTax1 + w_OTaxAmt1.
continue.
ENDIF.
ELSE.
w_OTax1 = w_OTax1 + w_OTaxAmt1.
continue.
ENDIF.
* Selling & Promotional Costs
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OSellAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY007' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OSellAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY007' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OSell = w_OSell + w_OSellAmt.
continue.
ENDIF.
ELSE.
w_OSell = w_OSell + w_OSellAmt.
continue.
ENDIF.
* Admistration costs
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OAdminAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY008' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OAdminAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY008' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OAdmin = w_OAdmin + w_OAdminAmt.
continue.
ENDIF.
ELSE.
w_OAdmin = w_OAdmin + w_OAdminAmt.
continue.
ENDIF.
* Capital Expenditure
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OCapitalAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY009' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OCapitalAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY009' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OCapital = w_OCapital + w_OCapitalAmt.
continue.
ENDIF.
ELSE.
w_OCapital = w_OCapital + w_OCapitalAmt.
continue.
ENDIF.
* Loan repayments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OLoanAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY010' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OLoanAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY010' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OLoan = w_OLoan + w_OLoanAmt.
continue.
ENDIF.
ELSE.
w_OLoan = w_OLoan + w_OLoanAmt.
continue.
ENDIF.
* maangment fees
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OManAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY011' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OManAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY011' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OMan = w_OMan + w_OManAmt.
continue.
ENDIF.
ELSE.
w_OMan = w_OMan + w_OManAmt.
continue.
ENDIF.
* Group charges
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OGroupAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY012' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OGroupAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY012' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OGroup = w_OGroup + w_OGroupAmt.
continue.
ENDIF.
ELSE.
w_OGroup = w_OGroup + w_OGroupAmt.
continue.
ENDIF.
* Interest Payments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OIntAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY013' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OIntAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY013' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OInt = w_OInt + w_OIntAmt.
continue.
ENDIF.
ELSE.
w_OInt = w_OInt + w_OIntAmt.
continue.
ENDIF.
* Other Intercompany payments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OInterAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY014' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OInterAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY014' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OInter = w_OInter + w_OInterAmt.
continue.
ENDIF.
ELSE.
w_OInter = w_OInter + w_OInterAmt.
continue.
ENDIF.
* Advacnes/Prepayments
* Find the corresponding entry in the GL open
SELECT SINGLE dmbtr FROM bsis INTO w_OAdPayAmt WHERE
* hkont = '0010003900' AND
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY015' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc <> 0.
* If the corresponding entry not found in GL open, look in the GL Closed
SELECT SINGLE dmbtr FROM bsas INTO w_OAdPayAmt WHERE
hkont IN ( select fglacc from zcashflow_matrix WHERE FCODE =
'YY015' ) AND bukrs = p_bukrs AND
gjahr = p_gjahr AND
belnr = wa_voucher1-belnr.
IF sy-subrc = 0.
w_OAdPay = w_OAdPay + w_OAdPayAmt.
continue.
ENDIF.
ELSE.
w_OAdPay = w_OAdPay + w_OAdPayAmt.
continue.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. " Select_Data -
Many-to-many performance issue
I realize that many-to-many joins have been discussed before (yes, I looked through many threads), but I'm having a slight variation on the issue. Our data warehouse has been functioning for a couple of years now, but we're now experiencing a dramatic degradation in report performance. I'll tell you everything I know and what I've tried. My hope is that someone will have an idea that hasn't occurred to me yet.
The troubling data links deal with accounts and account_types. Each transaction will have one account, but each account can have multiple account_types and each account_type is made up of multiple accounts. It ends up looking like this:
Transaction_cube --< account_dimension >--< account_type_table
Given the many-to-many relationship between account and account_type, this is the only architecture I could come up with that will maintain data integrity in the transaction cube.
I know that this is the cause of the performance issues because the reports run normally when this is removed. The volume of data obviously increases over time, but the problem appeared very suddenly -- not a gradual degradation that one would expect from a volume issue. The cube is partitioned by year and we're a little below last year's growth.
The other fact to throw in is that the account_type table did increase in size by an additional 30% when we first noticed the problem. However, the business was able to go back and remove half of the account_types (unused types) so now the table has fewer rows than it had before we noticed the problem (~15k rows in the account_type table).
We have tried pinning the table so that it remain in memory, but that did not help. I tried creating a materialized view combining accounts and account_types with a similar lack of improvement. I've tried adding indexes, but there is still a full-table scan. All database objects are analyzed nightly after the data load is completed.
I'm fresh out of ideas at this point. Any suggestions and/or ideas would be greatly appreciated.I've thought about that. What it would mean would be aprox. 20 additional columns for each of the different account_types. Unfortunately, that would also mean that all the reports that use the account_type would have to have a condition:
WHERE acct_type1='Income Stmt." OR acct_type2='Income Stmt." OR ....
Since the account_types are not set up in a hierarchy and there must be only one row for account, I'm not sure that this is a feasible solution.
Thank you for the suggestion.
Maybe you are looking for
-
Since I reinstalled OS ver 1.0.7.3312 on my Playbook, I an getting this message in all my mail attachments: " Attachment too large " making impossible to download them. When the help buttom next to this message is clicked you get this other message:
-
I have made a movie in "Final Cut Pro X" saved it as a .mov file and "QuickTime" won't open it. It keeps saying that it doesn't recognize the file. Ironically there is another .mov file right next to it on the flash drive that opens just fine. I do n
-
Yours sincerely! I just bought a Sony DCR-SD1000 camera only when installing the cd drivers not supported by the operating system Machintosh. I've contacted the seller said the store did not provide for the apple os. How can I move all the files on t
-
Accounting document not posted from billing document SD module
Dear Sir, I am encounting a weird issue in SD module, that is when I am saving the billing document the system will generate accounting document automatically from my ID but when the same process will perform from the other ID having same rights and
-
Dear All, User had done GRN & after that he is doing J1IEX entry as he clicks on Post cenvat invoice he gets an Error " Balance in Transaction Currency" Now he is not able to proceed further. P.O Made for this is an Asset