Date calculation check in a badi

Hi all I want to do a check calculation in a badi - on an internal table of dates. In normal abap I was able to do it easily. but in oo abap, its not allowing me to do the arethmatic calculation on date fields.Below is the code:
method IF_EX_PT_ABS_REQ~GET_WORKFLOW_ATTRIBS.
begda type pa2001-begda,
end of date1.
data: zbegda type table of date1,
zbegdah type table of date1,
line1 like line of zbegdah.
*data zbegda like pa2001-begda occurs 0 with header line.
*data zbegdah like pa2001-begda occurs 0 with header line.
select begda from pa2001 into table zbegda
where pernr = pernr1.
zbegdah[] = zbegda[].
clear zbegda[].
loop at zbegdah into line1.
add 1 to zbegdah. "<------ THIS LINE IS GIVING ME ERROR
*line1-begda = zbegdah + 1.
append line1 to zbegda.
endloop.
loop at zbegda into line1.
if line1-begda eq bdate.
MESSAGE i074(hrtim_abs_req).
endif.
endloop.
endmethod.
Actually, in my EP leave request workflow I want to give an error message, if the user applies for a leave of say 5th april, and he already has an approved leave of 6th of april - which is stored in infotype 21.
There is a badi - SE18 ->  Enhancement Spots PT_ABS_REQ. In this, I am creating implimentation and I am writing the code in the method - IF_EX_PT_ABS_REQ~GET_WORKFLOW_ATTRIBS.
I also want to know that if i declare 2 fields - PERNR1 and bdate ( begin date of leave)  in attributes, which I did, would they be passed from EP at runtime? if not, what should I do to get them in my method?
Please suggest.
Thanks
Ribhu

HI Ribhu ,
what are u trying to do  with this <b>add 1 to zbegdah. "<------ THIS LINE IS GIVING ME ERROR</b> ?---> u are getting error bcos u are trying to add one to the table work area which is wrong.
work area  is in char and u are adding NUM to CHAR.
u cant to add 1 day date  or one record to ZBEGDAH.
if u want to add one day then u have to call
loop at zbegdah.
zbegdah-begda =  zbegdah-begda + 1.
modify zbegdah.
endloop.
Regards
Peram

Similar Messages

  • Baseline Date for Due Date Calculation required for S/L indicators

    Hello,
    Iu2019m facing the following problem
    Iu2019m trying to insert an invoice (using a customer master record) but the system blocks me because the field ZFBDT (Baseline Date for Due Date Calculation) is a Required entry.
    The strange thing is  that if I use a S/L indicators the field is mandatory, if not the date may be defaulted.
    I checked in OB41 but there are non differences between Special PK and normal PK.
    Any ideas?
    Thanks in advance
    Alberto

    Dear Alberto,
    the field "Due On (BSEG-ZFBDT)" cannot be controlled with field status.
    It is controlled by field attribute of screen painter (Tcd: SE51).  If
    you look at element attribute for "Due On" field, a flag for required
    entry is activated.  In this case, field status has no control over
    the field.
    As of release 3.1G, field BSEG-ZFBDT is hardcoded in most FI screens
    to be mandatory and cannot be influenced by any field status
    changes. This situation is only valid when posting with special G/L
    indicator (ie PK 29/39).
    SAP development team has determined that this is a critical field.  The
    reason behind this is that this special GL screen and the data entered
    here are very important to many other programs. This data affects
    liabilities and receivables where due date is necessary almost
    everytime. Thus, we changed this field in this screen in order to
    prevent problems in many other areas. The reason is explained further
    in note 95079.
    I hope this helps You.
    mauri

  • How is delivery date calculated

    How can anyone please explain how delivery date is calculated using forward and backward scheduling
    I want to have it broken down into the following steps
    for eg for delivery date calculation following dates are used
    Material Availabilty Date
    Material Staging Date
    Pick/pack time
    Transportation PLanning date
    Loading date
    Goods issue date
    Transit Date
    Delivery Date
    Can some one please give me an example and explain wht these dates are
    for eg customer needs delivery date on  11/20/2008
    how would the system cacluate whether it can meet the delivery date using backward scheduling
    and if it doesnt meet how does the system do the forward scheduling
    also i am not clear with the following dates
    material avaialibilty date
    material staging date
    transportation date
    can some one please explain me all this in detail
    Also i have another question at the sales order creation when is shipping point and route determined
    coz based on the ATP check only material avaialabilty date is determined and if we have a bacjground job running every 1 hours for atp then immediately when we create a sales order is a route and shipping point determined (just before we save the sales order)
    Let me be more clear
    Suppose customer representative recevies a order on the phone
    he enters sold to party, ship to party ,PO number,delivery date and material number and then hits enter
    so at tht time the shipping point and route is determined ?
    also when an atp check runs and if the delivery date is not met then the system will propose a new delivery date but if we have a different route configured say for eg overnight so we can meet the delivery date and we want to change this route to overnight what must we do?
    should we change the shipping condition in the header?
    I am not very sure about the process can you please also explain me this in detail?
    Thanks

    Hi there,
    When a sales order is logged & the user enters the requested delivery date, system 1st does the backward scheduling date. Pla note that the factory calender mentioned in the shipping point & route plays a crutial role in defining the working days & confirmed delivery date.
    For eg:  Customer has raised an order on 11/15 & requests delivery on 11/20/2008.
    the following times are important in delivery scheduling.
    Transit time: maintained in route
    Loading time maintained in the shipping point
    Transportation planing time maintained in the transportation planning point.
    pick pack time maintained in the shipping point.
    Material availability time maintained in MM02 --> MRP screens. This is the time that the material can be manufactured (for inhouse producted items) or external processing time (for externallly procured materials like TAS items).
    From the requested delivery date 11/20 system does the backward scheduling & determines the following dates:
    Goods issue date, loading date, pick pack date, transportation planning date & material availability date.
    Time between:
    goods issue date - reqested delivery date: transit time
    Goods issue date - loading date: loading time
    transportation planning date - pick pack date: picking pack time
    Material availability date - transportation date: transportation planning time.
    Consider that the factory calender has all days of the week as working dates (to make it simple to explain). Also transit time is 3 days, loading time is 1 day,pick pack time is 1 day, material availability time is 3 days.
    From 11/20 ussing backward scheduling system determines the following dates:
    Goods issue date: 11/17
    Loading date: 11/16
    Pick pack date: 11/15
    System will check if material is available on the 11/15 to start pick / pack. If it is available then system will confirm the reqested delivery date. Else it will check when the material is available. For eg basing on the MRP settings mnaterial is available only on 11/18. So from 18th system does forward scheduling & redetermines all the dates. So pick / pack date is 11/18. Loading date is 11/19, goods issue date is 11/20 & possible delivery date is 11/23. So system will confirm the delivery date on 11/23. This is when complete delivery is required. If partial delivery is allowed, then system will check how much quantity is available on 11/15. Accordingly it will give 2 delivery dates.
    In the above example include teh factory calender which will have 5 day week with Fri & Sat as holidays. Accordingly dates will change.
    Here replenishment lead time also plays an imp role. Pls refer http://help.sap.com/erp2005_ehp_03/helpdata/EN/6b/2785347860ea35e10000009b38f83b/frameset.htm for further information
    Regards,
    Sivanand

  • How to use Dynamic date calculation in some transactions.

    Hello everyone.
    I have to create some dynamic variants using the dynamic date calculation. The problem is that in some transactions it´s not possible to use some variables that can round a value. For example: in transaction /SAPAPO/MC90, I need to fix 3 months in the horizon like this: From date: 01.01.2009  To date 31.03.2009. The current month is 01.01.2009. Next month the current month will be february, so the horizon would be 01.02.2009 to 30.04.2009.
    In 5.1 version, it´s impossible to fix the months, because the options that appear in the match code are:
    Current Date
    Current date +/- ??? days
    current date +/- ??? work days
    First day of current month
    nth working day of current month
    First day of next month
    First day of previous month
    Last day of previous month
    Last Day of the Current Month
    Does anybody knows how to do this? This is happening in other transactions to.
    Thanks a lot
    Regards
    Angela

    I am not sure where you are looking for..but here is what I can do it in MC90 Tcode:
    1. when you try to save the variant, in the variant screen check the two boxes under "Current date" field for Selection Variables attributes "L"
    2. Then click on Selection variables option and click on the "D" variable so that it turns to green
    3. Drop down in the first current date field, select "Current +/- ??? days. here if you want to start from today's date maintain 0 days
    4. In the second Current date field maintain 90 days in "Current +/- ??? days.
    5. save it
    please let me know if I misunderstod the issue

  • Passing data from check FM

    Hi,
    Wanted to know how to pass data from check FM to workflow container?
    We are not able to add parameters for event container as it is standard event.
    Can we set attribute of object ? I could not find macro for setting property.
    Expecting urgent help.
    Regards,
    Akshay

    Hi Akshay,
    Trying to pass data from check FM to workflow container is the wrong approach to use.  The purpose of a check FM is ONLY to see if the workflow should be started by the event or not.  You cannot and should not even attempt to change the event container in a check FM.
    What you need to do is to take a step back and think about your options:
    1. "Not able to add parameters ... as it is a standard event".  Well you can extend the event parameters on a standard event by creating a delegated subtype of the standard object type.  However if the event is raised by standard code this may not help you anyway.   It's worth reading the SAP Library doco on this as some types of events do pass additional information provided you define the event parameter names correctly, e.g. change document events will automatically pass the old/new value of certain fields.
    2. Is the data you are trying to pass related to:
    a) The object - then use attributes of the object instead to calculate the value
    b) The person creating the event - then use attributes of the event creator, i.e. as soon as the workflow starts, add a step to instantiate an instance of an object representing the user such as USR01 or USR01DOHR.
    c) Other standard data in the event container such as the calling program id, the date/time - any of that info can be passed to your workflow container and then used to derive further info from there.
    3. If the data you are trying to pass is only available in the standard calling application, then you need to find another way to raise the event or raise a custom event.  E.g. in a user exit or BADI.
    4. And one final option of last resort - create your own RECEIVER function module - this does allow you to fill the workflow container during the event linkage.  But I would still consider this a "last resort" option.
    Regards,
    Jocelyn
    Message was edited by: Jocelyn Dart

  • Error during date calculation: Time entered not numerical

    Hi All,
    We are using SAP MI 7.0 SP18 Server and Client
    xMAM 3.0 SR06
    Now when we create a Notification using the link  Notification Management of type PV and SAVE.
    When Synchronized, it is completed but backend no notification is trigerring and when checked in Error Logs
    the following message is shown Error during date calculation: Time entered not numerical
    Kindly Suggest
    Regards,
    Kiran Joshua

    Hi All,
    I got to know how to edit the entries from merep_mon : Thanks to Chinna.
    But unfortunately that did not solve my problem
    I had to debug the function module of the respective SyncBO and found that the Profile type was not maintained in the backend.
    Infact the error "Error during date calculation: Time entered not numerical" was misleading.
    Anyways upon customising the Profile for the PJ and PV type Notifications that solved my issue.
    Regards,
    Kiran Joshua

  • Data calculator

    I Used the data calculator and, to be safe, tripled the estimated amount of data we would need.  That total came out to about 12G/month.  Sounded good, got the home fusion and have had overages every month, well over 20 G. I see that there is a disclaimer on the date calculator that actual usage can vary greatly,- has anyone else had this same problem and how can one more accurately assess how much data is needed and even used by my household?

    I Have been checking to see how much data is being used.  The problem is that it does not even come close to what we are actually using.  How can we be using this much (more than 20Gb) when only doing 40 emails/day and browsing about 40 pages / day?  We don't do any streaming, either movies, videos or music.  That's what I can't figure out.  Where is the data going/ coming from?

  • BSOD with both Kernal Security Check Error and Bad Pool Header.

    All -
    I have a HP DV7 laptop with Windows 8.1. It has BSOD with both Kernal Security Check Error and Bad Pool Header.
    Despite doing all the built in HP tests, there is nothing. Using an Anker HardDrive Dock results in the identical errors on another machine.
    Bottom line, even if I could see the DMP files (which I cannot); because the machine fails to boot, there are no files to be copied.
    I have tried various AIO and UEFI disks and USB, and the laptop NEVER accepts the PREINSTALL environment. Being unable to use the Anker has never happened. I seem completely locked out of the drive. Any suggestions? Thx.
    Bruce A Ades

    Hi Texas_Bruiser
    Some required details are needed for us to help you.
    Ensure that the BIOS/UEFI has been configured to allow boot from DVD/CD or USB.
    When you attempted to boot into PREINSTALL environment (PE) by using disks or USB, we need more details about error message or what happened?
    If your computer cannot even boot into Windows PE by using installation media, we suggest you check if memory and other hardware are works properly on this computer. Also try to plug this hard disk on other computer as data volume, see if the hard disk works.
    Regards
    D. Wu

  • Data quality check or automation

    Apart from passing the report to the user for testing are there ways the process can be automated for a data quality check and how?
    Thanks.

    Hi Dre01,
    According to your description, you want to check the report data quality. Right?
    In Reporting Services, the only way to check the report data is viewing the report. So for your requirement, if you want to make this data processing automatically. We suggest to create subscription, it will process the data automatically based
    on the schedule and you will get the subscription of report to check if it shows data properly.
    Reference:
    Create, Modify, and Delete Standard Subscriptions (Reporting Services in Native Mode)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Schedule Line Delivery Date Calculation with Transportation Scheduling

    Hi All,
    We are currently running into a problem where our Sales Order Schedule Line delivery dates are being pushed out too far into the future - because of the Calendar being used to determine the transit time.
    We have 'Delivery Scheduling' and 'Transportation Scheduling' activated for our Sales Document type
    We have Routes that are configured with a 'Transit Time' and a 'Factory Calendar'
    Order Scenario:
    'Factory Calendar' assigned to our 'Route' is setup with only one 'Workday' in a given week e.g. Wednesday
    Our 'Route' has a Transit Time of 2 days
    We create a Sales Order on Monday for a Material that is available in our Plant
    The 'Goods Issue' date is being determined correctly for the next Workday - being Wednesday
    The 'Delivery Date' is extending out over 15 days (2 Wednesdays into the future) - since it is working on 'Calendar Days' and not 'Actual Days'
    Does anyone know of a way (config or other) to only influence the 'Goods Issue' date with the 'Factory Calendar' assigned to the Route, and have the 'Delivery Date' calculated using the Transit Time on the Route and 'Actual Days' rather than Calendar days?
    All help greatly appreciated.
    Thanks,
    Ravelle<i></i>

    Hi Pathik,
    Thanks for your reply.  I have already maintained the Calendars I'm using for this business process in <SCAL> - same as <OY05>. 
    The problem I'm having though is that by assigning a Calendar directly to my route (which I doing to influence the goods issue date - using a 1 Working Day Calendar) it is also taking precedence in determining the Transit time - which in this case I don't want, as I want my Transit time to be determined using a 5 Working Day Calendar.
    I don't think this problem has a config option as a work around...I think the only possibility in this case is a development to achieve the results we need.
    Thanks,
    Ravelle

  • Date Calculation in BEx

    Hello All,
    In my report, User wants to see a day counter which is the dfference of a date (date coming from cube) and Current date. For current date  we are using 0f_aday sap exit. How we can we acheive this, does it involve any User exits at the back end or can I use a calculated keyfigure to find the difference between these two dates.
    Please reply to this as it is very Urgent Issue
    thank you

    HI AL,
    Thanks for the udpate. But I believe we can update any thread if its related with the same subject if its less than 3 years. Is it not right ? I have a mail in my inbox, from some moderator confirming the same. That is the reason I have updated this thread...as its related to the same question and this thread is created n 2011.
    Anyway, thanks for the answer. I will change the dimension to date and calculate the difference from the 2 variables.
    Reg another doubt, from the below link...
    https://docs.google.com/viewer?a=v&q=cache:YQS2jPhWysAJ:www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/705734f2-4e85-2e10-2ebf-891d0110de74%3FQuickLink%3Dindex%26overridelayout%3Dtrue+&hl=en&gl=au&pid=bl&srcid=ADGEESjL8dx81tAAJNL0Ln4c2MW4k3yZRDNFsop1pptOc3bQf1xU0Le9e3loFsZXJi5rWuYt3j7yoStGMktsL5XEdV9T3ONzdKay0x5yrIbaUBB3Dpz1Fr6xuggf_IZX-S0Q4WONpBhN&sig=AHIEtbTZfXXLN4gZCsw7qpZXgrkjeCYLcA
    what is the field used for Interval ( from, to , range) . You have missed my other question, why am I getting X below the result while doing the date calculation . I mean I am getting the result, but below every row, there is a X . Any ideas ?
    Thanks,
    DR

  • Due Date Calculation on A/R Invoice

    The Due date calculation on an Invoice for a customer with a payment condition of 30 days is wrong on  the system:
    Invoice DocDate: 11.05.17
    Invoice DueDate:  11.07.01
    On the BP Master Data is set a payment condition of 30 days. So it should be a due date of June, not July. This is a invoice that comes from a Sales Order with Approval Procedure.
    Our version is 2007 A SP:00 PL:49.
    Thanks in Advance...

    Hello,
    Perfect Notification
    For Payment Terms for Business Partner----
    IF (@transaction_type = 'A' Or @transaction_type = 'U')  AND @object_type = '17'
    BEGIN
    Declare @GroupNum as Nvarchar(20)
    Declare @OCRDGroupNum as Nvarchar(20)
    Declare @PaymentTermCode as Nvarchar(20)
    Declare @PaymentTermName as Nvarchar(20)
    Set @PaymentTermCode = (Select GroupNum from OCRD where CardCode = (Select CardCode from ORDR where DocEntry =@list_of_cols_val_tab_del))
    Set @PaymentTermName = (Select PymntGroup from OCTG where GroupNum = @PaymentTermCode )
    Set @GroupNum = (select GroupNum from ORDR where DocEntry =@list_of_cols_val_tab_del)
    Set @OCRDGroupNum =(Select GroupNum from OCRD where CardCode = (Select CardCode from ORDR where DocEntry =@list_of_cols_val_tab_del))
    If @GroupNum != @OCRDGroupNum
         begin
              SET @error = 10
              SET @error_message = N'Payment Terms Should be  ' + '   ' + @PaymentTermName + ' ' +' For this Business Partner'
         end
    END
    End----
    It will Definatillly Help You.
    Thanks
    Manvendra Singh Niranjan

  • Baseline date calculation

    Hi,
    We have a requirement to exclude non-Business days while calculating Baseline date(for the Accounting Document created on saving the Billing document)
    Currently the Baseline Date being populated in the Accounting Document is Document date + 5days(including Holidays).
    For eg
    Current Scenario
    Document Date: 12th Feb 2008
    Baseline date: 17th feb 2008.
    Requirement:
    Document Date: 12th Feb 2008
    Baseline date: 19th feb 2008(Excluding Sat & Sun).
    Request you to share useful info in this regard.
    Thanks
    Binu

    Hi,
    Use user exit RV60FUS5 for these base line date calculations.
    Thanks
    Krishna.

  • Baseline date calculation excluding non-Business days

    Hi,
    We have a requirement to exclude non-Business days while calculating Baseline date.
    Currently the Baseline Date being populated in the Accounting Document is Document date + 5days(including Holidays).
    For eg
    Current Scenario
    Document Date: 12th Feb 2008
    Baseline date: 17th feb 2008.
    Requirement:
    Document Date: 12th Feb 2008
    Baseline date: 19th feb 2008(Excluding Sat & Sun).
    Request you to share useful info in this regard.
    Thanks
    Binu

    Hi,
    Use user exit RV60FUS5 for these base line date calculations.
    Thanks
    Krishna.

  • Baseline date calculation in Invoice verification (MIRO)

    Dear experts,
    I need to set baseline date after 40 days from document date in MIRO.
    Baseline date calculation of "Terms of Payment" in IMG has two parameters:
      &#12539;Fixed day
      &#12539;Additional months
    We cannot set 40 days in these parameters.
    Can anybody tell me how to set baseline date not month but date(not fixed day) ?
    Please advise me on the settings SPRO>MM>Purchasing>Vendor Master>Define terms of Payment.
    Thanks & Regards
    Ken

    Hi,
    You can't do this.
    The baseline date is the date on which the calculations are made.
    So if you have 40 days to pay, this will be 40 days from the baseline date.
    This will either be the document date or another date, but you can't (in standard SAP) have the baseline date as "X" days after "Y".
    So the baseline date is the date of an event (e.g. the date that the Invoice was posted) not a calculation.
    Is it possible that you have misunderstood the use of this date?
    If you just want to ensure that the payment date is 40 days after invoice recipt, then set you just have to enter the number of days in the payment terms and the baseline date stays as the invoice date (etc.)
    Steve B

Maybe you are looking for

  • Wrong path?

    Hi, another question, i want to import an xml-file from my local disk like create or replace directory xmldir as '/home/oracle/Documents/'; insert into dblptest values (xdb_utilities.getXMLfromfile('note.xml','xmldir'); but the error: ERROR at line 1

  • Problem in WMA 2.0

    Hi all, I am using WTK 2.5.2 with netbeans 5.5.1 to receive the CBS .but the problem is it doesn't allow to import "javax.wireless.messaging.cbs.receive" class.Whenever it is in WMA 2.0 .I made change in API permission also.. Can any one tell me why

  • No Audio Levels During Recording in CS6

    Hi, is there a way to turn on the audio level monitoring before and during audio recording in premiere cs6 ? In the help file it says the levels would show, but when I try, the levels won't show. Thx, Frank

  • LR2 Export jpeg slideshow stops before all slides exported

    I have tried twice to export a slideshow of 300 slides. The first attempt stopped after 29 slides, the second stopped after 61 slides. No error messages appeared. I'm using Windows Vista Home Premium 32-bit, 4 GB memory and 179 GB free on my HDD. How

  • Tnsnames file

    Can anyone explain why some entries in my tnsnames file I have to actually specify SID = %Database Name% and for others I have to specify Service_Name = %Database Name% For 1 of them, if i use Service_Name = %Database Name%, I won't be able to connec