Average Days to Pay
Hi all,
Is there a way for SAP to calculate the average days to pay for the customer? There is a field in BP Master under the Payment terms tab, but the field does not seem to calculate. Or does anyone have an idea on how to write a query for it?
thanks,
Jane
Hi Jane,
I just posted the solution to your problem here:
Link: [http://www.tellme747.com/?p=312]
I had been looking into the Average Delay field and found out it is a dead field. If you use the code in my post you can have it update automatically with the information you are looking for.
Let me know if you have any questions.
Mike
Similar Messages
-
Average Days to Pay for Customers
In 2007A I thought there was a place where you can get the average days a customer pays. Whether it was on the Dunning reports or the aging but I thought it was there....I cannot seem to find this, was it removed from 2005A?
Anyways, I am looking for a report that will show the average days a customer pays...if it is not on 2007A can someone help me with a simple query to create a report?
Thanks a million!!Here you go Grace - this shows the number for ALL invoices...we created a Formatted Search (FMS) that resides on the Business Partner Master Data window
And now on to the detail for each individual invoice! Let me know if you need that also
Hope this helps...
Zal
--FMS 6BP Average Lapsed Days Ver 1 ZP 2010 07 21
--DESCRIPTION: SQL shows AVERAGE days between the posting of an invoice and the
--application of the customers payment for an FMS on Business Partner.
--AUTHOR(s):
--Version 1 Zal Parchem 2010 07 21
SELECT
(SUM(DateDiff(DD, T4.DocDate, T1.DocDate))/COUNT(T4.DocNum))
FROM OCRD T0
INNER JOIN ORCT T1
ON T0.CardCode = T1.CardCode
INNER JOIN RCT2 T3
ON T3.DocNum = T1.DocNum
INNER JOIN OINV T4
ON T4.DocEntry = T3.DocENtry
AND T3.InvType = '13'
WHERE
T4.CardCode = $[$5.0.0] -
A customer average days to pay report
In 2007A I thought there was a place where you can get the average days a customer pays. Whether it was on the Dunning reports or the aging but I thought it was there....I cannot seem to find this, was it removed from 2005A?
Anyways, I am looking for a report that will show the average days a customer pays...if it is not on 2007A can someone help me with a simple query to create a report?
Thanks a million!!I had been looking for a solution to this, but instead of a report I wanted to update the Business Partner Master Data field under the Payment Terms tab called Average Delay.
I came across the following code and I posted it on my blog here:
Link: [http://www.tellme747.com/?p=312]
If you install the storproc code I have posted here you can then use a simple query or report to print the data. -
Report to show average days it takes customers to pay their invoices
I am wondering if there is a report in SAP that can help me determine the average days it takes customers to pay their invoices?
Hi,
Try this for date range
declare @from as datetime
Declare @to as datetime
Set @from = /* Select min(T5.DocDate) from OINM T5 where T5.DocDate= */ '[%0]'
Set @to = /* Select max(T6.DocDate) from OINM T6 where T6.DocDate= */ '[%1]'
Select A.CardCode, A.CardName, Avg(A.Diff) [AverageDays] from
(SELECT T2.[CardCode], T2.[DocEntry],
T2.[CardName], max(T2.DocDate)[Inv], max(T0.DocDate) [Pay],
datediff(dd, max(T2.DocDate), max(T0.DocDate)) [Diff]
FROM ORCT T0
INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocNum
inner join OINV T2 on T1.DocEntry = T2.DocEntry
where T2.DocDate between @from and @to
Group by T2.[CardCode], T2.DocEntry, T2.[CardName]) A
Group by A.CardCode, A.CardName
Regards,
Bala -
Last month I was 1 day late paying my bill, so I tried to pay the full amount. But the website would only allow me to pay the current bill amount. Now, I show a past due amount. If I tried paying it and Verizon didn't allow me, how is it past due?
I'm confused - If I go online to pay my bill, and it's one day after the due date, the current bill and full amount due would be the same? If the current bill is not the "full amount due", then what is the extra amount that's snow showing past due?
Also, when I go in to pay my bill, I show the Current bill amount, total amount due (which are the same), and then a box where I can type in the amount I am paying, with the default amount being already filled in with the total amount.
Is this a pre-paid or a post-paid (contract) account? -
ABAP report for caluculating the average days between invoice day &posting
Hi All,
i have a requirement where in i should create a report for caluculating average days between the invoice days and posting days. By counting the total day in a month for which invoice were generated and counting the days on which payements were recived,i should difference those days and take a average for a month. anybody who is having any idea either interms of code or interms of links please help me.Hello,
See this thread [Calculation Of Days|Calculation Of Days;
Thanks
Chandran -
Calculating Average Days in Crystal Reports using a Visual FoxPro driver
Post Author: sher
CA Forum: Crystal Reports
I use the following code in a crystal XI report to calculate average days between two dates using the sql server driver. It worked fine. I used the same code in a crystal XI program using a visual FoxPro driver. It does not work. Can someone help me with code needed to calculate average days using a visual foxpro driver?
cast ( Avg( DateDiff( DD, CREDENTIALING.APPLICATION_RECEIVED, ENTITYASSIGNMENTS.STATUSASOF )) As int ) AS AvgDaysFromReceipt,
cast ( Sum( DateDiff( DD,CREDENTIALING.APPLICATION_RECEIVED, ENTITYASSIGNMENTS.STATUSASOF)) As int ) AS TotDaysFromReceiptNot sure if this is any simpler but you could save this as a custom function, that way you will have to modify it once a year for the holidays.
numbervar days;
datevar date1 := minimum({?My Parameter});
datevar date2 := maximum({?My Parameter});
days := DateDiff ("d", date1, date2) -
DateDiff ("ww", date1, date2, crSaturday) -
DateDiff ("ww", date1, date2, crSunday); // this will give you the number of business days
// (excluding Saturdays and Sundays) for a given date range.
// then, for each holiday, you can enter lines like this
if date(2008,01,01) in {?My Parameter} then days := days - 1;
// The final tally of DAYS should give you the total business days in a date range.
totext(days,0);
where {?My Parameter} is the date range. -
Hi tried to get through to BT customer support but could only get through to automated service with regards to telling BT when I will pay my bill as I am needing a few more days to pay My phone line is due to stop outgoing calls from tomorrow but cant clear my bill until Wedensday 11th Feb so am really stuck as my phone / net connection massivly important for my work. Is there any contact numbers or anyone I could speak to in person to try get a 4 day further extension without having my services cut. Thanks for reading.
If you would like to try Live Chat they may be able to help you.
There are some useful help pages here, for BT Broadband customers only, on my personal website.
BT Broadband customers - help with broadband, WiFi, networking, e-mail and phones. -
Using average days between dates to predict a launch date on another produc
I hope someone might be able to help me out here.
I am at the limit of my Webi expertise! (which is not saying a lot)
We have a universe containing date information relating to the launch of products thus:
Product Name
Supplier Name
Category
Sample Availability Date
Testing Start Date
Launch Go Date
It is a simple matter to create a variable u2018Project Timeu2019 as DaysBetween(Testing Start Date;Launch Go Date)
And using the Average function we can create Average Project Length - Also with the Report, and Section keywords we can show the global average, and averages by Supplier and Category.
Here is my problem.
We also have Products in the universe that have yet to have their projects kicked off, so Testing Start Date and Launch Go Date for those products are null data. I want to use the Sample Availability Date and the Average Project Length variable to predict the probable Launch Go date, however, in the report this element shows up as an empty cell.
Does anyone have an idea how I might achieve this?
Many Thanks
MarkOK...
Lets imagine there are records for 100 devices in the universe. 75 of them have valid project start dates and launch dates. 25 of them have neither because those projects are yet to start. However they do have a sample availability date.
Using the DaysBetween function I can create a variable called project length from the start and launch dates. I can then use the Average function to get the average project length (for the devices that actually have a project length)
Somehow I want to add this average project length to the sample availability date on the records that have yet to have a start date.
As projects end they will add to the average, and we can see how close they were to the predicted launch. As new records are added they will automatically have a predicted date.
Right now I have the average project length, If I create a table filtering on completed projects (Projects with a non-null launch date) and I add a column showing average project length, because I've used the In Report keyword on the average, it shows the average value in this table.
If I have a stand-alone cell with the average project length it shows the right value
But if I have a table showing the devices yet to start (filtering on Null start date) If I add the average project length into that table it shows as blank (I.e. no value at all)
Hope this helps -
How many restarts in an average day?
I am interested to know how often BT Broadband users find they need to restart the BT Home Hub, say each day?
I find that generally in a weekend, for example, I will need to restart the BT Home Hub at least three, sometimes five times, because broadband connection is apparently lost.
I usually connect to a couple of Mac OSX systems in the house but this loss of connection is at the BT Home Hub - although the blue indicators remain on.
ThanksI also have been having these problems. I have been keeping a tally of the number of restarts as it has got so bad in the last couple of days. I have reset 15 time today, which is quite frankly, ridiculous. I have followed the steps above and have changed the channel of the router so hopefully it will be ok, but I was wondering if the problem could be down to the number of wireless devices we have connected to the hub? We have 3 macs, 1 pc, 4 iphones, a xbox 360 and two 2 sky boxes. Obviously most of these aren't active all the time and so shouldn't be a problem. In fact before we upgraded from the homehub 1.0 to the 2.0 we had no, or nearly no problems, except during peak times when our internet would dip pretty badly. We live in central london and istumbler picks up 26 different networks (including a couple of BT openzones repeats), so could this potentially be the problem?
We were considering upgrading to the airport extreme base station (as it would also act as a time machine for all our macs), could increase the reliability of our wireless?
Also I read in a different post that resetting your homehub can causes the BT servers to think that our line is 'flapping' (whatever that means) and so reduce the bandwidth that we recieve or something. Is there anyway to stop this from happening?
I have had to reset the hub while writing this post, so it seems changing the channel has not been effective, but I will try some other channels...
EDIT: make that 2 resets while writing the post... -
Hi Experts,
I need a keyfig "Avg. Pay Days" which is a formula of avg(Days w/o payment) for FI-AP report in BI, which gets data from FBL1N report in r/3.
Avg. Pay Days = avg(Days w/o payment)
Can anyone pls help me how to get the above value of count of days.
Is there any r/3 field which gets the data for Days w/o payment?
Thanks in advance.
Sai Chand.SHi Adriana,
Here is a way to automatically update the Average Delay field on the BP Master Data under the Payment Terms tab. If you install this storproc it will make it very easy to report on the Average Days to Pay since it will simply be OCRD.AvrageLate without having to do any subqueries or anything.
Here is the link: [http://www.tellme747.com/?p=312]
It doesn't filter for the 6 months or the COD scenarios but it is very simple to do.
Let me know if you need any further assistance,
Mike -
Hi all,
I have a reqmt in which, I have to report Weighted Average days of vendor payment.
<b>Selection parameters:</b>
Company code range
Vendor range
Payment date range
Payment document type.
<b>Report columns:</b>
Vendor #
Vendor name
Terms of payment
Days of Credit
Invoice Amount
Discount Taken
Paid Amount
Average Days to Pay
Weighted Amount
Weighted Days to Pay
I have got all the fields except "<b>Days of Credit</b>".
Programming logic:
Based on selection parameter the program will read cleared line items of vendors. These will be Payment documents (mostly from Check Payment run transaction F110 with Document type ZK, ZP, etc.)
The hint given in the reqmt for this field is :
Days of Credit Invoice &
Days of Credit Configuration (T. Code OBB8).
But, I am unable to get this field. I have gone through RBKP, RBVS, REGUH, RSEG tables. Kindly suggest me a table where i'll get this field.
Regards,
Neha.Hello Mahesh,
This function is used for checking documents that have already been released by a credit representative, but that have subsequently been changed. The system does NOT carry out another credit check if the following conditions are met:
o The value of the changed order is not greater than the value already approved for credit (inclusive of the deviation factor), AND
o The current date is not greater than the original release date plus the number of days specified here.
Ur doc might have failed in one the condition specified above.
I hope this helps( source : F1).
Rgds,
Raghu. -
Query for order/delivery turnaround time
Hi, all-
I want to create a query that will show me the turnaround time from the time the sales order is posted to the time the delivery is posted.
An additional twist: we often have multiple deliveries on a sales order. Would need to take all of these into account.
Is it as simple as querying the posting date and the Closed date? But how would I do this? Or do I need to somehow pull info from both the SO table and the delivery tables?
Thanks in advance,
ShelbyShelby,
This is something like calculating Average Days to Pay where you need to find the avg turn around time in case of multiple deliveries for 1 Sales Order.
How do you plan to run this Report. By entering a period range or by entering a Customer Code or by a Sales Order #
Use this query as an idea for the approach
SELECT DISTINCT T0.DocNum, SUM(DATEDIFF(DAY,T0.DocDate,T3.DocDate))/COUNT(T0.DocNum) AS [TurnAround Days],
COUNT(T0.DocNum) [Number of Deliveries]
FROM
[dbo].[ORDR] T0 INNER JOIN [dbo].[RDR1] T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN [dbo].[DLN1] T2 ON T2.BaseEntry = T0.DocEntry
INNER JOIN [dbo].[ODLN] T3 ON T3.DocEntry = T2.DocEntry
WHERE T0.DocStatus = 'C'
GROUP BY T0.DocNum
Note: This query will list all the Sales Orders that are closed and will show turnaround days to close the Order completely and the number of deliveries to close the order completely.
Suda -
How to send ALV Grid report to Email?
hai all,
How to send ALV Grid report to Email.
please its very urgent.....Hi,
when u run the Alv, u will button 'Mail Recepiant' in tool bar.When u click it and enter to new screen, go to the Recipient Tab(down) enter ur maild id and click 'Send' button on tool bar.
or.
if u want to send the Alv content to mail id thru prg, go thru the following code.
TABLES
TABLES: BSID. " Accounting: Secondary Index for Customers.
TYPE-POOLS
TYPE-POOLS: SLIS.
INTERNAL TABLES
Internal table to hold Customer data.
DATA: BEGIN OF TB_BSID OCCURS 0,
BUKRS LIKE BSID-BUKRS, " Company code
KUNNR LIKE BSID-KUNNR, " Customer number
AUGDT LIKE BSID-AUGDT, " Clearing Date
BLDAT LIKE BSID-BLDAT, " Doc date in document
SHKZG LIKE BSID-SHKZG, " Debit/credit indicator
DMBTR LIKE BSID-DMBTR, " Amount in local currency
ZFBDT LIKE BSID-ZFBDT, " Baseline date for due date calc
ZBD1T LIKE BSID-ZBD1T, " Cash discount days 1
ZBD2T LIKE BSID-ZBD2T, " Cash discount days 2
ZBD3T LIKE BSID-ZBD3T, " Net Payment Terms Period
REBZG LIKE BSID-REBZG, " No Of the Inv the Tran Belongs to
REBZT LIKE BSID-REBZT, " Follow-On Document Type
END OF TB_BSID.
Internal table to hold Open Items.
DATA: TB_BSID_OPEN LIKE TABLE OF TB_BSID WITH HEADER LINE.
Internal table to hold Cleared Items.
DATA: TB_BSAD_CLEAR LIKE TABLE OF TB_BSID WITH HEADER LINE.
Internal table to hold General Data in Customer Master
DATA: BEGIN OF TB_KNA1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR, " Customer Number
NAME1 LIKE KNA1-NAME1, " Name Line 1
TELF1 LIKE KNA1-TELF1, " Telephone Number
ADRNR LIKE KNA1-ADRNR, " Address
END OF TB_KNA1.
Internal table to hold Customer Master (Company Code)
DATA: BEGIN OF TB_KNB1 OCCURS 0,
KUNNR LIKE KNB1-KUNNR, " Customer Number
BUKRS LIKE KNB1-BUKRS, " Company code
ERDAT LIKE KNB1-ERDAT, " Rec Created Date
ZAMIB LIKE KNB1-ZAMIB, " DMS Managed Indicator
END OF TB_KNB1.
Internal table to hold Final Output Data
DATA: BEGIN OF TB_FINAL OCCURS 0,
KUNNR LIKE KNA1-KUNNR, " Customer Number
NAME1 LIKE KNA1-NAME1, " Name Line 1
ADDRESS1(25) TYPE C, " Address line 1
ADDRESS2(25) TYPE C, " Address line 2
ADDRESS3(25) TYPE C, " Address line 3
ADDRESS4(25) TYPE C, " Address line 4
PHONE LIKE KNA1-TELF1, " Telephone Number
DAYS_SLOW(3) TYPE C, " Days Slow
LAST_DATE(8) TYPE C, " Date of Last Invoice
AVG(4) TYPE C, " Average Days to Pay
CURRENT(10) TYPE N, " Current
AVG_1_30(10) TYPE N, " 1-30 past due
AVG_31_60(10) TYPE N, " 31-60 past due
AVG_61_90(10) TYPE N, " 61-90 past due
AVG_90G(10) TYPE N, " 90+ past due
END OF TB_FINAL.
ALV Internal tables
DATA : TB_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, " Field Catalog
TB_EVENTS TYPE SLIS_T_EVENT, " ALV Events
TB_COMMENTS TYPE SLIS_T_LISTHEADER. " Comment
Internal tables for the sending mail data
DATA: TB_OBJPACK TYPE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE,
TB_OBJHEAD TYPE SOLISTI1 OCCURS 1 WITH HEADER LINE,
TB_OBJTXT TYPE SOLISTI1 OCCURS 10 WITH HEADER LINE,
TB_RECLIST TYPE SOMLRECI1 OCCURS 5 WITH HEADER LINE,
TB_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
TB_DOC_CHNG TYPE SODOCCHGI1.
Internal table to get mail Receivers Address
DATA: TB_ZRECEIVE LIKE YSMTP_ADDRESS OCCURS 0 WITH HEADER LINE.
STRUCTURES
DATA: X_SADR TYPE SADR, " For Address
X_FIELDCAT TYPE SLIS_FIELDCAT_ALV, " For Field Catalog
X_LAYOUT TYPE SLIS_LAYOUT_ALV, " For Layout
X_EVENTS TYPE SLIS_ALV_EVENT, " For Events
X_COMMENTS TYPE SLIS_LISTHEADER, " For Comments
X_ADDR1_SEL LIKE ADDR1_SEL, " For Address
WA_FAEDE TYPE FAEDE. " For FAEDE struct
VARIABLES
DATA: G_REPID LIKE SY-REPID, " Prog ID
G_DAYS_SLOW(3) TYPE N, " Days Slow
G_OPEN TYPE I, " Counter
G_AVG(4) TYPE C, " Avg Days
G_COUNT TYPE I, " Counter
G_TITLE TYPE SOLISTI1-LINE, " Description
G_TAB_LINES TYPE SY-TABIX, " Internal data count
G_REC_COUNT TYPE I, " Total records
G_CURR_BAL TYPE N, " Account balance
G_FILE_NAME LIKE EDI_PATH-PTHNAM. " Output File Name
CONSTANTS
CONSTANTS: C_D TYPE C VALUE 'D', " Account type
C_X TYPE C VALUE 'X', " Check Value
C_0(4) TYPE N VALUE '0.00', " Constant for char
C_1(2) TYPE C VALUE '01', " Posting key const
C_H TYPE C VALUE 'H', " For Commenet-Type
C_TXT(3) TYPE N VALUE 'TXT', " File type
C_RAW(3) TYPE C VALUE 'RAW', " File type
C_DELIMITER TYPE X VALUE '09', " ASCII CODE LINE
C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
C_INTERFACE TYPE YWFSALOFFICNOTIF-INTERFACE_ID VALUE 'AP',
C_FILENAME(20) TYPE N VALUE 'TEXT.TXT'," File name
C_TITLE(30) TYPE N VALUE 'Z21614_DB_CREDIT_AGENCY',
C_Z001 TYPE RF035-RASID VALUE 'Z001'." Net 30/60/90/120/150
SELECTION SCREEN.
Selection Screen for Selection Criteria.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
SELECT-OPTIONS: S_BUKRS FOR BSID-BUKRS OBLIGATORY, " Company Code
S_BLDAT FOR BSID-BLDAT," OBLIGATORY, " Doc Date
S_KUNNR FOR BSID-KUNNR, " Cust No
S_ZUONR FOR BSID-ZUONR. " Assignment
PARAMETERS: P_GRACE(2) TYPE N OBLIGATORY, " Grace Days
P_ZAMIB LIKE KNB1-ZAMIB AS CHECKBOX. " DMS Indicator
SELECTION-SCREEN END OF BLOCK B1.
Selection Screen for Output Options.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-T02.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 01.
PARAMETERS: P_REPORT RADIOBUTTON GROUP R1. " Report Only
SELECTION-SCREEN COMMENT 5(25) TEXT-016.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 01.
PARAMETERS: P_DOWN RADIOBUTTON GROUP R1. " Dwnld to Unix
SELECTION-SCREEN COMMENT 5(25) TEXT-017.
SELECTION-SCREEN POSITION 30.
PARAMETERS: P_FILE LIKE FILENAME-FILEINTERN DEFAULT
'Z21614_DB_CREDIT_AGENCY'. " File Name
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
Selection Screen for E-mail.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-T03.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 01.
PARAMETERS: P_EMAIL AS CHECKBOX. " E-mail
SELECTION-SCREEN COMMENT 5(25) TEXT-018.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B3.
INITIALIZATION
INITIALIZATION.
G_REPID = SY-REPID.
AT SELECTION SCREEN. *
AT SELECTION-SCREEN.
Validation of selection screen entries
perform validate_data.
START-OF-SELECTION
START-OF-SELECTION.
Select Data from Customer Master (Company Code)
PERFORM SELECT_KNB1.
Select Custmer Open Items.
PERFORM SELECT_CUSTOMER_OPEN_ITEMS.
Select Custmer Cleared Items.
PERFORM SELECT_CUSTOMER_CLEARED_ITEMS.
Select General Data in Customer Master
PERFORM SELECT_KNA1.
Populate Final Output Data.
PERFORM POPULATE_TB_FINAL.
End of selection *
END-OF-SELECTION.
If both display report and send email is checked
IF P_REPORT = C_X AND P_EMAIL = C_X.
MESSAGE E999 WITH
'Select One Among Report Only & Send E-mail'(023).
When Radiobutton for Email or if the program is run background
ELSEIF ( P_EMAIL = C_X OR SY-BATCH = C_X ).
To send the mail
PERFORM SEND_EMAIL.
ELSEIF P_REPORT = C_X .
To display the Final Output data using ALV's
PERFORM DISPLAY_ALV_REPORT.
ENDIF.
Transfering data to file when downloading to Unix
IF P_DOWN = C_X.
IF G_REC_COUNT IS INITIAL.
MESSAGE I999 WITH
'No Records Found For Selection Criteria'(024).
EXIT.
ELSE.
IF NOT G_FILE_NAME IS INITIAL.
Trasefering data to file
PERFORM TRANSFER_DATA_FILE.
Interface Audit report
PERFORM WRITE_REPORT.
ENDIF.
ENDIF.
ENDIF.
F O R M S
*& Form VALIDATE_DATA
Validating selection-screen entries
FORM VALIDATE_DATA.
Local variables
DATA : L_BUKRS LIKE BSEG-BUKRS, " For Company Code
L_KUNNR LIKE BSEG-KUNNR. " For Customer Number
Validate the Company code.
SELECT SINGLE BUKRS
INTO L_BUKRS
FROM T001
WHERE BUKRS IN S_BUKRS.
IF SY-SUBRC <> 0.
MESSAGE E999 WITH 'Enter valid Company Code'(025).
ENDIF.
Validate the Customer number
IF NOT S_KUNNR[] IS INITIAL.
SELECT SINGLE KUNNR
INTO L_KUNNR
FROM KNA1
WHERE KUNNR IN S_KUNNR.
IF SY-SUBRC <> 0.
MESSAGE E999 WITH 'Enter valid Customer Number'(026).
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_DATA
*& Form SELECT_KNB1
Select Data from Customer Master (Company Code)
FORM SELECT_KNB1 .
CLEAR: TB_KNB1,
TB_KNB1[].
SELECT KUNNR
BUKRS
ERDAT
ZAMIB
FROM KNB1
INTO TABLE TB_KNB1
WHERE BUKRS IN S_BUKRS
AND KUNNR IN S_KUNNR.
IF SY-SUBRC = 0.
Sort TB_KNB1 by Customer no & Rec Created Date
SORT TB_KNB1 BY KUNNR ERDAT DESCENDING.
ENDIF.
ENDFORM. " SELECT_KNB1
*& Form SELECT_CUSTOMER_OPEN_ITEMS
Select Custmer Open Items.
FORM SELECT_CUSTOMER_OPEN_ITEMS .
CLEAR: TB_BSID,
TB_BSID[].
SELECT A~BUKRS
B~KUNNR
B~AUGDT
B~BLDAT
B~SHKZG
B~DMBTR
B~ZFBDT
B~ZBD1T
B~ZBD2T
B~ZBD3T
B~REBZG
B~REBZT
INTO TABLE TB_BSID
FROM BKPF AS A JOIN BSID AS B
ON ABUKRS = BBUKRS
AND ABELNR = BBELNR
AND AGJAHR = BGJAHR
WHERE A~BUKRS IN S_BUKRS
AND A~BLDAT IN S_BLDAT
AND B~KUNNR IN S_KUNNR
AND B~ZUONR IN S_ZUONR
AND B~BSCHL = C_1.
IF SY-SUBRC = 0.
DMS Managed Indicator = X.
IF P_ZAMIB = C_X.
LOOP AT TB_KNB1 WHERE ZAMIB = SPACE.
DELETE TB_BSID WHERE BUKRS = TB_KNB1-BUKRS
AND KUNNR = TB_KNB1-KUNNR.
ENDLOOP.
ENDIF.
Transfering Open Items from TB_BSID to TB_BSID_OPEN
TB_BSID_OPEN[] = TB_BSID[].
ENDIF.
ENDFORM. " SELECT_CUSTOMER_OPEN_ITEMS
*& Form SELECT_CUSTOMER_CLEARED_ITEMS
Select Custmer Cleared Items.
FORM SELECT_CUSTOMER_CLEARED_ITEMS .
CLEAR: TB_BSAD_CLEAR,
TB_BSAD_CLEAR[].
SELECT A~BUKRS
B~KUNNR
B~AUGDT
B~BLDAT
B~SHKZG
B~DMBTR
B~ZFBDT
B~ZBD1T
B~ZBD2T
B~ZBD3T
B~REBZG
B~REBZT
INTO TABLE TB_BSAD_CLEAR
FROM BKPF AS A JOIN BSAD AS B
ON ABUKRS = BBUKRS
AND ABELNR = BBELNR
AND AGJAHR = BGJAHR
WHERE A~BUKRS IN S_BUKRS
AND A~BLDAT IN S_BLDAT
AND B~KUNNR IN S_KUNNR
AND B~ZUONR IN S_ZUONR
AND B~BSCHL = C_1.
IF SY-SUBRC = 0.
DMS Managed Indicator = X.
IF P_ZAMIB = C_X.
LOOP AT TB_KNB1 WHERE ZAMIB = SPACE.
DELETE TB_BSID WHERE BUKRS = TB_KNB1-BUKRS
AND KUNNR = TB_KNB1-KUNNR.
ENDLOOP.
ENDIF.
Sort TB_BSID_CLEAR by Customer number
SORT TB_BSAD_CLEAR BY KUNNR.
ENDIF.
Append lines of TB_BSID_CLEAR to table TB_BSID
APPEND LINES OF TB_BSAD_CLEAR TO TB_BSID.
Sort TB_BSID by Cust num AND Doc date in document
SORT TB_BSID BY KUNNR BLDAT.
ENDFORM. " SELECT_CUSTOMER_CLEARED_ITEMS
*& Form SELECT_KNA1
Select General Data in Customer Master
FORM SELECT_KNA1.
CLEAR: TB_KNA1,
TB_KNA1[].
SELECT KUNNR
NAME1
TELF1
ADRNR
INTO TABLE TB_KNA1
FROM KNA1
WHERE KUNNR IN S_KUNNR.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " SELECT_KNA1
*& Form POPULATE_TB_FINAL
Populate Final Output Data.
FORM POPULATE_TB_FINAL.
Local variable
DATA: L_DAYS_SLOW(3) TYPE N. " Days Slow
CLEAR: TB_FINAL,
TB_FINAL[].
LOOP AT TB_KNA1.
Move-corresponding TB_KNA1 to TB_FINAL.
TB_FINAL-KUNNR = TB_KNA1-KUNNR. " Customer Number
TB_FINAL-NAME1 = TB_KNA1-NAME1. " Name Line 1
TB_FINAL-PHONE = TB_KNA1-TELF1. " Telephone Number
To get Customer Address.
PERFORM GET_CUSTOMER_ADDRESS.
To get Date of Last Invoice.
READ TABLE TB_BSID WITH KEY KUNNR = TB_KNA1-KUNNR.
IF SY-SUBRC = 0.
TB_FINAL-LAST_DATE = TB_BSID-BLDAT.
ENDIF.
To get past due and current details.
PERFORM GET_PAST_DUE_CURRENT.
To get Days Slow.
CLEAR WA_FAEDE .
LOOP AT TB_BSID_OPEN WHERE KUNNR = TB_KNA1-KUNNR.
WA_FAEDE-SHKZG = TB_BSID-SHKZG.
WA_FAEDE-ZFBDT = TB_BSID-ZFBDT.
WA_FAEDE-ZBD1T = TB_BSID-ZBD1T.
WA_FAEDE-ZBD2T = TB_BSID-ZBD2T.
WA_FAEDE-ZBD3T = TB_BSID-ZBD3T.
WA_FAEDE-REBZG = TB_BSID-REBZG.
WA_FAEDE-REBZT = TB_BSID-REBZT.
WA_FAEDE-KOART = C_D.
To Determine Due Date.
CALL FUNCTION 'DETERMINE_DUE_DATE'
EXPORTING
I_FAEDE = WA_FAEDE
IMPORTING
E_FAEDE = WA_FAEDE
EXCEPTIONS
ACCOUNT_TYPE_NOT_SUPPORTED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
CLEAR WA_FAEDE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: L_DAYS_SLOW.
L_DAYS_SLOW = SY-DATUM - WA_FAEDE-NETDT - P_GRACE.
G_DAYS_SLOW = G_DAYS_SLOW + ABS( L_DAYS_SLOW ).
G_OPEN = G_OPEN + 1.
ENDLOOP.
IF G_OPEN IS INITIAL.
TB_FINAL-DAYS_SLOW = G_DAYS_SLOW / G_OPEN. " Days Slow
ENDIF.
To get Average days to Pay.
PERFORM GET_AVG_DAYS_PAY.
Calculating total records .
G_REC_COUNT = G_REC_COUNT + 1.
APPEND TB_FINAL.
CLEAR TB_FINAL.
ENDLOOP.
Current account balance.
G_CURR_BAL = TB_FINAL-CURRENT + TB_FINAL-AVG_1_30 +
TB_FINAL-AVG_31_60 +
TB_FINAL-AVG_61_90 +
TB_FINAL-AVG_90G .
ENDFORM. " POPULATE_TB_FINAL
*& Form GET_PAST_DUE_CURRENT
To get past due and current details.
FORM GET_PAST_DUE_CURRENT.
Local Varaibles.
DATA: L_RF035_SFAE1 TYPE RF035-SFAE1,
L_RF035_SFAE2 TYPE RF035-SFAE2,
L_RF035_SFAE3 TYPE RF035-SFAE3,
L_RF035_SFAE4 TYPE RF035-SFAE4,
L_RF035_SFAE5 TYPE RF035-SFAE5,
L_RF035_SFAE6 TYPE RF035-SFAE6,
L_RF035_SFAEL TYPE RF035-SFAEL,
L_RF035_SNFA1 TYPE RF035-SNFA1,
L_RF035_SNFA2 TYPE RF035-SNFA2,
L_RF035_SNFA3 TYPE RF035-SNFA3,
L_RF035_SNFA4 TYPE RF035-SNFA4,
L_RF035_SNFA5 TYPE RF035-SNFA5,
L_RF035_SNFA6 TYPE RF035-SNFA6,
L_RF035_SNFAE TYPE RF035-SNFAE.
LOOP AT TB_KNB1 WHERE KUNNR = TB_KNA1-KUNNR.
CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'
EXPORTING
BUKRS = TB_KNB1-BUKRS
KKBER = ' '
KUNNR = TB_KNB1-KUNNR
RASID = C_Z001
IMPORTING
SFAE1 = L_RF035_SFAE1
SFAE2 = L_RF035_SFAE2
SFAE3 = L_RF035_SFAE3
SFAE4 = L_RF035_SFAE4
SFAE5 = L_RF035_SFAE5
SFAE6 = L_RF035_SFAE6
SFAEL = L_RF035_SFAEL
SNFA1 = L_RF035_SNFA1
SNFA2 = L_RF035_SNFA2
SNFA3 = L_RF035_SNFA3
SNFA4 = L_RF035_SNFA4
SNFA5 = L_RF035_SNFA5
SNFA6 = L_RF035_SNFA6
SNFAE = L_RF035_SNFAE
EXCEPTIONS
INVALID_RASTER = 1
NO_OPEN_ITEMS = 2
OTHERS = 3
IF SY-SUBRC = 0.
TB_FINAL-AVG_1_30 = TB_FINAL-AVG_1_30 + L_RF035_SFAE1.
TB_FINAL-AVG_31_60 = TB_FINAL-AVG_31_60 + L_RF035_SFAE2.
TB_FINAL-AVG_61_90 = TB_FINAL-AVG_61_90 + L_RF035_SFAE3.
TB_FINAL-AVG_90G = TB_FINAL-AVG_90G + L_RF035_SFAE4
+ L_RF035_SFAE5
+ L_RF035_SFAE6.
TB_FINAL-CURRENT = TB_FINAL-CURRENT + L_RF035_SNFAE.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDFORM. " GET_PAST_DUE_CURRENT
*& Form GET_CUSTOMER_ADDRESS
To get Customer Address.
FORM GET_CUSTOMER_ADDRESS.
X_ADDR1_SEL-ADDRNUMBER = TB_KNA1-ADRNR.
CALL FUNCTION 'ADDR_GET'
EXPORTING
ADDRESS_SELECTION = X_ADDR1_SEL
IMPORTING
SADR = X_SADR
EXCEPTIONS
PARAMETER_ERROR = 1
ADDRESS_NOT_EXIST = 2
VERSION_NOT_EXIST = 3
INTERNAL_ERROR = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ADDRESS LINE 1.
TB_FINAL-ADDRESS1 = X_SADR-STRAS.
ADDRESS LINE 2.
CONCATENATE X_SADR-PFACH 'CODE' X_SADR-PSTL2 INTO TB_FINAL-ADDRESS2
SEPARATED BY SPACE.
ADDRESS LINE 3.
CONCATENATE X_SADR-ORT01 X_SADR-ORT02 ',' X_SADR-REGIO X_SADR-PSTLZ
INTO TB_FINAL-ADDRESS3 SEPARATED BY SPACE.
ADDRESS LINE 4.
TB_FINAL-ADDRESS4 = X_SADR-LAND1.
ENDFORM. " GET_CUSTOMER_ADDRESS
*& Form GET_AVG_DAYS_PAY
To get Average days to Pay.
FORM GET_AVG_DAYS_PAY.
*Local variable
DATA: L_DAYS TYPE N . " Number of Days
LOOP AT TB_BSAD_CLEAR WHERE KUNNR = TB_KNA1-KUNNR.
L_DAYS = TB_BSAD_CLEAR-AUGDT - TB_BSAD_CLEAR-BLDAT.
G_AVG = G_AVG + L_DAYS.
G_COUNT = G_COUNT + 1.
ENDLOOP.
IF NOT G_COUNT IS INITIAL.
TB_FINAL-AVG = G_AVG / G_COUNT. " Average days to Pay.
ENDIF.
ENDFORM. " GET_AVG_DAYS_PAY
*& Form DISPLAY_ALV_REPORT
text
FORM DISPLAY_ALV_REPORT.
For Populating Field Catalog.
PERFORM RPT_BUILD_FIELDCATLOG.
For Modifying Field Catalog.
PERFORM RPT_MODIFY_FIELDCATLOG.
For TOP_OF_PAGE Event.
PERFORM RPT_GET_EVENTS.
For Displaying Output in Grid Format.
PERFORM RPT_GRID_DISPLAY.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form RPT_BUILD_FIELDCATLOG
text
FORM RPT_BUILD_FIELDCATLOG.
To build the Field Catlog.
DATA : L_TABNAME TYPE SLIS_TABNAME. " Table Name
L_TABNAME = 'TB_FINAL'.
REFRESH : TB_FIELDCAT.
CLEAR : TB_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = G_REPID
I_INTERNAL_TABNAME = L_TABNAME
I_INCLNAME = G_REPID
CHANGING
CT_FIELDCAT = TB_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " RPT_BUILD_FIELDCATLOG
*& Form RPT_MODIFY_FIELDCATLOG
text
FORM RPT_MODIFY_FIELDCATLOG.
Getting the Header Text for the Coloumns
DATA : L_TABIX LIKE SY-TABIX, " Index
L_DDICTXT TYPE C VALUE 'L'. " Flag
Getting the Header Text for the Coloumns
LOOP AT TB_FIELDCAT INTO X_FIELDCAT.
CLEAR L_TABIX.
L_TABIX = SY-TABIX.
CASE X_FIELDCAT-FIELDNAME.
WHEN 'KUNNR'. " Customer Number
X_FIELDCAT-SELTEXT_L = 'Customer Number'(001).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'NAME1'. " Name Line 1
X_FIELDCAT-SELTEXT_L = 'Name'(002).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS1'. " Address line 1
X_FIELDCAT-SELTEXT_L = 'Address 1'(003).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS2'. " Address line 2
X_FIELDCAT-SELTEXT_L = 'Address 2'(004).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS3'. " Address line 3
X_FIELDCAT-SELTEXT_L = 'Address 3'(005).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS4'. " Address line 4
X_FIELDCAT-SELTEXT_L = 'Address 4'(006).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'PHONE'. " Telephone Number
X_FIELDCAT-SELTEXT_L = 'Telephone Number'(007).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'DAYS_SLOW'. " Days Slow
X_FIELDCAT-SELTEXT_L = 'Days Slow'(008).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'LAST_DATE'. " Date of Last Invoice
X_FIELDCAT-SELTEXT_L = 'Date of Last Invoice'(009).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG'. " Average Days to Pay
X_FIELDCAT-SELTEXT_L = 'Average Days to Pay'(010).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'CURRENT'. " Current
X_FIELDCAT-SELTEXT_L = 'Aging Category 1'(011).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_1_30'. " 1-30 past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 2'(012).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_31_60'. " 31-60 past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 3'(013).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_61_90'. " 61-90 past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 4'(014).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_90G'. " 90+ past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 5'(015).
X_FIELDCAT-DDICTXT = L_DDICTXT.
ENDCASE.
MODIFY TB_FIELDCAT FROM X_FIELDCAT INDEX L_TABIX.
ENDLOOP.
ENDFORM. " RPT_MODIFY_FIELDCATLOG
*& Form RPT_GET_EVENTS
text
FORM RPT_GET_EVENTS.
DATA : L_TABIX TYPE SY-TABIX. " Index
CLEAR : TB_EVENTS,
TB_EVENTS[].
To get the events from this function module
for ALV display
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = TB_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE I999 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Modifing Top of Page event
READ TABLE TB_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO X_EVENTS.
IF SY-SUBRC = 0.
CLEAR L_TABIX.
L_TABIX = SY-TABIX.
X_EVENTS-FORM = C_TOP_OF_PAGE.
MODIFY TB_EVENTS FROM X_EVENTS INDEX L_TABIX.
CLEAR X_EVENTS.
ENDIF.
ENDFORM. " RPT_GET_EVENTS
*& Form TOP_OF_PAGE
Top Of Page for the ALV format
FORM TOP_OF_PAGE.
REFRESH TB_COMMENTS.
For heading
CLEAR X_COMMENTS.
X_COMMENTS-TYP = C_H.
X_COMMENTS-INFO = 'D&B Credit Agency Interface'(019).
APPEND X_COMMENTS TO TB_COMMENTS.
This module outputs formatted simple header information at TOP-OF-PAGE
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = TB_COMMENTS.
ENDFORM. " TOP_OF_PAGE
*& Form RPT_GRID_DISPLAY
text
FORM RPT_GRID_DISPLAY.
Layout Settings
CLEAR X_LAYOUT.
X_LAYOUT-ZEBRA = 'X'.
X_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
X_LAYOUT-NO_COLHEAD = SPACE.
To Display the Output in ALV Format
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
IS_LAYOUT = X_LAYOUT
IT_FIELDCAT = TB_FIELDCAT
IT_EVENTS = TB_EVENTS
TABLES
T_OUTTAB = TB_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
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. " RPT_GRID_DISPLAY
*& Form SEND_EMAIL
text
--> p1 text
<-- p2 text
FORM SEND_EMAIL.
Prepare the mail
PERFORM SEND_MAIL USING C_INTERFACE.
Sending the mail to Receivers
PERFORM SENDING_MAIL.
ENDFORM. " SEND_EMAIL
*& Form SEND_MAIL
Sending the Mail
FORM SEND_MAIL USING P_C_INTERFACE TYPE YWFSALOFFICNOTIF-INTERFACE_ID.
Populating Report name
G_TITLE = C_TITLE.
PERFORM POPULATE_EMAIL_REF_DATA USING G_TITLE.
IF NOT G_REC_COUNT IS INITIAL.
To populate the data to table tb_objbin
PERFORM POPULATE_DATA_OBJBIN.
To get the attached file for the mail
CLEAR G_TAB_LINES.
DESCRIBE TABLE TB_OBJBIN LINES G_TAB_LINES.
TB_OBJHEAD = C_FILENAME.
APPEND TB_OBJHEAD.
CLEAR TB_OBJHEAD.
Creation of the entry for the mail
TB_OBJPACK-TRANSF_BIN = C_X.
TB_OBJPACK-HEAD_START = C_1.
TB_OBJPACK-HEAD_NUM = C_1.
TB_OBJPACK-BODY_START = C_1.
TB_OBJPACK-BODY_NUM = G_TAB_LINES.
TB_OBJPACK-DOC_TYPE = C_TXT.
TB_OBJPACK-OBJ_NAME = G_REPID.
TB_OBJPACK-OBJ_DESCR = 'Interface Audit Report'(020).
TB_OBJPACK-DOC_SIZE = G_TAB_LINES * 255.
APPEND TB_OBJPACK.
ENDIF.
ENDFORM. " SEND_MAIL
*& Form SENDING_MAIL
FORM SENDING_MAIL.
Function Module to send mail along with attached file
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = TB_DOC_CHNG
TABLES
PACKING_LIST = TB_OBJPACK
OBJECT_HEADER = TB_OBJHEAD
CONTENTS_BIN = TB_OBJBIN
CONTENTS_TXT = TB_OBJTXT
RECEIVERS = TB_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
CASE SY-SUBRC.
WHEN 0.
MESSAGE S999 WITH 'Mail has been sucessfully sent'(029).
WHEN 1.
MESSAGE S999 WITH 'Too Many Parameters'(030).
WHEN 2.
MESSAGE S999 WITH 'Doc Could Not Be Sent'(031).
WHEN 4.
MESSAGE S999 WITH 'No Authority To Send'(032).
WHEN 99.
MESSAGE S999 WITH 'Error While Sending'(033).
ENDCASE.
ENDFORM. " SENDING_MAIL
*& Form POPULATE_EMAIL_REF_DATA
Poplulating the body of the mail
FORM POPULATE_EMAIL_REF_DATA USING TEXT TYPE SOLISTI1-LINE.
Setting up Mail Subject
TB_DOC_CHNG-OBJ_DESCR = 'Interface Audit Report'(020).
Populating body of the mail
TB_OBJTXT-LINE = 'Interface Audit Report'(020).
APPEND TB_OBJTXT.
CLEAR: TB_OBJTXT.
DESCRIBE TABLE TB_OBJTXT LINES G_TAB_LINES.
READ TABLE TB_OBJTXT INDEX G_TAB_LINES.
*To determine the document size
TB_DOC_CHNG-DOC_SIZE = ( G_TAB_LINES - 1 ) * 255 + STRLEN( TB_OBJTXT ).
Creation of the entry for the Mail Contents
CLEAR TB_OBJPACK-TRANSF_BIN.
TB_OBJPACK-HEAD_START = C_1.
TB_OBJPACK-HEAD_NUM = C_0.
TB_OBJPACK-BODY_START = C_1.
TB_OBJPACK-BODY_NUM = G_TAB_LINES.
TB_OBJPACK-DOC_TYPE = C_RAW.
APPEND TB_OBJPACK.
ENDFORM. " POPULATE_EMAIL_REF_DATA
*& Form POPULATE_DATA_OBJBIN
Populating table for file attachment -
Customer Payment History Caluclation of Arrears BackLog in Days
Hi All,
Cn anybody explain me how does the system calculate the
Average BackLog in Days & Arrears in Forecast Days in Customer Payment History
T-Code S_ALR_87012177
Any material will also help.
Regards
SunilProgram RFDOPR20 enables you to carry out a detailed analysis of the payment history of customers. It also contains a forecast of payment volumes and payment arrears, based on the existing payment history.
Requirements
Information on the payment history of a customer is only stored in the system if you select the field Rec.pmnt.hist. in the company code-dependent area of the customer master record.
Output
The following information on the payment history is displayed:
Customer type
Using as a parameter the payment volume in the periods under consideration, the system determines whether the customer in question is generally a net payer or a cash discount payer.
The type of customer is determined as follows:
If the customer usually utilizes the full payment period without claiming a cash discount deduction, he is a net payer.
If the customer usually pays in time to claim a cash discount deduction, he is a cash discount payer.
Arrears in days
The average days in arrears are determined as follows: Every incoming payment in the periods concerned is multiplied by its days in arrears. These amounts are added together and then divided by the total amount from all the incoming payments. This process ensures that the days in arrears are weighted by the payment amount.
Forecast for arrears in the next period
This forecast is based on the customer type that the system determined and attempts to make a forecast for the arrears in the subsequent period based on the payment volume data and the total resulting from the above mentioned calculation involving the payment and days in arrears. In this case, only data from the chosen periods is used.
To make this forecast, the system carries out separate forecasts for the payment volume and the total described above, and then determines the number of days in arrears by division.
Linear, logarithmic, exponential and potential models are used for the forecast, the optimal model being chosen in each case.
By choosing the menu option "Forecast" you can display more information, such as:
Payment volume in the periods under consideration
Trend for days in arrears (gradient of the curve for the days in arrears, based on the forecast value for the subsequent period)
Specifications on how the forecast was created (including a forecast for the payment volume in the subsequent period)
For the information described above, the entries for "Number of periods" and "With current period" are important. The "number of periods" determines how many periods are to be taken into account in the calculations (these are always the most recent periods). The current period, which is only taken into account if the checkbox "With current period" is marked, is an exception. If the current period is included, it distorts the forecast, if it contains postings which are not complete.
Further information offered by the program includes:
Volume of open items
Breakdown of number of payments, payment volume and arrears by period, where the last values are both subdivided into payments with cash discount or net payments. In these cases, the days in arrears are determined by weighting the amounts by the volume of the payment in question. You can display the results as a bar chart by selecting the menu option "Graphic".
Maybe you are looking for
-
ICal not syncing from MacAir to iPhone 3GS
Urgent help needed! My extensive calendar I have on my MacAir (late 2010) running Snow Leopard (10.6.8) is no longer pushing all of my hundred appointments to my iPhone 3GS (running iOS5) calendar. A lot of similar issues posted, but I cannot find o
-
Query Prediction takes long time - After upgrade DB 9i to 10g
Hi all, Thanks for all your help. we've got an issue in Discoverer, we are using Discoverer10g (10.1.2.2) with APPS and recently we upgraded Oracle DatBase from 9i to 10g. After Database upgrade, when we try to run reports in Discoverer plus taking l
-
Hi, I've always encountered this problem with digital editions: Adobe Digital Editions 2.0 has encountered a problem and needs to close. We are sorry for the inconvenience. I'm using Windows XP pro 2002, service pack2 on an old computer AMD Duron 9
-
Hi, I am not getting the reference of Purchase Order Number while making an outgoing Payment against an INVoice Document number . in case of Advance Payment - For payment document against Purchase order is fetching but incase of Invoice verification
-
HELLO, I have blackberry curve 8520. i have got error in my phone. the error is "Uncaught exception: DSSMA: invalid state(5): 25. I am unable to open my Inbox messages and unable to view phone's call history. the phone shows the same message again an