How to write Boolean function (If Then Else) For Date Caluclation.

Dear All,
I have a scenario where i need to calculate Position time hold by an employee in an organisation.
I have 2 date Char ( DATE FROM & DATE TO), the problem is that is , If an employee is having
2/3 position in an organisation its current position End Date is always 31.12.999 as its End date is
not know. For previous position End Date is maintained.
My requirement is to calculate Position hold time including Current position.
Can it be done directly in formula variable with If Then Else condition.
or i need to write user exit if its exit,
please guide me for ABAP Code.
Thanks V V much.
Regards,

Hi,
Following options are available for you:
1. Is the valid to, valid from dates available as a result of standard time dependency of navigational attributes? if yes , you can not use them in calculations, in such case you may have to write a full fledged routine at formula variable, using uxer exit.
2. Another simple method, that i would suggest would be using temporal joins (infoSets), that precisely fits you case.
Helpful links:
About Infosets:
[http://help.sap.com/saphelp_nw70/helpdata/EN/ed/084e3ce0f9fe3fe10000000a114084/frameset.htm]
About Temporal joins:
[http://help.sap.com/saphelp_nw70/helpdata/EN/11/723c3b35703079e10000000a114084/frameset.htm]
Hope this helps.
Cheers,
Sumit

Similar Messages

  • How to write Boolean function (If Then Else)?

    Hi all,
    I have a logic to write in the query. It is:
    If (A = 0 and B = 0)
    Then 0
    Else
            If (A = 0 and B > 0)
            Then 100
            Else
                   A/B  (we want to show %)
    How to use boolean function to write this Netted If Else statement? Thank you in advance!

    Hi
    If (A = 0 and B = 0)
    Then 0
    Else
    If (A = 0 and B > 0)
    Then 100
    Else
    A/B (we want to show %)
    1. create a formula in the query designer. and use this formula for if - else
    ( ( (A==0) AND (B==0) ) * 0) +  ( ( a==0 ) AND (B >0 ) * 100 + (A/B*100) )
    : denotes THEN
    + : denotes ELSE
    See if this works.
    Assign points if helpfull
    From
    ManesH

  • How to write a function block?

    Hi There,
    Does anybody know how to write a function block with LabVIEW?  Something like those in Real-Time VIs>>Function Blocks>>.
    Thank you very much in advance?
    Solved!
    Go to Solution.

    I don't want to overwelm you but there is tons of free training material online.  One of these is the one already mentioned.
    NI Learning Center
    NI Getting Started
    -Hardware Basics
    -LabVEW Basics
    -DAQ Application Tutorials
    3 Hour LabVIEW Introduction
    6 Hour LabVIEW Introduction
    Self Paced training for students
    Self Paced training beginner to advanced, SSP Required
    LabVIEW Wiki on Training
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How to write a function generator

    How to write a function generator from labview and using PCI-MIO-16

    Hallo, [email protected],
    Du (x) meintest am 27.07.01 zum Thema How to write a function generator:
    > How to write a function generator from labview and using PCI-MIO-16
    Look to the examples - there are many VIs with that function.
    Viele Gruesse!
    Helmut

  • How to make a function return number(10,0) data type (ORACLE 10g)?

    With 10g, how to make a function return number(10,0) data type?
    here is the function, it returns a number type :
    create or replace FUNCTION Get_portfolio_Id3 (p_HistObjTable In Varchar2,p_LHISTOBJID IN NUMBER) RETURN view_cpu_STD_Asset.LPORTFOLIOITEMID%Type IS
    v_Id view_cpu_STD_Asset.LPORTFOLIOITEMID%Type;
    BEGIN
    If p_HistObjTable ='amPortfolio'
    then v_Id:=p_LHISTOBJID ;
    elsIf p_HistObjTable = 'amComputer' then
    select litemid into v_Id from smcdba.amComputer c where c.LCOMPUTERID=p_LHISTOBJID ;
    else v_Id:=-99;
    End If;
    RETURN v_Id;
    END Get_portfolio_Id3;
    Thanks.
    Message was edited by:
    user631701

    create or replace FUNCTION Get_portfolio_Id3 (p_HistObjTable In Varchar2,p_LHISTOBJID IN NUMBER) RETURN view_cpu_STD_Asset.LPORTFOLIOITEMID%Type IS
    v_Id view_cpu_STD_Asset.LPORTFOLIOITEMID%Type;
    BEGIN
    If p_HistObjTable ='amPortfolio'
    then v_Id:=p_LHISTOBJID ;
    elsIf p_HistObjTable = 'amComputer' then
    select litemid into v_Id from smcdba.amComputer c where c.LCOMPUTERID=p_LHISTOBJID ;
    else v_Id:=-99;
    End If;
    RETURN round(v_Id);
    END Get_portfolio_Id3;

  • How to write export dump commad with no datable data only table structure.

    How to write export dump commad with no datable data only table structure will there and command for hole schma.
    e.g. export dump command for scott schema and all table within scott schema in it no table data should be exported.

    If I understand the question, it sounds like you just need to add the flag "ROWS=N" to your export command (I assume that you're talking about the old export utility, not the Data Pump version).
    Justin

  • Calendar...list function shows only events for date select instead of events from that date forward.

    Calendar list function shows only events for date selected....instead of events for date selected and events forward from that date.  Is there a setting change needed?  Help!

    Hi,
    Did you check that your universe object referring "Date of Completion" has Date data type?
    Can you also provide the BOE verson you are using?
    I remembered that the calendars were not displayed in XIR2 version.
    Didier

  • How to write a function read line from a file in FDK?

    Hello,
    I want to write a function that can read a file in line by line in FDK. How do I write it. If FDK could not. Is there any the way? Please help.
    Thank you,
    Thai Nguyen

    Thai,
    You can use the "channel" functions for this. I'm far from an expert on channel programming but I've read files line-by-line successfully by going one character at a time, looking for a carriage return.
    You can open up the file channel with something like:
      ChannelT chan;
      FilePathT *path;
      UCharT ptr[1];
      IntT numRead;
      path = F_PathNameToFilePath("C:\\temp\\mydoc.txt", NULL, FDefaultPath);
      if((chan = F_ChannelOpen(path,"r")) == NULL)
          return;
      //read the first character
      numRead = F_ChannelRead(ptr, sizeof(UCharT), 1, chan);
    ...then you can call F_ChannelRead iteratively to build the string in a buffer, looking for a carriage return (ASCII 13) and stopping there. (that is, ptr[0] == 13).
    There might be a better way. This is just the way I've gotten it to work. It probably is not a good method for unicode files.
    Russ

  • How to write decode function in plsql

    hi
    guys
    can u plz help me in this topic
    .........

    Hi ,
    You could use the decode function in an SQL statement as follows:
    SELECT supplier_name,
    decode(supplier_id,      10000,      'IBM',
         10001,      'Microsoft',
         10002,      'Hewlett Packard',
              'Gateway') result
    FROM suppliers;
    The above decode statement is equivalent to the following IF-THEN-ELSE statement:
    IF supplier_id = 10000 THEN
    result := 'IBM';
    ELSIF supplier_id = 10001 THEN
    result := 'Microsoft';
    ELSIF supplier_id = 10002 THEN
    result := 'Hewlett Packard';
    ELSE
    result := 'Gateway';
    END IF;
    The decode function will compare each supplier_id value, one by one.
    Regards,
    xaheer

  • How to write printing function using JSP?

    dear all,
    i want to add a printing function in my project but i do not know how to do it? could anyone teach me how to do it?
    thanks
    eric

    salut eric,
    you can do it this way :
    1 - create a html link in your code to this javascript
    function : (I am using Struts, but you can write it in
    pure html
    <html:link href="#bodyStart"
    onclick="openWindowForPrinting()"
    titleKey="msg.status.print">      <bean:message
    key='app.print' />
    <script language="JavaScript">
    <!--
    window.open = SymRealWinOpen;
    //-->
    </script>
    </html:link>
    >
    >
    2 - here is the javascript function : it open a window
    with the "print.jsp" page.
    function openWindowForPrinting(){
    window.open('/your_project/pages/common/print.jsp','',
    'left=150, top=150 , status=no, directories=no,
    toolbar=no, menubar=yes, location=no, scrollbars=yes,
    resizable=yes, dependant=yes');
    3 : here is the print.jsp page : You have only to
    create a session variable called
    "currentBodyRelativeLocation", which content the
    relative URL to the page you want to print (for
    example, the boby of the current page).
    <%@ taglib uri='/WEB-INF/tlds/perso.tld'
    prefix='perso' %>
    <html>
    <head>
    <perso:csslink page='${cssRelativeLocation}' />
    </head>
    <body onload="var SymTmpWinOpen = window.open; window.open = SymWinOpen; printPage();; window.open = SymTmpWinOpen;">
    <body>
    <jsp:include page="${currentBodyRelativeLocation}"/>
    </body>
    <script language="JavaScript">
    <!--
    window.open = SymRealWinOpen;
    //-->
    </script>
    </html>
    <script language='javascript'>
    function printPage(){
    window.print();
    window.close();
    </script>
    hai,
    i'm not very understand how is your code work. when i write html code, do i need to mind about this code: "msg.status.print" ? what is this code mean?
    i have too much question on this thing. would you mind to be further explain to me? or is it any reference for me to refer? i'm really new to write printing function on JSP.
    i never write this function before. i'm feel so lost.....:(
    thanks again
    eric

  • How to write a function module?

    How can i write a function module that does the same thing as BAPI_FLIGHT_GETLIST in the SAP system?

    Hi
    Hope it will help you.
    Reward if help.
    Function Modules;
    Check this matter.
    Function Modules are Global ABAP programs created by SAP for reusable purpose.they have IMPORT,EXPORT and TABLE parameters, and EXCEPTIONS to through when error occurs.
    You can create them from TCode SE37.
    Go through the following doc:
    Function modules are cross-program, reusable procedures that are organized into function groups, and whose functions are implemented between the statements FUNCTION and ENDFUNCTION. Function modules and their interfaces are created in the Function Builder.
    Function Module Interfaces
    The parameter interface of a function module is defined in the Function Builder. It includes the definition of interface parameters and the specification of exceptions that can be triggered by a function module. The Function Builder automatically generates comment lines below the FUNCTION statement in the source code of the function module, which represent the interface of the function module with the following syntax:
    Syntax
    ... [IMPORTING parameters]
    [EXPORTING parameters]
    [CHANGING parameters]
    [TABLES table_parameters]
    [{RAISING|EXCEPTIONS} exc1 exc2 ...]
    The syntax and semantics of IMPORTING, EXPORTING, CHANGING, RAISING, and EXCEPTIONS mainly correspond to the definition of method interfaces with [CLASS-]METHODS. The additional option of defining table parameters using TABLES is obsolete.
    Interface parameters
    The interface parameters are defined on the relevant tab pages in the Function Builder.
    IMPORTING parameters are input parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input parameter. The content of the actual parameter is passed to the input parameter when the call is made. The content of an input parameter for which 'pass by reference' is defined cannot be changed in the function module.
    EXPORTING parameters are output parameters. When the function module is called, a suitable actual parameter can be specified for every output parameter. The content of an output parameter that is defined for 'pass by value' is transferred to the actual parameter if the function module is completed without errors. An output parameter that is defined for pass by reference is not initialized when the function module is called.
    CHANGING parameters are input and output parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input or output parameter. When the function module is called, the content of the actual parameter is passed to the input/output parameter, and when the function module is completed, the content of the input/output parameter is passed to the actual parameter.
    TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
    Exceptions
    The exception of a function module are defined on the Exceptions tab page in the Function Builder. Here you can select exception classes to define whether class-based exceptions are declared or non-class-based exception are defined. Class-based exceptions are represented in the above syntax by RAISING, and non-class-based exceptions are represented by EXCEPTIONS.
    The addition RAISING is used to declare class-based exceptions that can be propagated from the function module to the caller. Exceptions in the categories CX_STATIC_CHECK and CX_DYNAMIC_CHECK must be explicitly declared, otherwise a propagation can lead to an interface violation. A violation of the interface leads to the treatable exception CX_SY_NO_HANDLER. Exceptions of the category CX_NO_CHECK are implicitly always declared. The declaration of exceptions of the category CX_STATIC_CHECK is statically checked in the syntax check. For exceptions of the category CX_DYNAMIC_CHECK, the check is not performed until runtime. In a function module in which class-based exceptions are declared with the RAISING addition, the statement CATCH SYSTEM-EXCEPTIONS cannot be used. Instead, the relevant treatable exceptions should be handled in a TRY control structure.
    The addition EXCEPTIONS is used to define a list of non-class-based exceptions that can be triggered in the function module using the statements RAISE or MESSAGE RAISING. Exceptions defined in this way - as with formal parameters - are bound to the function module and cannot be propagated. If an exception of this type is triggered in a function module, and no return value has been assigned to it with the homonymous addition EXCEPTIONS of the CALL FUNCTION statement when the call was made, this leads to a runtime error.
    Note
    For new developments after release 6.10, SAP recommends that you work with class-based exceptions that are independent of the function module.
    RFC is a technology which is used to access a functions (Modules) from
    the remote systems.
    If a function module is set as remote enabled which can be access from
    the remote system via RFC.Eg: U can access the Remote enabled function modules in ur VB,Webdynpro,Java,Visual composer program.
    A function module can be set as remote enabled by SE37->Go to ur FM->click the option Button "remote enabled".
    But Normal function modules can not accessd from the remote system.
    Good Example for RFC enabled function module is : BAPI(Business Application Programming Interface)
    Note: All BAPIs are Remote enabled but not all remote enabled function modules are BAPI.
    CALLING A FUNCTION MODULE:
    1)In U ABAP Editor --> Click "Patter" ---> Selection Option Button "Call Function"
    --> Write the Corresponding FM name --> Hit Enter
    2)The appropriate import ,export Parameters will be displayed in ur editor
    3)Pass the Values Here.
    Also check these links.
    http://www.geocities.com/victorav15/sapr3/abapfun.html
    Check this link:
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    Check this link:
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    See the following links:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm

  • How to write a function

    Is there a way to write a function
    function f(c sys_refcursor) return number;
    which is called from sql (for example like this)
    select f( cursor(...) ) from dual
    and returns the number of columns specified in the cursor expression;
    One suggestion could be to use the dbms_sql package, but it is impossible to invoke the dbms_sql.to_cursor_number function as it wants IN OUT parameter, and SQL doesn't allow in out parameters. so what to do.
    thanks in advance

    DimaK wrote:
    Is there a way to write a function
    function f(c sys_refcursor) return number;
    which is called from sql (for example like this)Yes. If this is truly needed - yes, you can create a cursor handle in SQL and pass that to a PL function to process. Example:
    SQL> create or replace function FunkyFoo( c sys_refcursor ) return varchar2 is
      2          type TStrings is table of varchar2(4000);
      3          buffer          TStrings;
      4          csvLine         varchar2(4000);
      5  begin
      6          fetch c bulk collect into buffer limit 10;
      7          close c;
      8
      9          for i in 1..buffer.Count
    10          loop
    11                  csvLine := csvLine || buffer(i);
    12                  if i != buffer.Count then
    13                          csvLine := csvLine || ',';
    14                  end if;
    15          end loop;
    16
    17          return( csvLine );
    18  end;
    19  /
    Function created.
    SQL> show errors
    No errors.
    SQL>
    SQL> col LINE format a50
    SQL> select
      2          FunkyFoo( cursor(select object_name from user_objects order by 1) ) as LINE
      3  from dual
      4  /
    LINE
    FUNKYFOO,TOKENISE,TSTRINGS,WEBURL
    SQL>
    and returns the number of columns specified in the cursor expression;No. Reason - a ref cursor does not have a describe interface. Thus you cannot determine the SQL projection of the cursor and number of columns, column labels and column data types and precision in the projection.
    But the question is.. why on earth do you want to have such a function? What purpose is it suppose to fulfill? What is the underlying requirement that needs to be met? As from what you've stated here, it seems to be pursuing a very incorrect solution for the unknown problem at hand.

  • How to write exit functions

    Hi
    i have to write exit functions in bps.can any body tell me how these are to be written.please explain the structure and flow of exit functions.please explain me in detail if posiible give me some links for exit functions.
    thanks and regards,
    sekhar reddy

    Hi Sekhar,
    Go through the below links
    Re: user exit
    https://websmp104.sap-ag.de/~sapidb/011000358700005475091999
    https://websmp104.sap-ag.de/~sapidb/011000358700005475101999
    Hope it helps
    Regards

  • How to write a function in JSP

    I have a few lines of code I would like to store in an external file and then call it from a web page.
    Here is the code
         String isCE = "No";
         String ismobile = "No";
         String accept = request.getHeader("accept");
         String user_agent = request.getHeader("user-agent");
         String accept_charset = request.getHeader("accept-charset");
         String accept_language = request.getHeader("accept-language");
         String profile = request.getHeader("profile");
         String x_wap_profile = request.getHeader("x-wap-profile");
         if (user_agent.contains("CE")) {
              isCE = "Yes";
         if (x_wap_profile == null && isCE == "No") {
              response.setStatus(301);
              response.sendRedirect("someurl.com");
              response.setHeader( "Connection", "close" );
    Now I would like to include this code and then call it with a single function and then pass the url like:
    snif("www.someurl.com");
    Please help

    Thai,
    You can use the "channel" functions for this. I'm far from an expert on channel programming but I've read files line-by-line successfully by going one character at a time, looking for a carriage return.
    You can open up the file channel with something like:
      ChannelT chan;
      FilePathT *path;
      UCharT ptr[1];
      IntT numRead;
      path = F_PathNameToFilePath("C:\\temp\\mydoc.txt", NULL, FDefaultPath);
      if((chan = F_ChannelOpen(path,"r")) == NULL)
          return;
      //read the first character
      numRead = F_ChannelRead(ptr, sizeof(UCharT), 1, chan);
    ...then you can call F_ChannelRead iteratively to build the string in a buffer, looking for a carriage return (ASCII 13) and stopping there. (that is, ptr[0] == 13).
    There might be a better way. This is just the way I've gotten it to work. It probably is not a good method for unicode files.
    Russ

  • IF THEN ELSE in DATA TEMPLATE NOT IN RTF

    Hi,
    Can any one tell me How to Implement IF THEN ELSE or DECODE or CASE Logic in a DATA TEMPLATE not in RTF
    as I saw loads of Post about implementing them in RTF not in the Template itself.
    I have a requirement please click this below for the Detailed Version of this Post, Else Please Just give me a Snippet from which i can Implement the IF THEN ELSE Logic in a DATA TEMPLATE( the .xml file) bu please not via a RTF not using PL/SQL Package
    Logic to select Report name based on User's input.
    Thanks
    vasanthanand

    Hello
    I am looking to do the same type of thing did you ever get an answer without having to use a RTF format perhaps in another forum or through investigation?

Maybe you are looking for

  • Need Help-Unable to find an available port

    Hi, I am Working one BPEL Process where in need to invoke a WebService. I was able to deploy my BPEL Process with the Web Service Call but i am getting an error while invoking the Webservice from the Process. BPEL PM Version 10.1.2.0.2 <bindingFault>

  • ITunes 10.5.2 not launching on Windows 7

    iTunes 10.5.2 will not launch on Windows 7 Professional.  I have tried disabling Bonjour, and that did not help.  Any suggestions?

  • To calculate sales price of a material

    Dear Experts We have a requirement to find the sales price of each material for a particular material. The purpose is to create the custom program that should propose the business to tell how many materials can be sold to a particular customer with t

  • Memory update -- 4gb≥ 2gb≥ 1gb≥ 0gb

    Hey guys, I would like some help about memory update. I have a MacBook with 2x512 ram. I would like to get more RAM. So, my question is if I get the 2x2gb it will improve my overall performance and graphics (Intel GMA 950 graphics processor with 64MB

  • Video too wide

    I recently took some videos with my friends iphone 4 and my new ipod touch. The video is a mixture of upright and horizontal but some of the videos seem to be wider than they should be. I've changed the aspect ratio but it does not seem to help. Than