on 06-05-2009 9:14 PM
Hello ALL,
I am new to ABAP programming.
I have requirement where I need to calculate the field ZATTN based on the sales quantity and Invoice date.
The formula required for ZATTN is as follows
ZATTN = (sales qty * no.of days in Invoice Month) / Invoice date (DD)
For example -
Sales Qty = 100 and Invoice date = 2009.06.05
ZATTN = (100* 30) / 5
Here
value 30 is based on the month from Invoice date (2009.06.05), for month 06, no of days = 30.
value 5 is based on the day from Invoice date(2009.06.05), for day DD = 05
Please provide logic for the above.
thanks,
Pra
To get the number of days in the month, use the Function Module /OSP/GET_DAYS_IN_MONTH. The input for this is the invoice date and the output from it will provide you with the number of calendar days in that month. To get the day number for the month, you could just do a substring on the date field into a variable - something like l_dd = invoice_date+6(2).
DATA: l_days_in_month TYPE /OSP/DT_DAY,
l_dd(2) TYPE n.
CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'
EXPORTING
iv_date = invoice_date
IMPORTING
EV_DAYS = l_days_in_month
.
l_dd = invoice_date+6(2).
ZATTN = ( invoice_qty * l_days_in_month ) / l_dd.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.