Aging Structure
Hi Experts,
I have a case with aging structure from AR. The report must show aging structure for certain
key date and the data to be structured by months. I am using posting date for key date to limit the balance, but my problem is that one clearing document closes more than one invoice documents and the clearing has Billing date different than the invoices. It is very big problem form me and I hope that somebody can help me. Thanks in advance.
Hi Guys,
It seems that the problem was decided. The key was to use posting date <= from key date for Open posting, and posting date < = from key date and clearing date > from key date for Closed postings and the sum of both is the balance.
Similar Messages
-
Inventory Age Structure Analysis
Hi,
I am using PowerPivot of Excel 2013 and trying to accomplish an inventory age structure analysis.
I have got a snapshot table "stock_table" with daily updates for products on stock and a custom date table. The columns of the stock table are as follows:
date
product_key
units
I'd like to show a summary of products which are let's say <=30, >30 and <=90 days on stock. Products which are at query date not any more on stock should be excluded from the summary.
Example:
stock_table:
columns: date, product_key, units
01/31/2014, 4711, 200
02/28/2014, 4711, 200
03/31/2014, 4711, 100 (last entry, no units left at 04/03/2014)
01/31/2014, 4712, 100
02/28/2014, 4712, 100
03/31/2014, 4712, 100
04/03/2014, 4712, 100
03/31/2014, 4713, 300
04/03/2014, 4713, 300
Age analysis as per 04/03/2014 should show:
stock age <=30 days: 4713, 300 units
stock age >30 days and <=90 days: 4712, 100 units
4711 should not show up because it has zero units as per 04/03/2014
Can anyone give me a hint how to accomplish this analysis via dax?
Thanx
ChiemoHi Gerhard,
thank you very much for your excellent solution. Based on your file it was easy to adapt your solution to my real data.
One tiny and really minor point for other users of Gerhard's solution from my side to one formula where I got with my real data an error message: please replace in the formula of the calculated column "StockAge" in the table "Inventory"
the "<=" sign in the fourth row by a "<" sign. The formula that worked for me is
StockAge=CALCULATE(VALUES(StockAge[Stockage]);
FILTER(
'StockAge';
StockAge[StockMin] < [StockAgeDays]
&& [StockAgeDays] <= StockAge[StockMax]))
Thank you again, Gerhard!
Best regards
Chiemo -
SAP deliverd infoobject 0AGE_RANGE with standard age range, but our clients want to have special age range interval and calculate Number of Employees within this range. However HR module doesn't make this kind of range.
1) How to change the range according to customer's expectation?
2) How to calculated Number of Employees within this range due to HR team doesn't maintain this age range in R/3?
3) Should we write ABAP code?
SAP standard age range
1 <20
2 20 - 29
3 30 - 39
4 40 - 49
5 50 - 59
6 60 - 69
7 >= 70
Customer required:
1 <=25
2 26 - 30
3 31 -35
4 36 - 40
5 41 - 45
6 46 - 50
7 51 - 55
8 >= 56
Edited by: hi ni on Apr 19, 2008 5:02 AMHi,
take a look at 0AGE doc from help.sap.com I think it should solve your problem:
This characteristic is a derived characteristic. You can use this characteristic to display key figures in accordance with the age of an applicant or an employee.
The characteristic contains the applicant/employees age at the end of a period. You can define an age hierarchy according to the specific requirements of your enterprise, and then display the age structure of your enterprise, for example. To enable you to perform age-based calculations, the system includes an Age in Years key figure (0AGE_KYF).
The age characteristics are calculated using update rules at the end of a period. The period depends on the InfoSource from which it is taken. For example, the end of the period can be at the end of a calendar day or month.
SAP delivers age in years hierarchies in CSV files. (See also InfoSource Age in Years (0AGE)). You can also define hierarchies for the Age in Years characteristic (0AGE). You can determine intervals within the structure as required, for example, in five-year intervals (25 - 29 years, 30 - 34 years, and so on.) Therefore, the age structure that you define yourself offers advantages over the fixed age structure of the Age Range characteristic (0AGE_RANGE).
http://help.sap.com/saphelp_nw70/helpdata/en/e0/afd837aeadd03ce10000009b38f889/frameset.htm
Assign points if it was helpful...
Regards
Andreas -
APEX 3.0 with Single Sign On for single application
Hi All,
I have been playing around with SSO (IAS 10.1.2) and an APEX application for the past couple of days and am still having problems.
I have followed the instructions word for word in the various how to documents named in this forum and am now at the point where I successfully redirect to SSO login page > login using a username created in OID (which is the same username/password in my application) > then get redirected back to "http://<MY_SSO_HOST>:7777/sso/auth"..
Some things about my instance:
1. Oracle DB > 10g 10.1.2
2. Oracle IAS > 10g 10.1.2 (different server to above)
3. APEX 3.0 > trying to run SSO authentication against a single application rather than the whole APEX instance.
4. I have (after a lot of grief - figured out that the DAD MUST be /pls/somedad and that the port number 80 must be defined in the SSO token regardless - those two little gems got me as far as I am..
Now I know very little about SSO and am trying to evaluate it for my application (which uses a DB login/password and has to continue to do so for other reasons which I do not control). I am assuming there is some method of synchronizing the OID/SSO repository with my db accounts but haven't yet figured that one out.
I cannot for the life of me see what's wrong here. Any ideas??Thanks Scott..
Okay let me go through the responses here..
...login using a username created in OID (which is the same username/password in my application)
My application overlays another Oracle application (old client server) which relies on physical database user accounts to perform its own internal grants etc. i.e. it uses where USER = blah all over the place.
Therefore my application is currently using the internal authentication scheme DATABASE (using DAD to resolve the credentials). In attempting to use SSO I am assuming that SSO must in some way be synched with my database (otherwise how does it pass any password changes applied in SSO to the database?)
Given that it's a base install (SSO) the only login I have there is the default orcladmin account. So I am trying to figure out how to get SSO to pass an acceptable login name/password to my application. My first attempt has been to create a user in OID that matches the DB login to see if SSO passes these on login - maybe I'm completely missing the point here??
...After login you get redirected to "http://<MY_SSO_HOST>:7777/sso/auth"? That's not right..
I have created/registered the application as per the how to guide using <my app name>.<my host>:<port> and setting the success URL to http://<my host>:<port>/pls/<mydad>/<my schema>.<custom success proc>
When I fire up my browser and go to http://<my host>/pls/<mydad>/f?p=9900:1 it sends me to the SSO login page. After entering my username and password I then end up with a HTTP 404 - not found page with the URL "http://<MY_SSO_HOST>:7777/sso/auth".
..You should think about getting to 10.2 at least, ..
Agreed but when I tried to upgrade the other day it fell in a big heap - so I backed it out to 10.1 again.
..I think I know what you mean. You installed the SSO SDK in a schema local to one workspace..
That is correct - had to do it as my instance has multiple applications and I want to check it works on this one before breaking anything else!
..No, that's not always the case. If you find that putting '80' in works in your configuration and leaving it out doesn't work then put it in..
I tried initially without the 80 but it threw errors whenever I tried to connect (these errors were APEX ones not SSO). On an off chance I put the 80 in there and presto it worked (in the sense that it redirected me to SSO anyway).
..Your application's use of a DB login/password is incongruous with using a different authentication method -- SSO or any other...
Given the constraints mentioned earlier (answer to first question above) I don't really have much choice. I have an Oracle application that uses DB accounts to authenticate users and authorize thier use of the app modules. What I need to do is 'wrap' and APEX application around this Oracle application to make it SOX compliant (it does not currently enforce password aging/structure etc.) So.. I was thinking that SSO might be the answer.
If SSO (used with OID) can enforce password aging and policies my intent is to have SSO 'manage' the user passwords for my APEX app (and it's underlying Oracle application). Hence the question about synching SSO with the underlying DB accounts. I thought the whole point of SSO/OID was to allow various enterprise apps to have thier authentication layers 'managed' by SSO - again maybe I'm misinterpreting this..
..if your application is working now with a non-SSO authentication scheme, then it should continue to work the same with SSO because after authentication, APP_USER is FRED in both cases..
Agreed - but how does SSO "know" to let a given user have access to that particular application?
Paul -
Problem in creating 0027 infotype record in background
Hi Experts,
I am facing the problem in creating 27(Costs distribution) infotype record in back ground.
Whenever there is a change in position of the employee or when we hire a new employee (Through PA40)
i have to ctreate 0027 infotype record in background.For that i am using IN_UPDATE method of BADI
HRPAD00INFTY.
Here i am getting 2 problems.
1. I am unable to get the latest positions that is assigned to the employee.
Through NEW_IM AGE structure we can get the latest position but if a person is assigned to multiple positions for the same period then i am getting only one position from NEW_IM AGE but not all.can any body help me?
2. I am calling HR_INFOTYPE_OPERATION FM to create the IT0027 record in background in the above method (IN_UPDATE). but it is not updating the PA0027 table. any idea?
Full points will be rewarded.
Regards,
Sai.I am sending a sample program , which is on infotype 0105 (communication). I hope that this program will help u out............
REPORT ZSAPHR_SAMP.
tables: pa0105.
infotypes: 0105.
DATA : I_RETURN TYPE BAPIRETURN1,
I_KEY TYPE BAPIPAKEY,
PERNR TYPE P0001-PERNR,
I_P0105 TYPE TABLE OF P0105 WITH HEADER LINE,
ENDDA TYPE P0105-ENDDA,
BEGDA TYPE P0105-BEGDA.
MOVE '00000010' TO PERNR.
BEGDA = SY-DATUM + 1.
ENDDA = SY-DATUM + 1.
i_p0105-pernr = PERNR.
i_p0105-infty = '0105'.
i_p0105-subty = '0002'.
i_p0105-endda = ENDDA.
i_p0105-begda = BEGDA.
I_P0105-USRTY = '0002'.
I_P0105-USRID = '[email protected]'.
APPEND i_p0105.
CALL FUNCTION 'DEQUEUE_ALL' .
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = PERNR.
IF SY-SUBRC = 0.
WRITE 'Employee Locked Successfully'.
ENDIF.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0105'
NUMBER = PERNR
SUBTYPE = '0002'
VALIDITYEND = BEGDA
VALIDITYBEGIN = ENDDA
RECORD = i_p0105
OPERATION = 'INS'
TCLAS = 'A'
DIALOG_MODE = '0'
NOCOMMIT = 'X'
IMPORTING
RETURN = I_RETURN
KEY = I_KEY.
IF SY-SUBRC = 0.
WRITE : 'FM returns sy-subrc 0'.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING -
Hi Gurus,
I'm working on HR module. In BI there is an infoobject 0AGE which can have only Hierarchy Master Data, but when I want to extract data for the respective Master Data from ECC 6.0, I couldn't locate the Datasource for that. Can you guyz help me with what could be the problem that I'm not able to find the Datasource for 0AGE.
(Note:- All the available Datasources for BI were successfully transfered in RSA5 and activated(RSA6) ).
Waiting for Optimistic reply.
Thanks & Regards,
Syed AliHello,
InfoSource : Age in Years (Characteristic)
Technical name: 0AGE
Use
This InfoSource yields information on employeesu2019 age in years.
A hierarchy is defined for the characteristic 0AGE. You can define this hierarchy manually yourself or by using a CSV file.
You can define your own hierarchies (manually). You can determine intervals within the structure as required, for example, in five-year intervals (25 - 29 years, 30 - 34 years, etc.) Therefore, the age structure that you define yourself offers advantages over the fixed age structure of the Age Range characteristic (0AGE_RANGE).
For example, you can use the hierarchy to display the age structure of your enterprise as follows:
< 20 x < 20
20 - 24 20 £ x £ 24
25 - 29 25 £ x £ 29
30 - 34 30 £ x £ 34
35 - 39 35 £ x £ 39
You can also upload the hierarchy using the CSV file delivered by SAP. To do so, proceed as follows:
In the Administrator Workbench, choose the Source system tab page.
Right click the top Source systems node and choose Create source system.
In the Select Source System Type dialog box, select File system, manual metadata, data using file interface.
In the Create Source System dialog box, enter AGE_File in the Source system field, and Age in Years in the Name of source system field. Confirm your entries.
Choose the InfoSources tab page.
Right click the higher Master data in Personnel Administration node and choose Create InfoSource.
In the Create InfoSource: Select Type dialog box, select Master data / texts / hierarchies. Confirm your entry.
In the Create InfoSource (Master Data) dialog box, enter 0AGE in the InfoObject field. Confirm your entry.
Right click the lower Age in Years node and to choose Assign source system.
In the Master Data InfoSource: Assign Source System dialog box, enter AGE_File in the Source system field. Confirm your entry.
On the Maintain Metadata screen, choose Create hier. (create hierarchy).
In the Create Hierarchy - Name dialog box, enter AGE in the Hierarchy name field, Age in Years (Hierarchy) in the Long description field, and an X in the Sorted hierarchy and Interval fields. Confirm your entries.
Choose Save hier. (save hierarchy), followed by Save and Close.
Right click the lower Age in Years (Hierarchy) node and choose Create InfoPackage.
In the Create InfoPackage dialog box, enter a description as required in the Long description field. Confirm your entry.
On the Scheduler (Maintain InfoPackage) screen, choose the External data tab page.
In the Load external data from group box, select Application server. In the File type (if control file is switched off) group box, select CSV file.
In the File name field, enter AGE_D.CSV for German node texts and AGE_E.CSV for English node texts. Save your entries.
Thanks
Chandran -
Hi All
i am trying to get a legitimate vendor Aging report from within SAP
The 2 reports that I am currently looking at are:
S_ALR_87012085 - Vendor Payment History with OI Sorted List
S_ALR_87012084 - Open Items - Vendor Due Date Forecast
But both these do not bring out the output the way i want it - and i tried changing the output control and it still doesnt bring out the report as i want it - I want a report like the S_ALR_87012178 for customers, with output control 1, 6 and a 0 - which gives me a logical list of the aged customers.
Is there one like this for vendors too? Any suggestions?
Thank you
RukshanaHi Ruksaana,
You can customize the vendor report to show the items overdue per vendor by using the following steps
1. Create a form using T Code - FKI4
In this form ( two-axis structure) provide the details for each column as per your Client requirement - Due from 0 - 30 days
etc. You can create a column (using formula method) at the end by adding the previous columns, this will give you total
amount of overdue items for each vendor
2. Create a report using T Code - FKI1
Based on the Form created in the above step. Make additional selections based on client requirements like document type,
company code, account type, currency etc. Execute the report.
The following link will give provides detail steps for the creation of the aforementioned form and report.
Re: AR aging report (summary by customer)
Hope this helps.
- Sadha. -
Vendor open items aging list - Reg.
Hi,
My client is requesting a transaction in SAP which can be used to produce a Vendor open items aging list and the output should be exactly the same as it is for the Customer open items aging List (transaction S_ALR_87012178). Moreover, It is essential for him to have only one line per vendor. He does not want to find a report in the accounts payable side that looks like the one which he mentioned for the accounts receivable side.
Since this is an urgent ticket, can any body help me in this regard.
Thanks,
Prasanna
Moderator: Please, search before postingDear expert
Reference from sdn forum
You can customize the vendor report to show the items overdue per vendor by using the following steps
1. Create a form using T Code - FKI4
In this form ( two-axis structure) provide the details for each column as per your Client requirement - Due from 0 - 30 days
etc. You can create a column (using formula method) at the end by adding the previous columns, this will give you total
amount of overdue items for each vendor
2. Create a report using T Code - FKI1
Based on the Form created in the above step. Make additional selections based on client requirements like document type,
company code, account type, currency etc. Execute the report.
The following link will give provides detail steps for the creation of the aforementioned form and report.
Re: AR aging report (summary by customer)
Vendor Aging Report
Regards
Ajeesh.s -
dear guru,
we are trying vendor ageing report in sap but the report format of report as per client requirement.
T-Code: S_ALR_87012085. the limitation in this report is that it is coming very lenthy format and one vendor information is coming in one page. where as for customer T-Code: S_ALR_87012178 is ok in every manner.
can any body tell me any other standard report for vendor ageing and advance to party ageing.
regards,
UKDHello,
If you feel there is no standard report suffice your requirement, you can design your own forms. However, I would suggest you look into some of the standard reports available.
The following example I have given is for customers.
The only difference is in transaction codes. For customer you go to FDI1, for vendor you go to FKI1 (reports).
For Customer you go to FDI4, for vendor you go to FKI4 for forms.
Remaining all are the same.
Hello,
Go to transaction code FDI4
Select Form Type RFFRRD20 Line item analysis
Give your form name and description
Structure (Two axis) - as defaulted
Click on Create
You will have lead column
Delete the rows 2, 3 and 4
Double click on column 1
Enter the customer numbers from 1 to 999999
First column double click (A)
Slelect following values
Due date analysis 1
Days for net due date 0 to 30
Give the short name, medium name and long text for the column.
Repeat this step in next columns like 31 to 60, 61 to 90, 91 to 120 and 121 to 99999 days etc in other columns and select due date analysis 1. (B,C,D,E)
Create one more column by way of formula. To create a new column you need to double click on blue line. Put formula add all five columns you have created above. (F = ABCDE)
You prepare one more column with
Due date analysis 2 (G)
Now you prepare one more column add (F+G) = This will be total open items = over due and not due.
Now go to FDI1 and prepare a report - assign the form created in FDI4 to the report.
Characteristics you need to select are
Account Type (Select Account Type as D for customers)
Currency
Customer
Document Type
Special G/L Ind
Company Code
Change the output types and options according to your requirement.
Refer FDI2 and FDI3 for other standard reports created.
Refer FDI5 and FDI6 for other standard forms created.
Save your report and execute.
Regards,
Ravi -
Hi Team,
The requirment called vendor ageing report. when we using the T.code F.46 for company code level in standard sap 0-30 31-60 61-90 >90.
So our requirement is 0-30 30-45 45-60 60-90 >90. So this is can able to change the days.
Regards,
BharathHello,
The following example I have given is for customers.
The only difference is in transaction codes. For customer you go to FDI1, for vendor you go to FKI1 (reports).
For Customer you go to FDI4, for vendor you go to FKI4 for forms.
Remaining all are the same.
Hello,
Go to transaction code FDI4
Select Form Type RFFRRD20 Line item analysis
Give your form name and description
Structure (Two axis) - as defaulted
Click on Create
You will have lead column
Delete the rows 2, 3 and 4
Double click on column 1
Enter the customer numbers from 1 to 999999
First column double click (A)
Slelect following values
Due date analysis 1
Days for net due date 0 to 30
Give the short name, medium name and long text for the column.
Repeat this step in next columns like 31 to 60, 61 to 90, 91 to 120 and 121 to 99999 days etc in other columns and select due date analysis 1. (B,C,D,E)
Create one more column by way of formula. To create a new column you need to double click on blue line. Put formula add all five columns you have created above. (F = ABCDE)
You prepare one more column with
Due date analysis 2 (G)
Now you prepare one more column add (F+G) = This will be total open items = over due and not due.
Now go to FDI1 and prepare a report - assign the form created in FDI4 to the report.
Characteristics you need to select are
Account Type (Select Account Type as D for customers)
Currency
Customer
Document Type
Special G/L Ind
Company Code
Change the output types and options according to your requirement.
Refer FDI2 and FDI3 for other standard reports created.
Refer FDI5 and FDI6 for other standard forms created.
Save your report and execute.
Regards,
Ravi -
I mean is there anyway to user decode for showing sum(amount) for different period of dates
is there any idea to make faster ageing report for accounts payable module.
Thanks AHON
Edited by: [email protected] on Nov 22, 2009 7:09 AMplz write more clear requirements...... ur table structures and report output ....
i have few aging reports and all working without any problem.....it depends on ur table structure also. -
Ar aging report, need help urgent please help!
Hey All Gurus,
Im in a thick soup here. I am trying to do something like this -
if you see the selection screen i have rep and super rep, when a user enters a rep value --- it should use the same value to pull all open items for the super rep as well, since they are essentially the same. please help! this one needs to be done fast. i am pasting the code so that it will be easier ...
thanks a million!
*& Report ZFDOFW04_NEW
REPORT ZFDOFW04_NEW MESSAGE-ID FR
LINE-SIZE 132
LINE-COUNT 60.
*==================================================================
Program: ZFDOFW03 - Aged Trial Balance Report
This produces an Accounts Receivable Past Due Aging Report
in a more simplified/condensed format than the
SAP supplied aging report program - RFDOPR10.
This program is a modified copy of RFDOFW00, - a SAP
Future-Due Report.
This was a 'rush' job - program probably should be
rewritten someday not using logical databases as that
maybe why this runs so slowly!
Original: Feb 1997.
MAINTENANCE HISTORY:
NES071797 Copied from ZFDOFW03. Adding parameter for saeles rep.
JDEDERER - changed header text so it is differnet from ZFDORW03. 9/23
*TEXT SYMBOLS :
001 Open items per
002 O p e n
003 D u e o n
004 cc ba in total
005 until
006 Days until
007 Days over
008 Days
009 over
011 valid until........
012 Insurance limit.....
016 F u t u r e
017 + days
018 D u e
020 Last dunn.notice...
021 Dunning level....
030 S U M M A R Y S H E E T
031 =====================
050 Name Page
051 Burton Snowboard
SELECTION TEXTS:
SUMMEN Output totals only
TAGE1 Due date I until
TAGE2 Due date II until
TAGE3 Due date III until
TAGE4 Due date IV until
TABLES: T001, KNA1, KNB1, KNB5, BSID, BSEGA, RFPDO1, KNVP,
T014, "credit control areas JAM
KNVK, "cust master - contact partner JAM
T014T, "Credit control areas names
BKPF, "TONY ISSUE 4743
TVKO, "TONY ISSUE 4743
KNKK. "cust master - credit mgmt JAM
TYPES: BEGIN OF TOT_TYPE, "DEVK939546
BUKRS LIKE LFB1-BUKRS, "DEVK939546
GSBER LIKE BSIK-GSBER, "DEVK939546
KKBER LIKE BSID-KKBER,
RAST1 TYPE P, "DEVK939546
RAST2 TYPE P, "DEVK939546
RAST3 TYPE P, "DEVK939546
RAST4 TYPE P, "DEVK939546
RAST5 TYPE P, "DEVK939546
RAST6 TYPE P, "DEVK939546
RAST7 TYPE P, "DEVK939546
END OF TOT_TYPE, "DEVK939546
TOT_TAB TYPE TOT_TYPE OCCURS 0. "DEVK939546
CONSTANTS:
C_FALSE TYPE I VALUE 0, "JAM
C_TRUE TYPE I VALUE 1.
DATA: BEGIN OF GTAB OCCURS 1000,
SUPER(10) TYPE C, "TONYC
REP(10) TYPE C, "TONYC
FILKD(10), "tonyc show buying groups
LAND1 LIKE KNA1-LAND1,
GSBER LIKE BSIK-GSBER,
REGIO LIKE KNA1-REGIO,
NAME1 LIKE KNA1-NAME1,
NAME2 LIKE KNA1-NAME2,
ORT01 LIKE KNA1-ORT01,
TELF1 LIKE KNVK-TELF1, "telephone number JAM
CONT_NAME1 LIKE KNVK-NAME1, "contact name JAM
NAMEV LIKE KNVK-NAMEV, "contact name JAM
KUNNR LIKE KNA1-KUNNR, "TONYC
BUKRS LIKE LFB1-BUKRS, "TONYC
KKBER LIKE BSID-KKBER, "tonyc issue #2500
ZTERM LIKE KNB1-ZTERM, "tonyc issue #2500
KLIMK_TXT(22) TYPE C, "credit limit JAM
WAERS LIKE T014-WAERS, "currency JAM
SORT_GSB, "TONYC
RAST1 TYPE P,
RAST2 TYPE P,
RAST3 TYPE P,
RAST4 TYPE P,
RAST5 TYPE P,
RAST6 TYPE P,
RAST7 TYPE P,
T_IND,
END OF GTAB.
DATA HOLD_NAME(40).
DATA HOLD_BUKRS LIKE T001-BUKRS. "tonyc
DATA GOOD_SUPER_REP. "tonyc
DATA: HOLD_REP LIKE KNA1-KUNNR, "tonyc
SUPER_NAME LIKE KNA1-NAME1, "tonyc
REP_NAME LIKE KNA1-NAME1. "tonyc
DATA NAME_LENGTH(2) TYPE C. "tonyc
DATA BACKSLASH(3) VALUE ' / '. "tonyc
DATA REPS_INFO(70) TYPE C. "tonyc
DATA REPORT_TYPE(12) TYPE C.
DATA: C_CREDIT_ABTNR LIKE KNVK-ABTNR. "dept 003 = credit
DATA Z_HOLD_LIMIT(22) TYPE N. "tonyc issue#2216
DATA Z_DESCRIPTION(18). "tonyc issue#2216
DATA WRITE_TOTAL.
DATA HOLD_KLIMK LIKE KNKK-KLIMK.
DATA HOLD_KLIMK2(22) TYPE C.
DATA HOLD-CTLPC LIKE KNKK-CTLPC.
DATA HOLD-CTLPC-TEXT LIKE T691T-RTEXT.
DATA HOLD_ZTERM LIKE KNVV-ZTERM.
DATA TOTAL_RAST7 TYPE P.
DATA TOTAL_RAST2 TYPE P.
DATA TOTAL_RAST3 TYPE P.
DATA TOTAL_RAST4 TYPE P.
DATA TOTAL_RAST5 TYPE P.
DATA TOTAL_RAST6 TYPE P.
DATA TOTAL_RAST1 TYPE P.
DATA HOLD_BUKRS2 LIKE T001-BUKRS.
DATA HOLD_KKBER LIKE BSID-KKBER.
DATA HOLD_KKBER_DESC LIKE T014T-KKBTX.
DATA HOLD_KKBER_DESC2 LIKE T014T-KKBTX.
DATA HOLD_KUNNR2 LIKE KNA1-KUNNR.
DATA L_FIRST_DAY_OF_FISCAL LIKE SY-DATUM. "tonyc issue #3047
DATA: STAB TYPE TOT_TAB WITH HEADER LINE, "DEVK939546
RTOT TYPE TOT_TAB WITH HEADER LINE, "DEVK939546
STOT TYPE TOT_TAB WITH HEADER LINE, "DEVK939546
OP,
MAXMANDT LIKE DD_STIDA,
MAXMANST TYPE P,
SUMKLIMB TYPE P,
SUMVLIBB TYPE P,
VERZUG TYPE P,
OBAD TYPE P,
BLOCK_CNT TYPE P,
INTENS,
ONEBYTE(1) TYPE C,
TAGE1A LIKE RFPDO1-ALLGFAEL,
TAGE2A LIKE RFPDO1-ALLGFAEL,
TAGE3A LIKE RFPDO1-ALLGFAEL,
HOLD_KUNNR LIKE KNA1-KUNNR, "tonyc
HOLD_SUPER LIKE KNA1-KUNNR, "tonyc
HOLD_REP2 LIKE KNA1-KUNNR, "tonyc
SUPER_REP LIKE KNA1-KUNNR, "tonyc
TEMP_TELF1 LIKE KNA1-TELF1, "JAM
IT_T014 LIKE T014 OCCURS 0 WITH HEADER LINE, "JAM
G_KLIMK_TXT LIKE GTAB-KLIMK_TXT, "JAM
G_WAERS LIKE GTAB-WAERS, "JAM
G_CONT_NAME(50) TYPE C. "JA
DATA FILL_REP_INFO.
BC SUNILP 05/14/2007
DATA: BEGIN OF ITAB_VBRP OCCURS 0.
INCLUDE STRUCTURE VBRP.
DATA: END OF ITAB_VBRP.
DATA: T_PERC TYPE F,
SUM_NETWR LIKE VBRP-NETWR.
*DATA: GTAB_LINES LIKE GTAB OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF GTAB_LINES OCCURS 0.
INCLUDE STRUCTURE GTAB.
DATA: IND(1),
OBAD TYPE P.
DATA: END OF GTAB_LINES.
DATA: BEGIN OF ITAB_VBRP1 OCCURS 0,
VBELN LIKE VBRP-VBELN,
NETWR LIKE VBRP-NETWR,
ZZMREP LIKE VBRP-ZZMREP, "Super Rep
ZZLREP LIKE VBRP-ZZLREP, "Rep
PERC TYPE F,
END OF ITAB_VBRP1.
EC SUNILP 05/14/2007
BEGIN_OF_BLOCK 2.
PARAMETERS: REGIO LIKE KNA1-REGIO.
PARAMETERS: CONSOL AS CHECKBOX. "TONYC
PARAMETERS: P_KKBER AS CHECKBOX, "TONYC
P_CONV AS CHECKBOX. "tonyc issue #3047
PARAMETERS: SUMMEN LIKE RFPDO1-ALLGSUMM,
TAGE1 LIKE RFPDO1-ALLGFAEL DEFAULT '30',
TAGE2 LIKE RFPDO1-ALLGFAEL DEFAULT '60',
TAGE3 LIKE RFPDO1-ALLGFAEL DEFAULT '90',
TAGE4 LIKE RFPDO1-ALLGFAEL DEFAULT '120'.
END_OF_BLOCK 2.
BEGIN_OF_BLOCK 3.
SELECT-OPTIONS: P_SUPREP FOR KNVP-KUNNR, "Super REP "DEVK939546
P_REP FOR KNVP-KUNNR, "SALES REP "DEVK939546
P_VKORG FOR TVKO-VKORG, "TONYC ISSUE 4743
P_LOTKZ FOR BKPF-LOTKZ. "TONYC ISSUE 4743
END_OF_BLOCK 3.
INITIALIZATION. "JAM
PERFORM LOAD_T014. "JAM
refresh dd_augdt.
clear dd_augdt.
dd_augdt-option = 'EQ'.
dd_augdt-sign = 'I'.
dd_augdt-low = ' '.
append dd_augdt.
AT SELECTION-SCREEN.
IF CONSOL = 'X'.
IF NOT P_SUPREP[] IS INITIAL. "DEVK939546
MESSAGE E999 WITH 'Consolidated report not allowed w/ Super Rep'.
ENDIF.
ENDIF.
CHECK IF THE REP INFO IS ADDED OR NOT - VS
IF NOT P_SUPREP IS INITIAL OR"TONY ISSUE 4743
NOT P_REP IS INITIAL."TONY ISSUE 4743
FILL_REP_INFO = 'X'."TONY ISSUE 4743
ENDIF."TONY ISSUE 4743
START-OF-SELECTION.
get_frame_title 2.
add function module to track usage JD 10/13/98 *****
CALL FUNCTION 'Z_RUN_LOG'
EXCEPTIONS
OTHERS = 1.
*IF NOT P_SUPREP IS INITIAL AND NOT P_REP IS INITIAL.
P_SUPREP = ' '.
*ENDIF.
GET KNA1 FIELDS LAND1 REGIO KUNNR NAME1 NAME2 ORT01 TELF1. "JAM
new-page.
skip.
TEMP_TELF1 = KNA1-TELF1.
MAXMANDT = '19000101'.
MAXMANST = 0.
SUMVLIBB = 0.
PERFORM GET_CUST_CONTACT. "JAM
Check sales rep- NES071797
Get any valid record and exit.
IF NOT p_suprep[] IS INITIAL. "DEVK939546 "TONY ISSUE 4743 start
good_super_rep = ' '.
SELECT kunn2 INTO super_rep FROM knvp UP TO 1 ROWS
WHERE
kunnr = kna1-kunnr AND
parvw = 'ZS' AND
kunn2 IN p_suprep.
EXIT.
ENDSELECT.
IF sy-subrc = 0.
good_super_rep = 'X'.
gtab-super = super_rep.
super_rep = ' '.
ENDIF.
CHECK good_super_rep = 'X'.
SELECT kunn2 INTO gtab-rep FROM knvp UP TO 1 ROWS
WHERE
kunnr = kna1-kunnr AND
parvw = 'ZR' AND
kunn2 IN p_rep.
EXIT.
ENDSELECT.
CHECK sy-subrc = 0.
ELSEIF NOT p_rep[] IS INITIAL. "DEVK939546
SELECT kunn2 INTO gtab-rep FROM knvp UP TO 1 ROWS
WHERE
kunnr = kna1-kunnr AND
parvw = 'ZR' AND
kunn2 IN p_rep.
EXIT.
ENDSELECT.
CHECK sy-subrc = 0.
ENDIF. "TONY ISSUE 4743 end
GET KNB1 FIELDS BUKRS VLIBB ZTERM. "tonyc #2500
GTAB-BUKRS = KNB1-BUKRS.
GTAB-ZTERM = KNB1-ZTERM.
SUMVLIBB = SUMVLIBB + KNB1-VLIBB.
GET KNB5.
IF KNB5-MADAT > MAXMANDT.
MAXMANDT = KNB5-MADAT.
ENDIF.
IF KNB5-MAHNS > MAXMANST.
MAXMANST = KNB5-MAHNS.
ENDIF.
SUMKLIMB = SUMKLIMB + KLIMB.
GET BSID.
CHECK BSID-BSTAT = SPACE.
field was intended for Business Area, changed to use Currency
GTAB-GSBER = BSID-WAERS.
IF P_KKBER = 'X'. "TONYC ISSUE #2500
IF BSID-KKBER = ' '.
GTAB-KKBER = BSID-BUKRS.
ELSE.
GTAB-KKBER = BSID-KKBER. "TONYC ISSUE #2500
ENDIF.
ENDIF. "TONYC ISSUE #2500
SELECT SINGLE * FROM BKPF "TONY ISSUE 4743
WHERE BUKRS = BSID-BUKRS "TONY ISSUE 4743
AND BELNR = BSID-BELNR "TONY ISSUE 4743
AND GJAHR = BSID-GJAHR. "TONY ISSUE 4743
BC SUNILP 05/14/2007
IF BKPF-XREF2_HD IS NOT INITIAL.
CHECK BKPF-XREF2_HD IN P_SUPREP. "TONY ISSUE 4743
ELSE.
IF P_REP[] IS INITIAL.
REFRESH: ITAB_VBRP, ITAB_VBRP1.
IF NOT BKPF-XBLNR IS INITIAL.
SELECT * FROM VBRP INTO ITAB_VBRP WHERE VBELN = BKPF-XBLNR.
APPEND ITAB_VBRP. CLEAR ITAB_VBRP.
ENDSELECT.
CHECK ITAB_VBRP[] IS NOT INITIAL.
CLEAR: SUM_NETWR.
LOOP AT ITAB_VBRP.
CHECK ITAB_VBRP-ZZMREP IN P_SUPREP.
CHECK ITAB_VBRP-ZZLREP IN P_REP.
MOVE-CORRESPONDING ITAB_VBRP TO ITAB_VBRP1.
COLLECT: ITAB_VBRP1.
SUM_NETWR = SUM_NETWR + ITAB_VBRP-NETWR.
CLEAR ITAB_VBRP.
ENDLOOP.
CHECK ITAB_VBRP1[] IS NOT INITIAL.
LOOP AT ITAB_VBRP1.
CLEAR: T_PERC.
T_PERC = ( ITAB_VBRP1-NETWR / SUM_NETWR ).
ITAB_VBRP1-PERC = T_PERC.
MODIFY ITAB_VBRP1 INDEX SY-TABIX TRANSPORTING PERC.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
EC SUNILP 05/14/2007
IF FILL_REP_INFO = 'X'.
GTAB-SUPER = BKPF-XREF2_HD. "TONY ISSUE 4743 "MOVE THE CONTENTS OF XREF2_HD TO GTAB INTERNAL TABLE - VS
ENDIF.
BC SUNILP 05/14/2007
IF BKPF-XREF1_HD IS NOT INITIAL.
CHECK BKPF-XREF1_HD IN P_REP. "TONY ISSUE 4743 " ELSE MOVE THE CONTENTS OF - VS
ELSE.
REFRESH: ITAB_VBRP, ITAB_VBRP1.
IF NOT BKPF-XBLNR IS INITIAL.
SELECT * FROM VBRP INTO ITAB_VBRP WHERE VBELN = BKPF-XBLNR.
APPEND ITAB_VBRP. CLEAR ITAB_VBRP.
ENDSELECT.
CHECK ITAB_VBRP[] IS NOT INITIAL.
CLEAR: SUM_NETWR.
LOOP AT ITAB_VBRP.
CHECK ITAB_VBRP-ZZMREP IN P_SUPREP.
CHECK ITAB_VBRP-ZZLREP IN P_REP.
MOVE-CORRESPONDING ITAB_VBRP TO ITAB_VBRP1.
COLLECT: ITAB_VBRP1.
SUM_NETWR = SUM_NETWR + ITAB_VBRP-NETWR.
CLEAR ITAB_VBRP.
ENDLOOP.
CHECK ITAB_VBRP1[] IS NOT INITIAL.
LOOP AT ITAB_VBRP1.
CLEAR: T_PERC.
T_PERC = ( ITAB_VBRP1-NETWR / SUM_NETWR ).
ITAB_VBRP1-PERC = T_PERC.
MODIFY ITAB_VBRP1 INDEX SY-TABIX TRANSPORTING PERC.
ENDLOOP.
ENDIF.
ENDIF.
EC SUNILP 05/14/2007
IF FILL_REP_INFO = 'X'.
GTAB-REP = BKPF-XREF1_HD. "TONY ISSUE 4743
ENDIF.
CHECK BKPF-LOTKZ IN P_LOTKZ. "TONY ISSUE 4743
CHECK BKPF-BRNCH IN P_VKORG. "TONY ISSUE 4743
SELECT SINGLE FILKD INTO GTAB-FILKD FROM BSEG
WHERE BUKRS = BSID-BUKRS
AND BELNR = BSID-BELNR
AND GJAHR = BSID-GJAHR
AND BUZEI = BSID-BUZEI.
gtab-gsber = bsid-gsber.
get rep info for each bsid record
IF NOT P_SUPREP IS INITIAL. "tonyc
SELECT KUNNR FROM VBPA INTO HOLD_REP UP TO 1 ROWS "tonyc
WHERE VBELN = BSID-VBELN "tonyc
AND PARVW = 'ZR'. "tonyc
ENDSELECT. "tonyc
IF NOT P_REP IS INITIAL. "tonyc
CHECK HOLD_REP = P_REP. "tonyc
ENDIF. "tonyc
GTAB-REP = HOLD_REP. "tonyc
HOLD_REP = ' '. "tonyc
ENDIF. "tonyc
PERFORM GET_KNKK_INFO. "JAM
GTAB-KLIMK_TXT = G_KLIMK_TXT.
GTAB-WAERS = G_WAERS.
GTAB-LAND1 = KNA1-LAND1.
GTAB-REGIO = KNA1-REGIO.
GTAB-KUNNR = KNA1-KUNNR.
GTAB-NAME1 = KNA1-NAME1.
GTAB-NAME2 = KNA1-NAME2.
GTAB-ORT01 = KNA1-ORT01.
*if there is no phone number for the contact, pull the phone
*number from the sold-to
IF KNVK-TELF1 = ' '.
GTAB-TELF1 = TEMP_TELF1.
ELSE.
GTAB-TELF1 = KNVK-TELF1. "JAM
ENDIF.
GTAB-CONT_NAME1 = KNVK-NAME1.
GTAB-NAMEV = KNVK-NAMEV.
verzug = bsega-netdt - dd_stida.
VERZUG = DD_STIDA - BSEGA-NETDT. "days past due calculation
OP = 'X'.
GTAB-RAST2 = GTAB-RAST3 = GTAB-RAST4 = 0.
GTAB-RAST5 = GTAB-RAST6 = OBAD = GTAB-RAST7 = 0.
IF VERZUG LE 0. "future due
GTAB-RAST1 = BSEGA-WRSHB.
ELSE.
IF VERZUG LE TAGE1. "past due 1 to tage1 days
GTAB-RAST1 = BSEGA-WRSHB.
GTAB-RAST2 = BSEGA-WRSHB.
OBAD = BSEGA-WRSHB.
ELSE.
IF VERZUG LE TAGE2. "past due tage1 to tage2 days
GTAB-RAST1 = BSEGA-WRSHB.
GTAB-RAST3 = BSEGA-WRSHB.
OBAD = BSEGA-WRSHB.
ELSE.
IF VERZUG LE TAGE3. "past due tage2 to tage3 days
GTAB-RAST1 = BSEGA-WRSHB.
GTAB-RAST4 = BSEGA-WRSHB.
OBAD = BSEGA-WRSHB.
ELSE.
IF VERZUG LE TAGE4. "past due tage3 to tage4 days
GTAB-RAST1 = BSEGA-WRSHB.
GTAB-RAST5 = BSEGA-WRSHB.
OBAD = BSEGA-WRSHB.
ELSE.
IF VERZUG GT TAGE4. "past due > tage4 days
GTAB-RAST1 = BSEGA-WRSHB.
GTAB-RAST6 = BSEGA-WRSHB.
OBAD = BSEGA-WRSHB.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
GTAB-RAST7 = GTAB-RAST1 - OBAD.
stab = gtab.
MOVE-CORRESPONDING GTAB TO STAB.
BC SUNILP 05/15/2007
IF ITAB_VBRP1[] IS NOT INITIAL.
GTAB-T_IND = 'X'.
LOOP AT ITAB_VBRP1.
MOVE-CORRESPONDING GTAB TO GTAB_LINES.
GTAB_LINES-SORT_GSB = '1'.
GTAB_LINES-SUPER = ITAB_VBRP1-ZZMREP.
GTAB_LINES-REP = ITAB_VBRP1-ZZLREP.
GTAB_LINES-RAST1 = GTAB_LINES-RAST1 * ITAB_VBRP1-PERC.
GTAB_LINES-RAST2 = GTAB_LINES-RAST2 * ITAB_VBRP1-PERC.
GTAB_LINES-RAST3 = GTAB_LINES-RAST3 * ITAB_VBRP1-PERC.
GTAB_LINES-RAST4 = GTAB_LINES-RAST4 * ITAB_VBRP1-PERC.
GTAB_LINES-RAST5 = GTAB_LINES-RAST5 * ITAB_VBRP1-PERC.
GTAB_LINES-RAST6 = GTAB_LINES-RAST6 * ITAB_VBRP1-PERC.
GTAB_LINES-RAST7 = GTAB_LINES-RAST7 * ITAB_VBRP1-PERC.
GTAB_LINES-OBAD = GTAB_LINES-OBAD * ITAB_VBRP1-PERC.
COLLECT: GTAB_LINES.
ENDLOOP.
ELSE.
MOVE-CORRESPONDING GTAB TO GTAB_LINES.
GTAB_LINES-T_IND = 'X'.
GTAB_LINES-SORT_GSB = '1'.
IF GTAB_LINES-SUPER IN P_SUPREP OR GTAB_LINES-REP IN P_REP.
COLLECT: GTAB_LINES.
ENDIF.
ENDIF.
EC SUNILP 05/15/2007
gtab-sort_gsb = stab-sort_gsb = '0'.
collect: gtab, stab.
gtab-gsber = stab-gsber = '****'.
GTAB-SORT_GSB = '1'.
IF REGIO = SPACE OR REGIO = GTAB-REGIO.
IF GTAB_LINES-SUPER IN P_SUPREP OR GTAB_LINES-REP IN P_REP.
COLLECT: GTAB, STAB.
ENDIF.
ENDIF.
END-OF-SELECTION.
TAGE1A = TAGE1 + 1.
TAGE2A = TAGE2 + 1.
TAGE3A = TAGE3 + 1.
IF SUMMEN = ' '.
sort gtab by bukrs land1 regio kunnr gsber sort_gsb.
sort gtab by bukrs land1 regio name1 kunnr gsber sort_gsb. "JAM
IF CONSOL = 'X'.
SORT GTAB BY LAND1 REGIO NAME1 KUNNR BUKRS KKBER GSBER SORT_GSB.
"TONYC
REPORT_TYPE = 'consolidated'.
ELSEIF NOT P_SUPREP[] IS INITIAL. "DEVK939546
SORT GTAB
BY SUPER REP NAME1 BUKRS KKBER LAND1 REGIO NAME1 GSBER SORT_GSB.
BC SUNILP 05/15/2007
SORT GTAB_LINES
BY SUPER REP NAME1 BUKRS KKBER LAND1 REGIO NAME1 GSBER SORT_GSB.
EC SUNILP 05/15/2007
REPORT_TYPE = 'super rep'.
CLEAR STAB. "tonyc 03/06/2004
REFRESH STAB. "tonyc 03/06/2004
ELSEIF NOT P_REP[] IS INITIAL. "DEVK939546
SORT GTAB "DEVK939546
BY REP NAME1 BUKRS KKBER LAND1 REGIO NAME1 GSBER SORT_GSB.
"DEVK939546
BC SUNILP 05/15/2007
SORT GTAB_LINES
BY REP NAME1 BUKRS KKBER LAND1 REGIO NAME1 GSBER SORT_GSB.
EC SUNILP 05/15/2007
REPORT_TYPE = 'rep'. "DEVK939546
CLEAR STAB. "tonyc 03/06/2004
REFRESH STAB. "tonyc 03/06/2004
ELSE.
SORT GTAB BY BUKRS KKBER LAND1 REGIO NAME1 KUNNR GSBER SORT_GSB.
BC SUNILP 05/15/2007
SORT GTAB_LINES BY BUKRS KKBER LAND1 REGIO NAME1 KUNNR GSBER SORT_GSB.
EC SUNILP 05/15/2007
REPORT_TYPE = 'regular'.
ENDIF.
BC SUNILP 05/15/2007
DELETE ADJACENT DUPLICATES FROM GTAB COMPARING BUKRS NAME1.
LOOP AT GTAB_LINES.
IF P_REP[] IS INITIAL.
IF GTAB_LINES-SUPER NOT IN P_SUPREP.
DELETE GTAB_LINES.
ENDIF.
ELSE.
IF GTAB_LINES-SUPER NOT IN P_SUPREP OR GTAB_LINES-REP NOT IN P_REP.
DELETE GTAB_LINES.
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT GTAB.
READ TABLE GTAB_LINES WITH KEY BUKRS = GTAB-BUKRS
NAME1 = GTAB-NAME1.
IF SY-SUBRC NE '0'.
DELETE GTAB.
ENDIF.
ENDLOOP.
EC SUNILP 05/15/2007
LOOP AT GTAB.
MOVE GTAB-BUKRS TO T001-BUKRS. READ TABLE T001.
RESERVE 5 LINES.
CASE REPORT_TYPE.
WHEN 'regular'.
IF HOLD_BUKRS <> GTAB-BUKRS.
IF SY-TABIX > 1. "TONYC
NEW-PAGE. SKIP. "TONYC
ENDIF. "TONYC
ENDIF.
PERFORM WRITE_CUST_INFO. "TONYC
PERFORM WRITE_DETAIL.
hold_bukrs = gtab-bukrs. "tonyc
WHEN 'consolidated'.
IF HOLD_KUNNR <> GTAB-KUNNR. "TONYC
PERFORM WRITE_CUST_INFO. "TONYC
ENDIF. "TONYC
HOLD_KUNNR = GTAB-KUNNR. "TONYC
PERFORM WRITE_DETAIL.
WHEN 'super rep'.
IF GTAB-T_IND NE 'X'.
BC SUNILP 05/22/2007
READ TABLE GTAB_LINES WITH KEY BUKRS = GTAB-BUKRS
NAME1 = GTAB-NAME1.
EC SUNILP 05/22/2007
IF ( HOLD_SUPER <> GTAB_LINES-SUPER ) OR
( HOLD_REP2 <> GTAB_LINES-REP ).
NEW-PAGE.
PERFORM GET_AND_WRITE_SUPERINFO.
ENDIF.
HOLD_REP2 = GTAB_LINES-REP.
HOLD_SUPER = GTAB_LINES-SUPER.
IF HOLD_KUNNR <> GTAB-KUNNR. "TONYC
WRITE :/. "TONYC
ULINE. "TONYC
PERFORM WRITE_CUST_INFO. "TONYC
ENDIF. "TONYC
HOLD_KUNNR = GTAB-KUNNR. "TONYC
PERFORM WRITE_DETAIL. "TONYC
AT END OF REP. "DEVK939546
SKIP. "DEVK939546
RESERVE 7 LINES. "DEVK939546
FORMAT COLOR COL_TOTAL INTENSIFIED. "DEVK939546
WRITE: / 'Summary for Rep:', "DEVK939546
GTAB-REP, '/', REP_NAME, 132 ONEBYTE."DEVK939546
PERFORM WRITE_TOTS TABLES RTOT. "DEVK939546
REFRESH RTOT. "DEVK939546
ENDAT. "DEVK939546
AT END OF SUPER. "DEVK939546
CLEAR STAB. "tonyc 03/06/2004
REFRESH STAB. "tonyc 03/06/2004
NEW-PAGE. SKIP. "DEVK939546
FORMAT COLOR COL_TOTAL INTENSIFIED. "DEVK939546
WRITE: / 'Summary for Super Rep:', "DEVK939546
GTAB-SUPER, '/', SUPER_NAME, 132 ONEBYTE."DEVK939546
PERFORM WRITE_TOTS TABLES STOT. "DEVK939546
REFRESH STOT. "DEVK939546
ENDAT. "DEVK939546
ELSE.
LOOP AT GTAB_LINES WHERE BUKRS = GTAB-BUKRS
AND NAME1 = GTAB-NAME1.
IF ( HOLD_SUPER <> GTAB_LINES-SUPER ) OR
( HOLD_REP2 <> GTAB_LINES-REP ).
NEW-PAGE.
PERFORM GET_AND_WRITE_SUPERINFO.
ENDIF.
HOLD_REP2 = GTAB_LINES-REP.
HOLD_SUPER = GTAB_LINES-SUPER.
IF HOLD_KUNNR <> GTAB_LINES-KUNNR.
WRITE :/.
ULINE.
PERFORM WRITE_CUST_INFO.
ENDIF.
HOLD_KUNNR = GTAB_LINES-KUNNR.
PERFORM WRITE_DETAIL.
AT END OF REP.
SKIP.
RESERVE 7 LINES.
FORMAT COLOR COL_TOTAL INTENSIFIED.
WRITE: / 'Summary for Rep:',
GTAB_LINES-REP, '/', REP_NAME, 132 ONEBYTE.
PERFORM WRITE_TOTS TABLES RTOT.
REFRESH RTOT.
ENDAT.
AT END OF SUPER.
CLEAR STAB. "tonyc 03/06/2004
REFRESH STAB. "tonyc 03/06/2004
NEW-PAGE. SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED.
WRITE: / 'Summary for Super Rep:',
GTAB_LINES-SUPER, '/', SUPER_NAME, 132 ONEBYTE.
PERFORM WRITE_TOTS TABLES STOT.
REFRESH STOT.
ENDAT.
ENDLOOP.
ENDIF.
WHEN 'rep'. "DEVK939546
LOOP AT GTAB_LINES WHERE BUKRS = GTAB-BUKRS
AND NAME1 = GTAB-NAME1.
IF HOLD_REP2 <> GTAB_LINES-REP. "DEVK939546
NEW-PAGE. "DEVK939546
PERFORM GET_AND_WRITE_REPINFO. "DEVK939546
ENDIF. "DEVK939546
HOLD_REP2 = GTAB_LINES-REP. "DEVK939546
IF HOLD_KUNNR <> GTAB_LINES-KUNNR. "DEVK939546
WRITE :/. "DEVK939546
ULINE. "DEVK939546
PERFORM WRITE_CUST_INFO. "DEVK939546
ENDIF. "DEVK939546
HOLD_KUNNR = GTAB_LINES-KUNNR. "DEVK939546
PERFORM WRITE_DETAIL. "DEVK939546
AT END OF REP. "DEVK939546
SKIP. "DEVK939546
RESERVE 7 LINES. "DEVK939546
FORMAT COLOR COL_TOTAL INTENSIFIED. "DEVK939546
WRITE: / 'Summary for Rep:', "DEVK939546
GTAB_LINES-REP, '/', REP_NAME, 132 ONEBYTE."DEVK939546
PERFORM WRITE_TOTS TABLES RTOT. "DEVK939546
REFRESH RTOT. "DEVK939546
ENDAT. "DEVK939546
ENDLOOP.
ENDCASE.
ENDLOOP.
ENDIF.
OP = ' '.
REFRESH GTAB.
IF NOT REPORT_TYPE = 'super rep'.
ULINE.
ENDIF.
SKIP 1.
IF SUMMEN = ' '. "if 'output totals only' bypass new-page
NEW-PAGE. SKIP.
ENDIF.
WRITE: /25 TEXT-030, 132 ONEBYTE, /25 TEXT-031, 132 ONEBYTE.
PERFORM WRITE_TOTS TABLES STAB. "DEVK939546
TOP-OF-PAGE.
INTENS = SPACE.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE: / SY-VLINE, 1 TEXT-001, DD_STIDA, 75 TEXT-051, 132 SY-VLINE.
ULINE.
WRITE: / SY-VLINE, 13 SY-VLINE, 30 SY-VLINE,
47 SY-VLINE, 58 TEXT-003, 81 SY-VLINE,
92 TEXT-003, 115 SY-VLINE, 118 TEXT-003, 132 SY-VLINE,
/ SY-VLINE, 02 TEXT-004, 13 SY-VLINE, TEXT-002,
30 SY-VLINE, 32 TEXT-018, 47 SY-VLINE,
50 '1', 54 TEXT-040, 57 TAGE1, 64 SY-VLINE, " 65 tage2,
67 TAGE1A, 72 TEXT-040, 75 TAGE2,
81 SY-VLINE, 83 TAGE2A, 89 TEXT-040, 91 TAGE3, 98 SY-VLINE,
101 TAGE3A, 107 TEXT-040, 110 TAGE4, 115 SY-VLINE,
117 TAGE4, 123 TEXT-017, 132 SY-VLINE.
ULINE.
SKIP 1.
SUMMARY.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
FORM write_tots *
--> PTAB *
FORM WRITE_TOTS TABLES PTAB TYPE TOT_TAB. "DEVK939546
CLEAR INTENS. "DEVK939546
FORMAT COLOR COL_HEADING INTENSIFIED OFF. "DEVK939546
IF P_CONV = 'X'. "tonyc issue #3047 begin
WRITE /4 TEXT-101.
WRITE: /4 TEXT-102,
50 TEXT-100.
ENDIF. "tonyc issue #3047 end
ULINE. "DEVK939546
SORT PTAB BY BUKRS GSBER. "DEVK939546
LOOP AT PTAB. "DEVK939546
IF SY-TABIX > 1.
WRITE_TOTAL = 'X'.
ENDIF.
MOVE PTAB-BUKRS TO T001-BUKRS. READ TABLE T001. "DEVK939546
MOVE PTAB-GSBER TO T001-WAERS. "DEVK939546
IF P_CONV = 'X'. "tonyc issue #3047 begin
PERFORM CONVERT_VALUES USING STAB-RAST1
STAB-GSBER.
PERFORM CONVERT_VALUES USING STAB-RAST2
STAB-GSBER.
PERFORM CONVERT_VALUES USING STAB-RAST3
STAB-GSBER.
PERFORM CONVERT_VALUES USING STAB-RAST4
STAB-GSBER.
PERFORM CONVERT_VALUES USING STAB-RAST5
STAB-GSBER.
PERFORM CONVERT_VALUES USING STAB-RAST6
STAB-GSBER.
PERFORM CONVERT_VALUES USING STAB-RAST7
STAB-GSBER.
ENDIF. "TOnyc issue #3047 end
MOVE-CORRESPONDING PTAB TO STAB.
COLLECT STAB.
IF P_KKBER = 'X'. "TONYC ISSUE #2500
CLEAR HOLD_KKBER_DESC2.
SELECT SINGLE KKBTX INTO HOLD_KKBER_DESC2 FROM T014T
WHERE KKBER = STAB-KKBER AND
SPRAS = 'E'.
IF SY-SUBRC <> '0'.
HOLD_KKBER_DESC2 = 'Undetermined'.
ENDIF.
FORMAT COLOR OFF.
WRITE: / SY-VLINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
WRITE: 6 STAB-GSBER, HOLD_KKBER_DESC2, SY-VLINE.
ULINE.
FORMAT COLOR OFF.
WRITE: / SY-VLINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
IF P_CONV = 'X'. "tonyc issue #3047 begin
T001-WAERS = 'USD'.
ENDIF. "tonyc issue #3047 end
WRITE: 13 STAB-RAST1 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) STAB-RAST7 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) STAB-RAST2 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) STAB-RAST3 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) STAB-RAST4 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) STAB-RAST5 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) STAB-RAST6 NO-ZERO CURRENCY T001-WAERS, SY-VLINE.
HOLD_BUKRS2 = STAB-BUKRS. "TONYC ISSUE #2500
ULINE.
FORMAT COLOR OFF.
TOTAL_RAST1 = STAB-RAST1 + TOTAL_RAST1.
TOTAL_RAST2 = STAB-RAST2 + TOTAL_RAST2.
TOTAL_RAST3 = STAB-RAST3 + TOTAL_RAST3.
TOTAL_RAST4 = STAB-RAST4 + TOTAL_RAST4.
TOTAL_RAST5 = STAB-RAST5 + TOTAL_RAST5.
TOTAL_RAST6 = STAB-RAST6 + TOTAL_RAST6.
TOTAL_RAST7 = STAB-RAST7 + TOTAL_RAST7.
ELSE.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF. "DEVK939546
IF INTENS = SPACE. "DEVK939546
FORMAT COLOR COL_NORMAL INTENSIFIED OFF. "DEVK939546
INTENS = 'X'. "DEVK939546
ELSE. "DEVK939546
FORMAT COLOR COL_NORMAL INTENSIFIED ON. "DEVK939546
INTENS = SPACE. "DEVK939546
ENDIF. "DEVK939546
WRITE: / SY-VLINE, PTAB-BUKRS, PTAB-GSBER, SY-VLINE, "DEVK939546
(14) PTAB-RAST1 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
(14) PTAB-RAST7 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
(14) PTAB-RAST2 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
(14) PTAB-RAST3 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
(14) PTAB-RAST4 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
(14) PTAB-RAST5 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,"DEVK939546
(14) PTAB-RAST6 NO-ZERO CURRENCY T001-WAERS, SY-VLINE."DEVK939546
TOTAL_RAST1 = STAB-RAST1 + TOTAL_RAST1.
TOTAL_RAST2 = STAB-RAST2 + TOTAL_RAST2.
TOTAL_RAST3 = STAB-RAST3 + TOTAL_RAST3.
TOTAL_RAST4 = STAB-RAST4 + TOTAL_RAST4.
TOTAL_RAST5 = STAB-RAST5 + TOTAL_RAST5.
TOTAL_RAST6 = STAB-RAST6 + TOTAL_RAST6.
TOTAL_RAST7 = STAB-RAST7 + TOTAL_RAST7.
ENDIF.
ENDLOOP. "DEVK939546
ULINE. "DEVK939546
IF P_KKBER = 'X'. "TONYC ISSUE #2500
IF P_CONV = 'X'. "tonyc issue #3047 begin
FORMAT COLOR OFF.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
WRITE: SY-VLINE,
6 'TOTAL ', SY-VLINE.
ULINE.
FORMAT COLOR OFF.
WRITE: / SY-VLINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
WRITE: 13 TOTAL_RAST1 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST7 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST2 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST3 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST4 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST5 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST6 NO-ZERO CURRENCY T001-WAERS, SY-VLINE.
ULINE.
ENDIF. "tonyc issue #3047 end
ELSE.
IF P_CONV = 'X'.
FORMAT COLOR OFF.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
WRITE: SY-VLINE,
6 'TOTAL ', SY-VLINE.
ULINE.
FORMAT COLOR OFF.
WRITE: / SY-VLINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
WRITE: 13 TOTAL_RAST1 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST7 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST2 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST3 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST4 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST5 NO-ZERO CURRENCY T001-WAERS, SY-VLINE,
(14) TOTAL_RAST6 NO-ZERO CURRENCY T001-WAERS, SY-VLINE.
ULINE.
ENDIF.
ENDIF.
SKIP 1. "DEVK939546
ENDFORM. "DEVK939546
*& Form GET_KNKK_INFO
text
--> p1 text
<-- p2 text
FORM GET_KNKK_INFO.
CLEAR: G_WAERS,
G_KLIMK_TXT,
KNKK-KLIMK.
get credit control area (KKBER) for comp code (BUKRS)
SELECT SINGLE KLIMK
INTO KNKK-KLIMK
FROM KNKK
WHERE KUNNR = KNA1-KUNNR AND
KKBER = T001-KKBER.
IF SY-SUBRC = 0.
get currency for cred ctrl area
CLEAR IT_T014.
READ TABLE IT_T014 WITH KEY KKBER = T001-KKBER BINARY SEARCH.
G_WAERS = IT_T014-WAERS.
WRITE KNKK-KLIMK TO G_KLIMK_TXT CURRENCY G_WAERS.
ENDIF.
ENDFORM. " GET_KNKK_INFO
*& Form SELECT_KNKK
text
-->P_KKBER Credit Limit Controlling Area
<--P_FOUND_KNKK Indicates if record found
FORM SELECT_KNKK USING P_KKBER
CHANGING P_FOUND_KNKK.
CLEAR: G_WAERS,
G_KLIMK_TXT,
KNKK-KLIMK.
SELECT SINGLE KLIMK
INTO KNKK-KLIMK
FROM KNKK
WHERE KUNNR = KNA1-KUNNR AND
KKBER = P_KKBER.
IF SY-SUBRC = 0.
P_FOUND_KNKK = C_TRUE.
get currency for cred ctrl area
CLEAR IT_T014.
READ TABLE IT_T014 WITH KEY KKBER = P_KKBER BINARY SEARCH.
G_WAERS = IT_T014-WAERS.
WRITE KNKK-KLIMK TO G_KLIMK_TXT CURRENCY G_WAERS.
ELSE.
P_FOUND_KNKK = C_FALSE.
ENDIF.
ENDFORM. " SELECT_KNKK
*& Form GET_CUST_CONTACT & PHONE NUMBER
FORM GET_CUST_CONTACT.
CLEAR KNVK.
C_CREDIT_ABTNR = '0003'. "look for contact in credit dept
SELECT NAME1
NAMEV
TELF1
INTO (KNVK-NAME1,
KNVK-NAMEV,
KNVK-TELF1)
FROM KNVK
WHERE KUNNR = KNA1-KUNNR AND
ABTNR = C_CREDIT_ABTNR.
ENDSELECT.
If there wasn't a contact person for the credit dept, then just
pull up the first contact info we find regardless of dept
IF SY-SUBRC <> 0.
CLEAR KNVK.
SELECT NAME1
NAMEV
TELF1
INTO (KNVK-NAME1,
KNVK-NAMEV,
KNVK-TELF1)
FROM KNVK
WHERE KUNNR = KNA1-KUNNR.
IF SY-SUBRC = 0.
EXIT.
ENDIF.
ENDSELECT.
ELSE.
EXIT.
ENDIF. "not contact found in credit dept.
ENDFORM. " GET_CUST_CONTACT
*& Form LOAD_T014
FORM LOAD_T014.
SELECT *
INTO TABLE IT_T014
FROM T014.
SORT IT_T014.
ENDFORM. " LOAD_T014
*& Form WRITE_CUST_INFO "TONYC
text moved code and created a form. for cleaner code "TONYC
--> p1 text
<-- p2 text
FORM WRITE_CUST_INFO.
IF NOT REPORT_TYPE = 'super rep'.
IF SY-TABIX > 1.
ULINE.
ENDIF.
ENDIF.
CONCATENATE GTAB-NAMEV "JAM
GTAB-CONT_NAME1
INTO G_CONT_NAME
SEPARATED BY SPACE.
FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
IF REPORT_TYPE = 'super rep'.
IF GTAB-T_IND NE 'X'.
WRITE: / GTAB-KUNNR, GTAB-NAME1, GTAB-ORT01, GTAB-REGIO, GTAB-LAND1,
"g_cont_name,
132 ONEBYTE.
ELSE.
WRITE: / GTAB_LINES-KUNNR, GTAB_LINES-NAME1, GTAB_LINES-ORT01, GTAB_LINES-REGIO, GTAB_LINES-LAND1,
"g_cont_name,
132 ONEBYTE.
ENDIF.
WRITE: /21 onebyte, 12 gtab-name2, 45 gtab-ort01,
gtab-telf1, "gtab-klimk_txt, gtab-waers.
132 onebyte.
ELSE.
WRITE: / GTAB-KUNNR, GTAB-NAME1, GTAB-ORT01, GTAB-REGIO, GTAB-LAND1,
"g_cont_name, "JAM
132 ONEBYTE.
WRITE: /11 onebyte, 12 gtab-name2, 45 gtab-ort01,
gtab-telf1, "gtab-klimk_txt, gtab-waers, "JAM
132 onebyte.
ENDIF.
ENDFORM. " WRITE_CUST_INFO
*& Form GET_AND_WRITE_SUPERINFO
text
--> p1 text
<-- p2 text
FORM GET_AND_WRITE_SUPERINFO.
ULINE.
IF GTAB-T_IND NE 'X'.
SELECT SINGLE NAME1 FROM KNA1 INTO SUPER_NAME "TONYC
WHERE KUNNR = GTAB-SUPER. "TONYC
SELECT SINGLE NAME1 FROM KNA1 INTO REP_NAME "TONYC
WHERE KUNNR = GTAB-REP. "TONYC
CONCATENATE SUPER_NAME REP_NAME INTO REPS_INFO "TONYC
SEPARATED BY BACKSLASH. "TONYC
FORMAT COLOR COL_TOTAL INTENSIFIED. "TONYC
WRITE:/ GTAB-SUPER, '/', "TONYC
GTAB-REP, "TONYC
25 REPS_INFO, 132 ONEBYTE. "TONYC
ELSE.
SELECT SINGLE NAME1 FROM KNA1 INTO SUPER_NAME
WHERE KUNNR = GTAB_LINES-SUPER.
SELECT SINGLE NAME1 FROM KNA1 INTO REP_NAME
WHERE KUNNR = GTAB_LINES-REP.
CONCATENATE SUPER_NAME REP_NAME INTO REPS_INFO
SEPARATED BY BACKSLASH.
FORMAT COLOR COL_TOTAL INTENSIFIED.
WRITE:/ GTAB_LINES-SUPER, '/',
GTAB_LINES-REP,
25 REPS_INFO, 132 ONEBYTE.
ENDIF.
ENDFORM. " GET_AND_WRITE_SUPERINFO
*& Form GET_AND_WRITE_REPINFO
text
--> p1 text
<-- p2 text
FORM GET_AND_WRITE_REPINFO.
ULINE.
SELECT SINGLE NAME1 FROM KNA1 INTO REP_NAME
WHERE KUNNR = GTAB-REP.
FORMAT COLOR COL_TOTAL INTENSIFIED.
WRITE:/ GTAB-REP,
25 REP_NAME, 132 ONEBYTE.
ENDFORM. " GET_AND_WRITE_REPINFO
*& Form WRITE_DETAIL
text
--> p1 text
<-- p2 text
FORM WRITE_DETAIL.
clear z_description. "TONYC #2216
move GTAB-KLIMK_TXT to z_hold_limit.
IF z_hold_limit = 400.
z_description = 'COD/Check'.
elseif z_hold_limit = 500.
z_description = 'COD/Cash'.
elseif z_hold_limit = 600.
z_description = 'Need Dealer Agree'.
elseif z_hold_limit = 700.
z_description = 'Need PDCs'.
elseif z_hold_limit = 800.
z_description = 'Need Fin Statements'.
elseif z_hold_limit = 900.
z_description = 'Past Due Balance'.
elseif z_hold_limit = 1000.
z_description = 'Miracle?'.
endif. "TONYC #2216
MOVE GTAB-GSBER TO T001-WAERS.
FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
IF HOLD_KUNNR2 <> GTAB-KUNNR. "TONYC
IF REPORT_TYPE = 'super rep'.
WRITE: /3 ONEBYTE, GTAB-BUKRS.
WRITE: 92 gtab-klimk_txt, gtab-waers, 132 onebyte. "TONYC
WRITE: 92 gtab-klimk_txt, z_description,132 onebyte."TONYC #2500
ELSE.
WRITE: / ONEBYTE, GTAB-BUKRS.
WRITE: 92 gtab-klimk_txt, z_description,132 onebyte."TONYC #2500
WRITE: 92 gtab-klimk_txt, gtab-waers, 132 onebyte. "TONYC
ENDIF.
ENDIF.
FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
IF P_KKBER = 'X'. "TONYC ISSUE# 2500
CLEAR HOLD_KKBER_DESC.
SELECT SINGLE KKBTX INTO HOLD_KKBER_DESC FROM T014T
WHERE KKBER = GTAB-KKBER AND
SPRAS = 'E'.
IF SY-SUBRC <> '0'.
HOLD_KKBER_DESC = 'Undetermined'.
ENDIF.
SELECT SINGLE KLIMK CTLPC
INTO (HOLD_KLIMK, HOLD-CTLPC)
FROM KNKK
WHERE KUNNR = GTAB-KUNNR AND
KKBER = GTAB-KKBER.
SELECT SINGLE RTEXT INTO HOLD-CTLPC-TEXT FROM T691T
WHERE SPRAS = 'EN' AND
CTLPC = HOLD-CTLPC AND
KKBER = GTAB-KKBER.
WRITE HOLD_KLIMK TO HOLD_KLIMK2 CURRENCY GTAB-WAERS.
WRITE: /7 GTAB-KKBER,
12 HOLD_KKBER_DESC,
80 HOLD_KLIMK2,
103 GTAB-GSBER,
108 HOLD-CTLPC-TEXT.
ENDIF. "TONYC ISSUE# 2500
FORMAT COLOR COL_NORMAL INTENSIFIED ON. "TONYC
MOVE STAB-GSBER TO T001-WAERS.
CLEAR HOLD_NAME.
SELECT SINGLE NAME1 FROM KNA1 INTO HOLD_NAME
WHERE KUNNR = GTAB-FILKD.
WRITE: /15 GTAB-FILKD,
30 HOLD_NAME.
IF GTAB-T_IND NE 'X'.
WRITE: /15(14) GTAB-RAST1 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB-RAST7 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB-RAST2 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB-RAST3 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB-RAST4 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB-RAST5 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB-RAST6 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
132 ONEBYTE.
ELSE.
IF REPORT_TYPE NE 'super rep'.
LOOP AT GTAB_LINES WHERE KUNNR = GTAB-KUNNR.
WRITE: / GTAB_LINES-SUPER, ONEBYTE,
15(14) GTAB_LINES-RAST1 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST7 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST2 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST3 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST4 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST5 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST6 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
132 ONEBYTE.
ENDLOOP.
ELSE.
WRITE: / GTAB_LINES-SUPER, ONEBYTE,
15(14) GTAB_LINES-RAST1 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST7 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST2 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST3 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST4 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST5 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
(14) GTAB_LINES-RAST6 NO-ZERO CURRENCY T001-WAERS, ONEBYTE,
132 ONEBYTE.
ENDIF.
ENDIF.
HOLD_BUKRS = GTAB-BUKRS. "Tonyc
HOLD_KUNNR2 = GTAB-KUNNR. "TONYC
HOLD_KKBER = GTAB-KKBER. "TONYC ISSUE #2500
IF REPORT_TYPE = 'super rep' OR REPORT_TYPE = 'rep'. "DEVK939546
IF GTAB-T_IND NE 'X'.
MOVE-CORRESPONDING GTAB TO RTOT. "DEVK939546
COLLECT RTOT. "DEVK939546
ELSE.
MOVE-CORRESPONDING GTAB_LINES TO RTOT.
COLLECT RTOT.
ENDIF.
IF REPORT_TYPE = 'super rep'. "DEVK939546
IF GTAB-T_IND NE 'X'.
MOVE-CORRESPONDING GTAB TO STOT. "DEVK939546
COLLECT STOT. "DEVK939546
ELSE.
MOVE-CORRESPONDING GTAB_LINES TO STOT.
COLLECT STOT.
ENDIF.
ENDIF. "DEVK939546
ENDIF. "DEVK939546
ENDFORM. " WRITE_DETAIL
*& Form convert_values
text
-->P_STAB_RAST1 text
-->P_STAB_GSBER text
FORM CONVERT_VALUES USING P_STAB_RAST1 "tonyc issue #3047 begin
P_STAB-GSBER.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
DATE = SY-DATUM
FOREIGN_AMOUNT = P_STAB_RAST1
FOREIGN_CURRENCY = P_STAB-GSBER
LOCAL_CURRENCY = 'USD'
RATE = 0
TYPE_OF_RATE = 'M'
READ_TCURR = 'X'
IMPORTING
EXCHANGE_RATE =
FOREIGN_FACTOR =
LOCAL_AMOUNT = P_STAB_RAST1
LOCAL_FACTOR =
EXCHANGE_RATEX =
FIXED_RATE =
DERIVED_RATE_TYPE =
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 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.
ENDFORM. " convert_valuessolved
-
Report Structure based CKF percentage total colume Error
Dear Guru's
In Report Created structure in Rows structure created formulas for sub total, CKF using in colume for finding percentage on sale,
where formula used in structure, percentage also adding instead of average. Applied exception aggregation for plant but no result
Example scenario : Zone1 created with selection of plant, division and region.same as a UCWL and internal total Zone1+UCWL used formula
percentage CKF working as addition. Red colour highlighted are wrong totals
Month
Target
Prorata
Target
Actuals
Today
Actual
Todate
%Age
Achiev
Target
PPC % age
PPC %Age
Actual
Rajasthan Zone1
45,000
36,000
1,276
27,473
76
67
54
UCWL
25,000
20,000
952
18,183
91
100
76
ZONE1+UCWL Total
70,000
56,000
2,228
45,656
167
167
129
Rajasthan Zone 2
60,000
48,000
1,722
34,746
72
65
10
Rajasthan Total
1,30,000
1,04,000
3,950
80,403
240
232
140
Gujarat-Sirohi
1,12,000
89,600
2,555
85,877
96
42
Gujarat-Kalol
60,000
48,000
1,644
34,945
73
75
30
Gujarat- P Pur
8,000
6,400
247
6,035
94
100
Gujarat Total
1,80,000
1,44,000
4,447
1,26,857
263
217
30
Treat this most urgent, report is pending due to percentage total.
Regards
rameshI applied this:
If([Process Category] InList("Process01") And IsNull([Date]);[Percentage];Max(Date)))
[Percentage] = (Count([Date])/Count([Operation]))*100.
but, this is not becoming true - even when Operation has one Date
Showing result as:
List#,Process01,Process02
100, 11/12/2010, 11/15/2010
But result should be
100,50%,11/15/2010
Can anyone help me achieve the right result!
Thanks in advance. -
How to get Text for nodes in Tree Structure
Hi Friends,
How to get Text for nodes in Tree Structure
REPORT YFIIN_REP_TREE_STRUCTURE no standard page heading.
I N I T I A L I Z A T I O N
INITIALIZATION.
AUTHORITY-CHECK OBJECT 'ZPRCHK_NEW' :
ID 'YFIINICD' FIELD SY-TCODE.
IF SY-SUBRC NE 0.
MESSAGE I000(yFI02) with SY-TCODE .
LEAVE PROGRAM.
ENDIF.
class screen_init definition create private.
Public section
public section.
class-methods init_screen.
methods constructor.
Private section
private section.
data: container1 type ref to cl_gui_custom_container,
container2 type ref to cl_gui_custom_container,
tree type ref to cl_gui_simple_tree.
methods: fill_tree.
endclass.
Class for Handling Events
class screen_handler definition.
Public section
public section.
methods: constructor importing container
type ref to cl_gui_custom_container,
handle_node_double_click
for event node_double_click
of cl_gui_simple_tree
importing node_key .
Private section
private section.
endclass.
*& Classes implementation
class screen_init implementation.
*& Method INIT_SCREEN
method init_screen.
data screen type ref to screen_init.
create object screen.
endmethod.
*& Method CONSTRUCTOR
method constructor.
data: events type cntl_simple_events,
event like line of events,
event_handler type ref to screen_handler.
create object: container1 exporting container_name = 'CUSTOM_1',
tree exporting parent = container1
node_selection_mode =
cl_gui_simple_tree=>node_sel_mode_multiple.
create object: container2 exporting container_name = 'CUSTOM_2',
event_handler exporting container = container2.
event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
event-appl_event = ' '. "system event, does not trigger PAI
append event to events.
call method tree->set_registered_events
exporting events = events.
set handler event_handler->handle_node_double_click for tree.
call method: me->fill_tree.
endmethod.
*& Method FILL_TREE
method fill_tree.
data: node_table type table of abdemonode,
node type abdemonode.
types: begin of tree_node,
folder(50) type c,
tcode(60) type c,
tcode1(60) type c,
tcode2(60) type c,
text(60) type c,
text1(60) type c,
text2(60) type c,
end of tree_node.
data: wa_tree_node type tree_node,
t_tree_node type table of tree_node.
wa_tree_node-folder = text-001.
wa_tree_node-tcode = text-002.
wa_tree_node-text = 'Creditors ageing'.
wa_tree_node-tcode1 = text-003.
wa_tree_node-text1 = 'GR/IR aging'.
wa_tree_node-tcode2 = text-004.
wa_tree_node-text2 = 'Bank Balance'.
append wa_tree_node to t_tree_node.
clear wa_tree_node .
wa_tree_node-folder = text-005.
wa_tree_node-tcode = text-006.
wa_tree_node-text = 'Creditors ageing'.
wa_tree_node-tcode1 = text-007.
wa_tree_node-text1 = 'Creditors ageing'.
wa_tree_node-tcode2 = text-008.
wa_tree_node-text2 = 'Creditors ageing'.
append wa_tree_node to t_tree_node.
clear wa_tree_node .
wa_tree_node-folder = text-009.
wa_tree_node-tcode = text-010.
wa_tree_node-text = 'Creditors ageing'.
wa_tree_node-tcode1 = text-011.
wa_tree_node-text1 = 'Creditors ageing'.
wa_tree_node-tcode2 = text-012.
wa_tree_node-text2 = 'Creditors ageing'.
append wa_tree_node to t_tree_node.
clear wa_tree_node .
node-hidden = ' '. " All nodes are visible,
node-disabled = ' '. " selectable,
node-isfolder = 'X'. " a folder,
node-expander = ' '. " have no '+' sign forexpansion.
loop at t_tree_node into wa_tree_node.
at new folder.
node-isfolder = 'X'. " a folder,
node-node_key = wa_tree_node-folder.
clear node-relatkey.
clear node-relatship.
node-text = wa_tree_node-folder.
node-n_image = ' '.
node-exp_image = ' '.
append node to node_table.
endat.
at new tcode .
node-isfolder = ' '. " a folder,
node-n_image = '@CS@'. "AV is the internal code
node-exp_image = '@CS@'. "for an airplane icon
node-node_key = wa_tree_node-tcode.
node-text = wa_tree_node-text .
node-relatkey = wa_tree_node-folder.
node-relatship = cl_gui_simple_tree=>relat_last_child.
endat.
append node to node_table.
at new tcode1 .
node-isfolder = ' '. " a folder,
node-n_image = '@CS@'. "AV is the internal code
node-exp_image = '@CS@'. "for an airplane icon
node-node_key = wa_tree_node-tcode1.
node-relatkey = wa_tree_node-folder.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-text = wa_tree_node-text1.
endat.
append node to node_table.
at new tcode2 .
node-isfolder = ' '. " a folder,
node-n_image = '@CS@'. "AV is the internal code
node-exp_image = '@CS@'. "for an airplane icon
node-node_key = wa_tree_node-tcode2.
node-relatkey = wa_tree_node-folder.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-text = wa_tree_node-text2.
endat.
append node to node_table.
endloop.
call method tree->add_nodes
exporting table_structure_name = 'ABDEMONODE'
node_table = node_table.
endmethod.
endclass.
*& Class implementation
class screen_handler implementation.
*& Method CONSTRUCTOR
method constructor.
create object: HTML_VIEWER exporting PARENT = CONTAINER,
LIST_VIEWER exporting I_PARENT = CONTAINER.
endmethod.
*& Method HANDLE_NODE_DOUBLE_CLICK
method handle_node_double_click.
case node_key(12).
when 'Creditors'.
submit YFIIN_REP_CREADITORS_AGING via selection-screen and return.
when 'Vendor'.
submit YFIIN_REP_VENDOR_OUTSTANDING via selection-screen and return.
when 'Customer'.
submit YFIIN_REP_CUSTOMER_OUTSTANDING via selection-screen and
return.
when 'GR/IR'.
submit YFIIN_REP_GRIR_AGING via selection-screen and return.
when 'Acc_Doc_List'.
submit YFIIN_REP_ACCOUNTINGDOCLIST via selection-screen and return.
when 'Bank Bal'.
submit YFIIN_REP_BANKBALANCE via selection-screen and return.
when 'Ven_Cus_Dtl'.
submit YFIIN_REP_VENDORCUST_DETAIL via selection-screen and return.
when 'G/L_Open_Bal'.
submit YFIIN_REP_OPENINGBALANCE via selection-screen and return.
when 'Usr_Authn'.
submit YFIIN_REP_USERAUTHRIZATION via selection-screen and return.
endcase.
endmethod.
endclass.
Program execution ************************************************
load-of-program.
call screen 9001.
at selection-screen.
Dialog Modules PBO
*& Module STATUS_9001 OUTPUT
text
module status_9001 output.
set pf-status 'SCREEN_9001'.
set titlebar 'TIT_9001'.
call method screen_init=>init_screen.
endmodule. " STATUS_9001 OUTPUT
Dialog Modules PAI
*& Module USER_COMMAND_9001 INPUT
text
module user_command_9001 input.
endmodule. " USER_COMMAND_9001 INPUT
*& Module exit_9001 INPUT
text
module exit_9001 input.
case sy-ucomm.
when 'EXIT'.
set screen 0.
endcase.
endmodule.
exit_9001 INPUTyou can read the table node_table with nody key value which imports when docubble click the the tree node (Double clifk event).
Regards,
Gopi .
Reward points if helpfull. -
Need help in transforming a customer structure to an analytical structure
I have the following tables. I am interested in studying the manager's attributes that will predict the sales of Product A. In addition, I want to study whether the client attributes have an impact of the sales of product A. Can someone give me an example on how to combine these three tables so that I can do my analysis?
Sales Managers -> (1-n) Clients -> (1-n) Products
Sales Managers Attributes
Manager ID
Region
State
Years of experience
Age
Clients Attributes
Client Type (Technology / Finance, etc)
Client Size (Large / Medium / Small)
Product Attributes
Products (A / B / C)
Revenue
Sale Date
1. If I transform the data into the following structure, will this structure allow me to study the relationship between the attributes of sales managers/clients and the likelihood of selling product A?
My concern is that each sales manager is repeated multiple times. For example if a sales manager have clients of Technology and of Finance and clients of all sizes (Large/Medium/Small). That's six rows of data for each unique manager.
Manager ID, Region, State, Years of Experience, Age, Client Type, Client Size, # Clients, Revenue, Sale Year, # Products Sold, Product A Sold (yes/no)
123, East, MA, 5, 25, Technology, Large, 2, $10000, 2007, 1000, Yes
123, East, MA, 5, 25, Technology, Medium, 5, $6000, 2007, 500, Yes
123, East, MA, 5, 25, Technology, Small, 10, $4000, 2007, 200, No
123, East, MA, 5, 25, Finance, Large, 1, $5000, 2007, 500, Yes
123, East, MA, 5, 25, Finance, Medium, 1, $5000, 2007, 500, Yes
123, East, MA, 5, 25, Finance, Small, 1, $5000, 2007, 500, No
124, West, CA, 10, 35, Technology, Large, 2, $10000, 2007, 1000, No
124, West, CA, 10, 35, Technology, Medium, 5, $6000, 2007, 500, Yes
2. What algorithm should I use to study the input variables to predict the likelihood of selling product A?HI,
You could use Association Rules for coming up with the probability of sales given the sale of a specific item.
ODM will handle transactional input of sales information for this purpose.
As for data preparation, you should take a look at Data Miner Workflow's Aggregation Node. This node allows you generate "nested tables' of the type DM_NESTED_NUMERICAL and DM_NESTED_CATEGORICAL. Using this approach, you can create structures to capture the 1 to many (as in your case of sales managers to clients). However you can not use it to capture 1 to many to many ( as in your sales managers to clients to products). See simple script below showing how nested data is creates using the SH.SALES sample data.
For demos on how to do either AR or Aggregration, you can download SQL Dev 3.0 and use it against a DB of 11.2.0.1 or higher. There are OBE (Oracle By Example, available on OTN) tutorials and Cue Card Tutorials (shipped in SQL Dev).
Thanks, Mark
WITH
/* START OF SQL FOR NODE: SALES */
"N$10071" as (select /*+ inline */ "SALES"."PROMO_ID",
"SALES"."TIME_ID",
"SALES"."CHANNEL_ID",
"SALES"."CUST_ID",
"SALES"."PROD_ID",
"SALES"."QUANTITY_SOLD",
"SALES"."AMOUNT_SOLD"
from "SH"."SALES" )
/* END OF SQL FOR NODE: SALES */
/* START OF SQL FOR NODE: Aggregate */
"N$10072" as (SELECT t0."CUST_ID",
t0."QUANTITY_SOLD_COUNT",
t1."AMOUNT_SOLD_COUNT",
t2."QUANTITY_SOLD_SUM",
t3."AMOUNT_SOLD_SUM",
t4."AMOUNT_SOLD_SUM_1"
FROM
(SELECT "CUST_ID", COUNT("QUANTITY_SOLD") "QUANTITY_SOLD_COUNT"
FROM "N$10071"
GROUP BY "CUST_ID") t0,
(SELECT "CUST_ID", COUNT("AMOUNT_SOLD") "AMOUNT_SOLD_COUNT"
FROM "N$10071"
GROUP BY "CUST_ID") t1,
(SELECT "CUST_ID", SUM("QUANTITY_SOLD") "QUANTITY_SOLD_SUM"
FROM "N$10071"
GROUP BY "CUST_ID") t2,
(SELECT "CUST_ID", SUM("AMOUNT_SOLD") "AMOUNT_SOLD_SUM"
FROM "N$10071"
GROUP BY "CUST_ID") t3,
(SELECT "CUST_ID",
CAST(COLLECT(DM_Nested_Numerical(ID5, "AMOUNT_SOLD_SUM_1")) AS DM_Nested_Numericals ) "AMOUNT_SOLD_SUM_1"
FROM
(SELECT "CUST_ID",
("PROD_ID") ID5,
SUM("AMOUNT_SOLD") "AMOUNT_SOLD_SUM_1"
FROM "N$10071"
GROUP BY "CUST_ID", (("PROD_ID")) )
GROUP BY "CUST_ID") t4
WHERE t0."CUST_ID" = t1."CUST_ID"(+)
AND t0."CUST_ID" = t2."CUST_ID"(+)
AND t0."CUST_ID" = t3."CUST_ID"(+)
AND t0."CUST_ID" = t4."CUST_ID"(+)
/* END OF SQL FOR NODE: Aggregate */
select * from "N$10072"
Maybe you are looking for
-
720p project renders as 4:3 quicktime
Hey all, So I have a 720p timeline (HDTV 720p preset) and when I go to export movie using compressor, I choose web download H264 800kbs - The resulting video is full frame (?!) How do I render out compressed, 16:9 video clips from my 720p timeline at
-
Split the incoming data into multiple grouped output records
I have three fields in the source, Student ID, Student name and Student Marks. I need to map the details in the destination, by grouping the data on the basis of marks obtained. Each time there's a new mark , the corresponding details of names and st
-
I will use my Ipad II for printing on a Windows PC with OS XP. Can I install airprint for Samsung clp-315? Who can help me??
-
Ipod mini cannot be synced-Please Help
Hi, I can not sync music to my ipod from itunes because it keeps saying "The ipod cannot be synced. The required disk cannot be found." I have already tried reinstalling my USB drive and it is still not working. The ipod shows up in itunes and then o
-
How to insert signals into multiple columns in db, dbtoolset
I have a labVIEW program that is currenly simulating voltage and a current signal using the DAQ Assistant. I'm using the database connectivity toolset. I am currently able to insert one signal into the database converted to a float(I can insert both