Seek help on If - then - else structure.

I am not good at PL/SQL and need some advice on this stored procudure. This SP is usded to refresh materialized views. In the first block, check how many mvs in the user_mviews table and select it into v_2. IF v_2 = 25, go to 2nd block to run package_1.sp to refresh mvs and handle the exception within this block. ELSE v_2 <> 25, jump into 3rd block to run package_2.sp to drop all mvs and re-create them.
The exception also is handled within the block.
The SP compile successfully. When there is no mvs, SP will jump to 3rd block to re-create all mvs. After that, executing SP again, it will generate e_3, not go to 2nd block to refersh mvs. If mvs <> 25, it will also generate e_3. Please point out where I am coding wrong or something I missed here. Thanks in advance.
Here is sample SP:
CREATE OR REPLACE PROCEDURE sp_my_plsql
IS
v_1 user_mviews.owner%type;
v_2 number;
e_1 EXCEPTION;
e_2 EXCEPTION;
e_3 EXCEPTION;
v_ErrorCode number;
v_ErrorText varchar2 (100);
BEGIN
BEGIN --- 1st block
SELECT DISTINCT xxx
INTO v_1
FROM user_table;
SELECT COUNT(table_name)
INTO v_2
FROM USER_TABLES
WHERE USER = v_1 and TABLE_NAME 'XXX_%';
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('EXCEPTION HANDLED');
END;
IF v_2 = 25 THEN
BEGIN ---- 2nd block
package-1.sp_1;
package_1.sp_2;
package_1.sp_3;
EXCEPTION
WHEN OTHERS THEN
RAISE e_3;
END;
ELSE
BEGIN ------3rd block
package_2.sp_1;
package_2.sp_2;
package_2.sp_3;
EXCEPTION
WHEN OTHERS THEN
RAISE e_3;
END;
END IF;
RAISE e_1;
RAISE e_2;
EXCEPTION
WHEN e_1 THEN
INSERT INTO log_table (error_dt, error_code, error_text, error_message) values (sysdate, null, null,' successful ');
WHEN e_3 THEN
v_ErrorCode := SQLCODE;
v_ErrorText := SUBSTR(SQLERRM, 1, 100);
INSERT INTO log_table (error_dt, error_code, error_text, error_message) values (sysdate, v_ErrorCode, v_ErrorText, 'Another Error ');
WHEN e_2 THEN
INSERT INTO log_table (error_dt, error_code, error_text, error_message) values (sysdate, null, null, ' Created');
COMMIT;
END;

> EXCEPTION
WHEN OTHERS THEN
RAISE e_3;
You are hiding the underlying error stack here. Say you hit an exception to do with insufficient privileges, corrupt index block or whatever, your code says to call that "e_3". Now you want to know what is causing e_3 exceptions. How about taking away the exception hider and letting it tell you?

Similar Messages

  • Question regarding the If-then-else function

    Hi folks ,
    I have been constantly putting threads on this subject for the past day,  hope it doesn't annoy any one here.
    My scenario is really simple, and i am  almost close to the solution, but there is just 1 thing missing and i know that is a very small thing, could be the context too. Hope some one can help by pointing it out>
    Mapping:
    In my source i have a header(0-unbounded) & detail(0-unbounded). At a given instant either header / detail will occur in source, depending on that the target node "response" will occur(0-n times)
    i have achieved this in the mapping.
    the problem is this:
    Both the Header/Detail have a field in it called Sequence# which is mandatory and can occur only once in the Header/Detail node.
    Now depending on what occurs: ie Header/Detail i need to map that particular seq# into my Target Respone's SEQ_#.
    I have done the mapping for this and have done a standalone testing.
    Mapping: Check if HEADER EXISTS, if yes? then map the HEADER.Seq# to TARGET.Seq#
    Here are my findings:
    Scenario1: 3 header nodes(No Detaili) each with a seq # in it. Out put 3 Target node each with 3 seq # in it.
    Scenario2: 2 Detail Nodes(No header) each with a seq # in it. Output fails to produce the 2nd Target Structure's Seq# and Fails
    When i look into the Display Queue in the mapping , i examine the iF-Then-Else function:
    Since HEADER doesn't exist i c 1 Suppress in my If-Condition hence the if condition becomes FALSE., now since its false its supposed to map the seq# from my detail. (This case i have 2 ).
    But in the output of the IF-Then Else, i get out only 1 seq # which is the 1st one,
    What i am thinking is that the exists condition is giving out only 1 FALSE instead of 2, If there were 2 false from the exists then i would have had both the seq # in my output,
    I hope my question is clear, Would appreciate anysort of help . And i apologize if I seem to be brigning up the same question over again experts.
    I don't wnt to create a UDF for this matter because i know there is something i am not doing right,
    Hank

    Sorry I could not give my udf in my last post.
    Udf1:
    Create a context udf and name it as RemoveSuppress. Take two input arguments a and b. Imports: java.*;
    Add this code:
       //write your code here
    boolean found = false;
    for (int i=0;i<a.length;i++) {
         if (a<i>.equals(b[0])) {
         found = true;
         break;
    if (found == true)
         result.addValue("true");
    else
         result.addValue("false");
    Then it should work.
    Regards,
    ---Satish

  • Sum function within if/then/else (xdofx:if)

    I'm attempting to display a total at a particular group within my report. This total is conditional and should choose to display a placeholder value or the sum of another placeholder value (in a child group).
    I have been able to vary my output based on the value I want to check: FIXED_QUOTE_FLAG - I have the if/then/else working in a simplified fashion
    I can display literals and some placeholders correctlly eg. print a literal value of 00110011 or the value of placeholder QUOTED_PRICE
    I can also display a calculated placeholder, using sum within the group I am concerned with: sum (current-group()/ACTIVITY_CHRG)
    But when I try to get everythign working together ...
    I cannot get the sum to work inside the if/then/else condition. The result is NULL (blank in HTML output).
    The following is the snippet which is not working correctly:
    <?xdofx:if FIXED_QUOTE_FLAG = 'Y' then QUOTED_PRICE else sum (current-group()/ACTIVITY_CHRG) end if?>
    Message was edited by:
    gareth_adamson

    To answer you first question, perhaps sum is not a supported function in the xdofx namespace. It's annoying when this problem comes up because xdofx namespace seems to be the only way to do if then else clauses. I'm not entirely certain on the above, but you could resort to using BI Publisher's built-in if statement.
    For your problem, something like this:
    <?if: FIXED_QUOTE_FLAG='Y'?>
    QUOTED_PRICE
    <?end if?>
    <?if: FIXED_QUOTE_FLAG!='Y'?>
    <?sum(current-group()/ACTIVITY_CHRG)?>
    <?end if?>
    EDIT:
    There is a way to do if else without xdofx namespace. It is done with <?choose:?> <?when:?> and <?otherwise:?> tags. Here is example syntax copied from Tim Dexter's blog:
    <?choose:?>
    <?when:count(TRX_NUMBER) > 0?>
    Invoice Table
    <?end when?>
    <?otherwise:?>
    No Data Found
    <?end otherwise?>
    <?end choose?>
    To answer the second question about a running total, you will need to use the <?xdoxslt:set_variable($_XDOCTX,'var_name',var_value)?> and the <?xdoxslt:get_variable($_XDOCTX,'var_name')?>. This method of working with variables is the only method that allows you to update a variable. This makes it good for running totals. Consult the official user guide under "Creating an RTF Template" the section about using variables and calculating running totals.
    So, in your problem, once you get the first part working, you will have to add that value to your running total. It will look something like this:
    <?xdoxslt:set_variable($_XDOCTX,'running_total',xdoxslt:get_variable($_XDOCTX,'running_total') + conditional_value)?>
    Remember to initialize the running total to zero! Hope this helps.
    Thanks,
    Matt Soukup
    Message was edited by:
    Matt Soukup

  • Failing to install windows 8.1/7/ any kind of windows on my imac,seeking help foreal

    Hey there. It's going to be a long post since I've messed with it for 4 days, and still no success even in the time I'm currently writing this message - the furthest I got is having tons of crashes and black screens. And now I can't even reclaim my lost harddrive space (resizing partitions doesn't work anymore).
    I'll start with that I already tried to make Bootcamp work about a year ago, but then quit it out of no success and reverted all the changes. But this time my situation is different - I'm pretty sure something messed up in the middle and now I'm seeking help and answers to my questions. And here we go - one bright day I decided to install Windows 8.1 as a secondary boot system on my iMac for personal reasons. I went and added Bootcamp's ability to make a bootable USB on my mac by changing the plist file, and finally had the option to do so. Then got an ISO of Windows 8.1's installation, burned it to a DVD with disk utility (on the lowest speed) and here's already where my problems started. The disk failed to burn for some unknown reason, even though when I compared the contents it had the exactly same thing in both the ISO and the DVD. Weird isn't it? I still tried to boot it - and guess what? the DVD booted but it had the non-EFI interface (huge and pixelated). Anyway when I pressed next I had some weird driver errors, so I decided to use an USB instead (1 DVD wasted so far). I used Bootcamp to create a bootable USB with drivers and went to boot it. The USB booted perfectly fine under the name "EFI Boot" and then I reached the partitions screen.. Obviously I had weird errors again (GPT/MBR stuff). One tutorial on the web suggested creating a partition for the windows rather than using the Bootcamp pre-made one. I followed it by booting my main system, and using disk utility to delete the Bootcamp partition. Later on I booted again to the installation and created a new partition from the partitions screen. Windows created two partitions - a Microsoft reserved partition, and the secondary partition which is used for the windows files. After some time the windows finally booted for the first time. It took pretty long but went smooth - until it finally booted. Since here the problems returned - the Windows crashed every 5 minutes from a driver error (that's AFTER I installed the Apple drivers right after the system finished booting), I googled it and followed various tuts but it still wasn't fixed. I decided to quit using 8 since I liked 7 more anyway (I currently have it installed as a virtual system in Parallels), so I decided to install 7 instead of 8 since I never had any issues with it. Booted up my main system again - went to Bootcamp Assistant, USB creation. ISO file + drivers on the USB. I reboot. Holding ALT and... my mac can't even see the USB drive! Luckily I had 4 more installations (various ISOs) of Win 7, so I decided to try them. I tried ALL the Installations I in none of them my mac could see the USB drive (I wonder how my USB survived all this rewriting on it...) Again to Google we go. I researched a bit and realized that I'm missing a file called xboot64.efi in the "efi/boot" folder, which can be taken from windows. I tried extracting it from install.wim but none of my archiving apps could open it (I tried Unarchiver, Keka, 7zX, terminal's unrar command and more, none could!). I also realized my Win 8 installation had this file so I added it to the Win 7 USB. Now my mac could see the USB in the boot screen - and it booted. I saw the "loading files" screen, and after one minute of it... black screen. I waited 10 minutes. Then 30. An hour. Still a pure black screen. I thought something is wrong with my file, and read that this file is also found in an already installed Win 7, so I went to parallels and took it from here, then added it to my installation. Again my mac could see the USB, but still no luck. When I pressed enter to boot from it, nothing happened as if the boot screen was stuck - the drive was selected but it didn't do anything. I waited long time again and decided to stop waiting. I tried to burn another DVD, this time with Titanium Toast. Again the DVD failed to burn, and when I checked the content, it was the same as the ISO I tried to burn from (official ISO from Microsoft of Windows 7 Ultimate SP1). I went and booted it - this time I saw again "Windows" and "EFI Boot"in the boot screen, both with a disc icon. "EFI Boot" didn't load like the usb previously (loads forever), so I booted the "Windows" thing. The setup loaded, and finally I could see the installation window. Reached the partitions screen... and here the problems returned once again. An error along the lines of that Windows can't be installed on a GPT partition. Some tuts on YouTube and in Google suggested to simply format the problematic partition. And so I did - yet the problem wasn't fixed. After messing with all that for one more day - trying different installations, ways to boot the USB and DVDs, formatting the Windows partition etc, I decided it's time to stop messing with it since luck definitely isn't in my side when it comes to Bootcamp (and for the record, I never had any issues with OSX, but when I tried adding windows to it.. eh, you can guess.) I booted back to my normal system, and went to disk utility to delete the partitions. The Windows partition was deleted easily, but the Microsoft reserved one.. not so quite. (by the way when I boot into it I get a Win 8.1 error screen that tells me to repair the system, since I formatted the Win partition itself). Until this very moment I still can't delete the reserved partition and return my beloved 30gb that I lost because of the resizing (I can't resize my Mac HD partition).
    I'm really desperate now. I tried everything and the furthest I got is getting a broken Windows 8.1 (which I deleted later), destroying 5 DVDs, shortening the lifespan of my USB drive, and googling errors the whole day for 4 days in a row. And now I can't even return my lost 30gb even after I decided to quit it. Please help or suggest me what to do, whether it's about how to successfully install Win 7 or to return my lost gigabytes, any kind of help is appreciated. If you managed to read so far, thank you for reading my post and I hope you'll be able to assist me and get me out of this situation.

    Read the Boot Camp Help first. Boot Camp does not yet support Windows 8.1 http://windows.microsoft.com/en-US/windows-8/system-requirements. If you insist on installing 8.1 use a virtual machine like parallels, Fusion, or VirtualBox.
    http://www.apple.com/support/bootcamp/

  • Problem with IF THEN ELSE in RTF template

    HI ALL,
    I have two layouts in the RTF template. Based on the parameter value it has to show the value.
    For example if P_State='United States' then first layout should come. else second one should come.
    I tried to use the IF Then else logic through the form field but i am getting error.
    Please help on this to get it.
    Regards
    Boopathi

    You can do that.
    i guess, the syntax you are using is wrong.
    please refer documentation or this forum for choose:
    Use choose statement. it s better.
    Or send me the template to my id in my profile. or upload it here http://apps2fusion.com/forums/viewforum.php?f=60

  • If Then Else Statement in SAP R/3 BW

    Hi,
    Does anyone know how to create an If Then Else statement in BEX?
    Thanks,
    Mounika.

    Hi mounika,
    do this way
    If 'material number' > 0.
    rslt = 'enter into table'.
    else.
    rslt = 15.
    endif.
    A True condition always evaluates to 1, a False condition evaluates to 0.
    for more quieries in bw ..pls go through  the link
    http://sap.ittoolbox.com/groups/technical-functional/sap-bw
    pls reward if helps,
    regards.

  • Select in CASE statement or in IF-THEN-ELSE

    I have been struggling for a week with a problem and still can't solve the way I want.
    Given four text fields in page : p1_name, p1_place_name, p1_place_number and p1_place_init_letter - where user types text and press 'Search' button to see the results.
    p1_name finds results in table EMPLOYEES
    p1_place_name, p1_place_number and p1_place_init_letter find results in table PLACES
    the two tables are linked by id_place field
    I would like reports to be shown depending on search results:
    - if p1_name exists and (p1_place_name and p1_place_number and p1_place_init_letter) exist AND EMPLOYEES.id_place = PLACES.id_place then a single report shows only employee row
    - if p1_name exists and (p1_place_name and p1_place_number and p1_place_init_letter) exist AND EMPLOYEES.id_place # PLACES.id_place then two reports showing 1) employees with name = :p1_name and 2) places with name, number and init_letter = :p1_.....
    - if p1_name not exists and (p1_place_name and p1_place_number and p1_place_init_letter) exist then a message with 'NO EMPLOYEE' and report shows only places where name, number and init_letter = :p1_.....
    - if p1_name exists and (p1_place_name and p1_place_number and p1_place_init_letter) not exist then report shows only employee row where name = :p1_name and message with 'NO PLACE'
    - if p1_name not exists and (p1_place_name and p1_place_number and p1_place_init_letter) not exist then messages 'NO EMPLOYEE' and 'NO PLACE'
    I do NOT know if it is possible, and if it is, then what do I have to use : IF - THEN - ELSE or CASE ?
    I tried to build HTML report region conditionally shown for each situation, but they do not work the way I want.
    Could you please help me ?
    Thank you in advance !

    Agree with Dan. Use a dedicated report region for a unique query. Use a rendering condition to determine if that reporting region must be rendered (i.e. whether or not that reporting query must be executed ).
    The alternative is creating a function that constructs the SQL query dynamically, based on the user supplied values for page items. Use the function as the source for the reporting region, instead of a SQL statement. (this is similar to creating a ref cursor for a client, minus the actual step to create the ref cursor - instead the source SQL for that ref cursor is returned).
    Also consider asking your Apex questions in the dedicated Apex forum on OTN.

  • Problem in If-Then-Else formula in report

    Hello guys!
    I use an If-Then-Else statement in a Calculated Key Figure (Cf. <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/23/17f13a2f160f28e10000000a114084/content.htm">Conditional Calculations</a> ) and it works great with basic calculations.
    I have a query (done in BI 7.0) where I display, for each calendar months (via 0CALMONTH), the usage (stored in a normal key figure in hours) of several products.
    I need to take into account only the products that have been used for at least 60% of the time of the highest product for each month. I a single product, for a month, has been used less than 60% of the highest one, it should be considered as not being used at all (so the calculated usage would be = 0), otherwise, its usage is counted as normal.
    In order to achieve this, I thought I would display the normal usage (the regular key figure) in column A, a calculated key figure that determines the MAXimum usage for each month in column B (which should be the same for all products) and another calculated key figure that displays the result of the If-Then-Else statement in column C.
    In rows, I have 0CALMONTH and the products.
    HOWEVER, when I do this, the result is incorrect. This is probably because to determine the MAX usage, I use a local calculation option, which displays the correct maximum usage on each row but it's not correct when used somewhere else.
    <b>MY QUESTION IS: HOW can I display the maximum usage for a month on all rows without using the calculation option (and therefore would be correctly used by the If-Then-Else statement. I tried an aggregation exception but it doesn't really work (it works only on the total, but I need to do the calculation on each individual row).</b>
    <u><b>Any useful comment will be greatly appreciated </b></u>
    Thanks in advance!

    Hi Francal ,
    Have you tried it . The constant selection will work if you have defined the calculated key figure correctly i.e. Aggreagtiomn "Max" with "product" as ref characteristic. Then you have to use this calculated key figure in your query , restrict it by "product" and make it a constant selection.
    The calculated key figure it self  will bring the highest usage for Month + product + ( any other characteristic you have in query ) but this will only apply to result . If you use constant seelction on top of it it will make sure that you see same value for all product for a particular month( and other characteristic combinations if you have ).
    I have built similar queries and it works . By the way which versions of backend and frontend you have ??
    Regards
    Sanjay

  • Problem with if-then-else using BI Answers dataset

    Hi, I'm having issues using the if-then-else logic with a BI Answers dataset. I'm running two versions of a report - one that access the SH schema tables directly, and one that uses a BI Answers dataset based on the SH schema.
    My problem is with the if-then-else operator. It works fine against the relational tables when I use the following syntax:
    <?xdofx:if CUST_GENDER = 'M' then 'Mr.' else 'Ms.' end if?>
    However, when I go against a BI Answers report, the name of the field changes from CUST_GENDER to Customers._Cust_Gender_. If I make an exact find and replace on the if-then-else code, it doesn't work (nothing at all displays)
    <?xdofx:if Customers._Cust_Gender_ = 'M' then 'Mr.' else 'Ms.' end if?>
    Can anyone help?
    Thanks,
    Scott

    Is it possible that any of the fields have null values?  If so, see my blog post about null handling in Crystal for more information:  What is Null and Why is it Important for Crystal Reports | SAP BI BLOG
    -Dell

  • Query if-then-else logic with calculation

    Hello,
    I want to calculate within a BEX-formula.
    I have two key-figures:
    - Quantity
    - Value
    The logic should be like this:
    IF Value > 0 THEN Value / Quantity ELSE 0
    ( / means: divided)
    How can I reach this?
    The URL
    http://help.sap.com/saphelp_nw70ehp1/helpdata/de/e3/e60138fede083de10000009b38f8cf/frameset.htm
    does not help me.
    Thanks for your help,
    Thomas

    That is the way to perform if then else...
    As long as boolean operations returns 0 or 1 you must play with that in order to get the desired result.
    In case you have DIV problems you can use this operator:
    NDIV0 (x): Is equal to 0 with division by 0, otherwise x.
       NDIV(<Expression>)
    Delivers 0 if the expression named in <Expression> gives a division by 0 in
    the calculation. Otherwise, the result is the value of the expression.
    Is used to
      - Avoid the output of an error message
      - Continue calculating with a defined result
    Please give an example if I am missing something.
    Regards,
    Sebastian,.

  • Implementing if then else condition

    Hi! All
    It would be very helpful if i can get answer of how to implement the condition below, using the functions available in graphical mapping editor....
    I need to map 2 source fields to 1 Target field, based on the condition that field(source) is populated in the target field only if field 1 is null.
    Source----->Target
    part_id1----
    >part_num(if part_id1 is null,then part_id2)
    part_id2----
    >
    I tried using if then else function, it is working fine but errors out when part_id is null....need to make it work even when part_id1 or part_id2 is null.If both fields are null it should not populate anything.The boolean function is not accepting null inputs...
    Please, let me know if there is a better way to implement this logic...Thanks a lot!
    Regards,
    Patrick

    Jones,
    Have this logic in your mapping:
    part_id1>exists>and
    part_id1>equals(textfunction)>null(take constant and dont put any value in it)>equals(text funciton)>false
    Give the above two to if
    Then in the then part give part_id1 and in the else part give part_id2.
    So in the above if part_id1 exists and equals to null then part_id2 will be output and part_id1 exists and not equals to null then part_id1 will be the output and part_id1 doesnot exist then part_id2 will be the output.
    Regards,
    ---Satish

  • Wierd Behaviour of IF then ELSE standard function

    Hi All,
    I am facing a very wierd behaviour of the IF then ELSE function in a mapping.
    Condition to be checked:   if GDS_id = 1, then (condition 1 -  RFC lookup ) ElSE (condition 2 - JDBC Lookup followed by an RFC  lookup).
    Issue:  The input payload is 0-unbounded with a possibility of a different GDS_id values.
    Case 1 :
    As shown below, in case the input payload has 3 repitions of the RECORD, with the Fit set having GDS_ID = 01, the mapping runs perfectly fine . All the If then Else branches are getting executed.
    Case 2:
    Where as iF the first GDS_ID != 01 (not 01) , thenthe target value is not getting populated properly .
    I have tried all the possibilities and combinations but i am unable to resolve this. Please help.
    Attached the screen shot of the message mapping, and sample test results of both the use cases.
    For instance, below is a sample payload:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:mt_EMERGO_common xmlns:ns0="http://sabreEMERGO_common.com">
    <Record>
          <booking_date>08012013</booking_date>
          <iata_code>2325540</iata_code>
          <gds_id>01</gds_id>
          <pos_code>RD3A</pos_code>
          <gds_code>01</gds_code>
          <net_booking>11</net_booking>
       </Record>
    <Record>
          <booking_date>08012013</booking_date>
          <iata_code>2325540</iata_code>
         <gds_id>02</gds_id>
          <pos_code>54S8 </pos_code>
          <gds_code>02</gds_code>
          <net_booking>11</net_booking>
    </Record>
      </ns0:mt_EMERGO_common>

    Hi All,
    I have changed the message mapping like below. Even though i am not getting my target filed as value. As per my requirement if GDS_ID=01  then perform the RFC lookup and pass the value to target fields KUNNR and else GDS_ID=02 then perform the JDBC LOOKUP and JDBC LOOKUP output to RFClookup .RFC LOOKUP output pass to my target field KUNNR.
    Result of my mapping is 1st record only populated KURNNR in Target side and 2nd record not showing as KUNNR filed in target side .But I have taken look on display queue in If then else out showing 2 values but it is not passing to target filed.
    Please provide any suggestion to resolve this issue.
    Please find the mapping logic:
    Please find the test screen:
    Please find the test Data:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:mt_EMERGO_common xmlns:ns0="http://sabreEMERGO_common.com">
       <Record>
          <booking_date>08012013</booking_date>
          <iata_code>2325540</iata_code>
         <gds_id>02</gds_id>
          <pos_code>54S8 </pos_code>
          <gds_code>AA</gds_code>
          <net_booking>11</net_booking>
       </Record>
       <Record>
          <booking_date>08012013</booking_date>
          <iata_code>2325540</iata_code>
          <gds_id>01</gds_id>
          <pos_code>RD3A</pos_code>
          <gds_code>AA</gds_code>
          <net_booking>11</net_booking>
       </Record>
    </ns0:mt_EMERGO_common>
    Regards,
    Ramesh

  • 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

  • If then else emulation

    it is not very efficient, but nevertheless works.....
    since xmlp is very limiting on the size of a statement, you need to keep it simple.....
    Its better then using multiple if statements which is what we had to do in the past.
    5.6.3 is supposed to have a if-then-else statement so can't wait to get there.....
    here is the code....
    <?choose:?>
    <?when:sum(LINE_UNIT_SELLING_PRICE)<400?>LOW<?end when?>
    <?when:sum(LINE_UNIT_SELLING_PRICE)>399 and sum(LINE_UNIT_SELLING_PRICE)<4000?>MED<?end when?>
    <?otherwise:?>HIGH<?end otherwise?>
    <?end chose?>

    other helpful syntax
    <? format-date: @orderdate; 'DD-MMM-YYYY' ?>
    <? format-number: ./price; 'L999G999D99' ?>
    TOTAL ITEMS: <? count(items/item) ?> works like sql count
    <? for-each:items/item ?> Item <?position() ?> <? end for-each?> works like sql rownum function
    to set and get variables
    Hope someone finds these useful....

  • How to total 2 colums with an -If then else- statement each

    Hello,
    I have 2 colums A en B who generate data based on an “If then else” statement.
    Colum A
    <?xdofx:if (OMZET_YTD_VJ )!='' then ((OMZET_YTD_VJ) * (BM_YTD - BM_YTD_VJ)) div 100 else 0 end if?>
    Colum B
    <?xdofx:if (BM_YTD)!='' then ((BM_YTD) * (OMZET_YTD - OMZET_YTD_VJ)) div 100 else 0 end if?>
    Colum C needs to be the sum of both. Who can help me?
    Thanks a lot.

    Can you send me the RTF template and xml file to [email protected]? I can take a look and try to help.
    Thanks,
    Bipuser

Maybe you are looking for