Function module for sundays in a month
hai all,
i need a function module for calculating noof sundays in a month
Hi Satya,
Please check this code which is checked for syntax also. Just copy and paste the same in abap editor and check the output.
Calculation of number of sundays ****
DAta : month1(2) type c,
week1 type i,
date1 type sy-datum,
val1 type sy-datum,
day1 type SCAL-INDICATOR,
no_sundays type i.
week1 = 5.
date1 = '20060502'.
*- Function Module to fetch the Last day of the Month
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = date1
IMPORTING
LAST_DAY_OF_MONTH = VAL1.
*- Function Module to get the day of the week
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
DATE = VAL1
IMPORTING
DAY = DAY1.
*- Calculation of number of sundays
month1 = val1+6(2).
write : / month1.
if month1 = 31.
if DAY1 <= 2 or DAY1 = 7.
no_sundays = week1.
else.
no_sundays = week1 - 1.
endif.
elseif month1 = 30.
if DAY1 = 1 or DAY1 = 7.
no_sundays = week1.
else.
no_sundays = week1 - 1.
endif.
elseif month1 = 29.
if DAY1 = 7.
no_sundays = week1.
else.
no_sundays = week1 - 1.
endif.
elseif month1 = 28.
no_sundays = 4.
endif.
write : / no_sundays.
If found helpful, please do reward.
Similar Messages
-
Function module for adding number of months to the date
Hi,
Is there any function module to get the date by adding number of months...
Regards,
YadagiriNormally all SAP FM will return that value. As 1 month in general means 30 days only.
You can check the code in this link for logig of 31 -
add month in the date to find next date
Regards,
Amit -
Function Modules for Format Date, Month Name and Quarter value.
Hi All,
1. I am getting the date field from the Flatfile, so i need to format the date to YYYYMMDD. Is there any Function module for that in BW.
2. Based on the above Formated Date i have to find out the Name of the Month like JANUARY, FEBUARY etc.
3. Based on the same above Formated Date i need to find out the Quarter like 1, 2 etc.
Could you please let me know if any function modules are there for the above questions in BW not in ABAP, why i mention is some Function modules are there in ABAP but not in BW.
Thanks in advance.
Regards,
srinivasHi ,
1.If your input date format is MMDDYYYY then Use SDATE as conversion routine in trans strucutre to convert into YYYYMMDD.
2.By passing year as input parameter for the following FM you would get all the months with text.Using READ statement in routine you can get month name
MONTH_NAMES_GET
3.For Quarters you can use the following FM:
TSTR_PERIODS_QUARTERS
hope it helps...
regards,
Raju -
Function modules for the following
Hi,
I want to know the function modules for the following purposes.
1) Check whether a date is valid or not
2) Calculate the no of days between two dates.
Expecting an early response.
Thanks n Regards,
AmitHi,
PARAMETERS: p_list LIKE t009b-bumon AS LISTBOX
VISIBLE LENGTH 11 OBLIGATORY ,
p_list1 LIKE t009b-bdatj OBLIGATORY.
SELECTION-SCREEN POSITION POS_HIGH.
PARAMETERS: p_list2 LIKE t009b-bumon AS LISTBOX
VISIBLE LENGTH 11 OBLIGATORY,
p_list3 LIKE t009b-bdatj OBLIGATORY.
Calling Function Module for calculating no of days between the
selected period
CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'
EXPORTING
par_month = p_list
par_year = p_list1
IMPORTING
par_days = ws_n_days.
CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'
EXPORTING
par_month = p_list2
par_year = p_list3
IMPORTING
par_days = ws_n_days1.
For Concatenating the month and year into the date format
CONCATENATE p_list1 p_list ws_i INTO ws_c_date1.
CONCATENATE p_list3 p_list2 ws_n_days1 INTO ws_c_date2.
date = ws_c_date1 - ws_c_date2.
In the above sample code the selection screen has month and year as input.
Also check this link
http://www.sapdevelopment.co.uk/tips/date/datehome.htm
Check FM
<b>RP_CALC_DATE_IN_INTERVAL</b> Add/subtract years/months/days from a date
<b>SD_DATETIME_DIFFERENCE</b> Give the difference in Days and Time for 2 dates
<b>Also for checking valid date:</b>
U can specify the date field as
Select-options: s_date like likp-date(similar to ur requirement)
This itself ceck for the valid date no seperate validation needed.
Thanks & Regards,
Judith. -
Function module for Fiscal period ( monat field name)
Hi ,
please suggest the function module for (monat) Fiscal period. our reqirement is default to previous accounting period from the current month.
Thnks
SrinivasHi,
Refer to the following code:
DATA: LV_FISCAL_YEAR_VAR(2) TYPE C,
LV_PERIOD LIKE T009B-POPER.
CALL FUNCTION 'CCODE_GET_FISCAL_YEAR_VARIANT'
EXPORTING
COMPANY_CODE = S_BUKRS-LOW
IMPORTING
FISCAL_YEAR_VARIANT = LV_FISCAL_YEAR_VAR
EXCEPTIONS
COMPANY_CODE_NOT_FOUND = 1
OTHERS = 2.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE = P_BUDAT
* I_MONMIT = 00
I_PERIV = LV_FISCAL_YEAR_VAR
IMPORTING
E_BUPER = LV_PERIOD
* E_GJAHR =
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4 -
Functional module for automatic creation of pur requisition & pur order
hello,
what is the functional module for automatic creation of puchase requisition and automatic creation of purchase order which we will assign in action box in service order processing management.
please let me know as early as possible
regards,
rajesh kumar rajuHi,
Please check with following.
IDOC_INPUT_ACC_PURCHASE_REQUI
IDOC_INPUT_ACC_PURCHASE_ORDER
/ISDFPS/OR_PURCHASE_ORDER_CR
BS01_PURCHASE_DOCUMENT_CREATE
CO_MP_CREATE_PURCHASE_ORDER
Thanks & Regards
Sadhu Kishore -
Function module for calculating planned and actual cost of production order
Hi ,
Do we have any standard function module for calculating planned and actual cost for production order?
i need to implement this in a Z-report.
Thanks
SriniHi,
try below function module
CRMCO_GET_PLAN_ACTUAL_COSTS
CO_IH_GET_PLANNED_COSTS_TOTAL
Regards,
Sankaran -
How to create the INBOUND Function Module for INBOUND IDOCs
Hi Friends,
Can any Suggest me How to proceed to Create an INBOUND Function Module for Processing the INBOUND IDOCS
which are recieved from XI Server ?
I am working in SAP-ISU
Here i will recieve the INBOUND IDOCs for the Meter Reading Orders.
We have a Standard INBOUND FUNCTION MODULE
IDOC_INPUT_ISU_MR_UPLOAD
which Uploads the Meter Reading Results.
I copied the Same function Module into ZIDOC_INPUT_
and working on it.
Can any one suggest me, whether i am going in correct way or not.
In IDOC_INPUT_ISU_MR_UPLOAD Inbound fun module,
BAPI_MTRREADDOC_UPLOAD is used to Update or Insert the Meter Reading Results,
My requirment is to Insert and Update the Meter Reading Orders which are Inbounded from XI.
Can I Use the Same BAPI
BAPI_MTRREADDOC_UPLOAD
to Update the below fields,
EABL-SERNR
EABL-ZWNUMMER
EABLG-ABLESGR
EABL-V_ZWSTAND
EABL-N_ZWSTAND
EABL-ABLHINW
EABL-ZSKIPC
EABL-ADAT
EABL-ATIMTATS
EABL-ADATTATS
EABL-ATIM
EABL-ZMESSAGE
EABL-ABLESER(Meter reader number)
Kindly Suggest me,
Thanks in Advance,
GaneshHello Ganesh
I think you are going completely astray with you z-function module for IDoc processing.
If you look at TABLES parameter METERREADINGRESULTS (type BAPIEABLU ) of BAPI_MTRREADDOC_UPLOAD you will find many of the requested fields already:
EABL-SERNR => BAPIEABLU-SERIALNO
EABL-ZWNUMMER =>REGISTER
EABLG-ABLESGR
EABL-V_ZWSTAND
EABL-N_ZWSTAND
EABL-ABLHINW
EABL-ZSKIPC
EABL-ADAT
EABL-ATIMTATS => ACTUALMRTIME
EABL-ADATTATS => ACTUALMRDATE
EABL-ATIM
EABL-ZMESSAGE
EABL-ABLESER(Meter reader number)
Field EABL-ZMESSAGE appears to be custom field (at least I cannot find it on ECC 6.0). If this field was added using include CI_EABL then you probably can get these values into the BAPI using the EXTENSIONIN parameter.
Check routine CHECK_UPLOADRECORDS in the BAPI which allows two extension structures:
- BAPI_TE_EABL
- BAPI_TE_EOSB
Not surprisingly BAPI_TE_EABL contains the include CI_EABL.
Regards
Uwe -
How to config Check Digits function module for Student Number Validation
Hi SLCM Experts,
In the SAP-SLCM, How to use check digits function module for validate student number. Just only config it or need to customizing program.
*Any idea to student number validation in SLCM?*
Best Regards,
Suvatchai K.Hi ,
Can you expalin it further ?
You configure the St. no in piq_matr . And set it as external or internal no. range which suits your business .
What is the validation you are looking for ?
Regards
Gajalakshmi -
Function Module for FB01 Vendor line items postings in 3.1 Version
Hello all,
Is there any Function Module for FB01 Vendor line items postings in 3.1 Version. I do not want to go for BDC. Please suggest.
Thanks,
SubbaHi,
search for function module ACCPOSTING* or get development class of transaction FB01 and goto SE80, enter development class - and search in function group's function module.
Cheers.
...Reward if useful. -
Function Modules for uploading the file
Hi experts ,
I have a requirement to download a file (csv) from my local sytem (say desktop) into an internal table first and then update the contents of the same internal table into the database table.
Can anybody provide me with a sample program for doing the same or at least the name of function modules for the same.
Prompt replies will be rewarded.
TIA
AbhishekHi Abhishek,
How to use INSERT Statement..
Check this Sample Program..
TABLES:MARA.
DATA:ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
ITAB-MATNR = '123ABCDA'. .
ITAB-MBRSH = 'C'.
ITAB-MTART = 'FERT' .
ITAB-MEINS = 'KG' .
APPEND ITAB.
ITAB-MATNR = '123ABCDB'. .
ITAB-MBRSH = 'C'.
ITAB-MTART = 'FERT' .
ITAB-MEINS = 'KG' .
APPEND ITAB.
LOOP AT ITAB.
INSERT MARA FROM ITAB.
MODIFY MARA .
ENDLOOP. -
Function Modules for Data and Time
Hi all,
I need 2 function modules for date and time. when we pass current data(sy-datum) and current time (sy-uzeit) into function modules, shoud get date in <b>dd/mm/yyyy or dd.mm.yyyy</b> and time in<b> HH:MM:SS</b> formats.
Thanks in advanceHi Ranjith,
i think this will b usefull for you..
SAP Bar Chart Function Modules and what they are used for
Function module
Used for
BARC_GRAPHIC_PBO
Starting bar chart at PBO time, using a graphic profile (parameter PROFILE)
BARC_GRAPHIC_PAI
Analyzing data returned by the graphic
BARC_SET_TIME_AXIS
Setting start and end of time axis
BARC_SET_OPTIONS
Setting options
BARC_ADD_CHART
Creating a chart
BARC_SET_CHART_ATTRIB
Setting chart attributes
BARC_ADD_SECTION
Creating a section on the time axis
BARC_SET_SECTION_ATTRIB
Setting section attributes
BARC_ADD_RIBBON
Adding a ribbon to the time axis
BARC_SET_RIBBON_ATTRIB
Setting attributes for ribbons in the chart
BARC_ADD_GRID
Adding a time grid
BARC_SET_GRID_ATTRIB
Setting grid attributes
BARC_ADD_LAYER
Adding a layer (graphic elements)
BARC_SET_LAYER_ATTRIB
Setting layer attributes
BARC_ADD_LINE
Adding a line
BARC_ADD_CALENDAR
Creating a calendar
BARC_SET_CALENDAR_ATTRIB
Setting attributes for a calendar
BARC_ADD_TIME_PROFILE
Creating time profiles
BARC_SET_TIME_PROFILE_ATTRIB
Setting attributes for time profile
BARC_ADD_INTERVAL
Adding a time interval
BARC_SET_INTERVAL_ATTRIB
Setting time interval attributes
BARC_ADD_TIME_OBJECT
Creating a time object
BARC_CONVERT_DATE
Creating a date string in bar chart format
BARC_REVERT_DATE
Converting a date string in bar chart format to date and time
BARC_ADD_DATELINE
Creating a date line
BARC_SET_DATELINE_ATTRIB
Setting dateline attributes
BARC_GET_PROFILE_CONTENTS
Obtaining profile contents for customizing a chart
BARC_GET_COLUMN_WIDTH
Selecting new column width
BARC_SET_COLUMN_WIDTH
Setting the column width
BARC_GET_TEXTINDEX
Obtaining the text index of a field
BARC_SET_LABELS
Positioning the chart display
BARC_SET_COLUMN_ATTRIB
Setting column attributes
BARC_SET_ROW_ATTRIB
Setting row attributes
BARC_SET_ROW_HEIGHT
Setting the line height
BARC_SET_MAXCHARTS
Setting the maximum number of charts sent
<b>If its usefull reward points
</b> -
Function Module for open Purchase Order & Sales Order?
Hi, commonly I read the data from tables and calculate the open quantity for sales order and purchase order, but I want to know, are there any standard function modules for getting the list of open "purchase order" and "sales order" respectively?
Thanks and Regards.hi Ren,
u can check all these bapi's related to salesorder
BAPI_SALESORDER_CHANGE Sales order: Change Sales Order
BAPI_SALESORDER_CONFIRMDELVRY Sales Order: Confirmation of Delivery; Document Flow Update
BAPI_SALESORDER_CREATEFROMDAT1 Sales order: Create Sales Order
BAPI_SALESORDER_CREATEFROMDAT2 Sales order: Create Sales Order
BAPI_SALESORDER_CREATEFROMDATA Create Sales Order, No More Maintenance
BAPI_SALESORDER_GETLIST Sales order: List of all Orders for Customer
BAPI_SALESORDER_GETSTATUS Sales Order: Display Status
BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales Order
May be this FM can help you
MB_ADD_PURCHASE_ORDER_QUANTITY (Reading and adding open purchase order quantities)
Regards,
Naveen -
Function module for GL account open items at a key date
Is there a function module for "GL account open items at a key date" similar to following for customer and vendor accounts?
BAPI_AR_ACC_GETOPENITEMS Customer account open items at a key date
BAPI_AP_ACC_GETOPENITEMS Vendor account open items at a key date
If not, please suggest any alternatives. I am looking to capture the output of FBL3N (GL account line item display) in a program.
Thank you in advance.
Prasanna Pujarihi,
please go through the below link i think it will help u.
http://sapfunctional.com/FI/GL/Balance.
Regard
Abhishek Tripathi -
Function Module for outline agreement
Dear Sir,
I want to know the function module for contract/outline agreement from where I can fetch the details of release orders against the given contract.
Regards
Amit AgarwalHi
Go to SE37 enter the Outline agreement and press F4
you can see the function module
(or) Post the same message in SAP ABAP forum
G.Ganesh Kumar
Maybe you are looking for
-
DVD BURNED WON'T PLAY IN DVD PLAYER...HELP!
EVERY TIME i BURN MY DVD IN STUDIO PRO IT COMES UP "BAD DISK" ON THE TELEVISION SCREEN, BUT WILL PLAY ON COMPUTER DVD PLAYERS...DOES ANYBODY KNOW WHAT I'M DOING WRONG...I'M ON DEADLINE AND IN A FIX!
-
Project Systems Posting Problem
Hi All When i am trying to Post to Gl Account I am getting a error "FI: Postings" is not allowed (WBS C/1000-01)" Where C/1000-01 is my WBS. Can any one guide me on this. Regards
-
Dual monitor cloning size issue
ive always had trouble selecting a size for my macmini on my 40 inch tv, but now i want it to work as a dual screen moniter that clones onto a 4:3 square screen, basically i need it to fill the wide screen, and have some kind of black bars on the top
-
EDI 850 outbound transaction to suppliers
Need some feedback.. how does oracle 11I handle pushing out blanket releases to EDI suppliers? We are currently in the process of implementing 11I using the 830 & 862 EDI transactions. Can the 830, also be used in place of the 850 without causing cas
-
Gcc is joh, g++ is no
Hi, I'm trying to compile this: #include<stdio.h> #include<stdlib.h> #include <ctype.h> #include<string.h> #include <sauv_oracle.h> void err_report(Cda_Def *cursor) { sword n; text msg[512]; /* message buffer to hold error text */ if (cursor->fc > 0)