How bad is this recursive method?

Ignore the variable names.
     public static int reverse(int blah)
          String temp ="";
          String remaining = "";
          String number = Integer.toString(blah);
          if(number.length() == 1)
               return (Integer.parseInt(number));
          else if(number.length() != 1)
               temp = number.substring(number.length()-1, number.length());
               remaining = number.substring(0, number.length()-1);
               temp+=reverse(Integer.parseInt(remaining));
               return(Integer.parseInt(temp));
     }

Hello,
The code wont end if its length is >2.
Will not be recursive.
ex:
234
it will return 423
thats the only issue...
Edited by: amit.khosla on Mar 1, 2009 8:52 PM

Similar Messages

  • I need help with this recursion method

         public boolean findTheExit(int row, int col) {
              char[][] array = this.getArray();
              boolean escaped = false;
              System.out.println("row" + " " + row + " " + "col" + " " + col);
              System.out.println(array[row][col]);
              System.out.println("escaped" + " " + escaped);
              if (possible(row, col)){
                   System.out.println("possible:" + " " + possible(row,col));
                   array[row][col] = '.';
              if (checkBorder(row, col)){
                   System.out.println("check border:" + " " + checkBorder(row,col));
                   escaped = true;
              else {
                    System.out.println();
                    escaped = findTheExit(row+1, col);
                    if (escaped == false)
                    escaped = findTheExit(row, col+1);
                    else if (escaped == false)
                    escaped = findTheExit(row-1, col);
                    else if (escaped == false)
                    escaped = findTheExit(row, col-1);
              if (escaped == true)
                   array[row][col] = 'O';
              return escaped;
         }I am having difficulties with this recursion method. What I wanted here is that when :
    if escaped = findTheExit(row+1, col);  I am having trouble with the following statement:
    A base case has been reached, escaped(false) is returned to RP1. The algorithm backtracks to the call where row = 2 and col = 1 and assigns false to escaped.
    How do I fix this code?
    I know what's wrong with my code now, even though that if
    if (possible(row, col))
    [/code[
    returns false then it will go to if (escaped == false)
                   escaped = findTheExit(row, col+1);
    how do I do this?

    Okay I think I got the problem here because I already consult with the instructor, he said that by my code now I am not updating my current array if I change one of the values in a specific row and column into '.' . How do I change this so that I can get an update array. He said to me to erase char[][] array = getArray and replace it with the array instance variable in my class. But I don't have an array instance variable in my class. Below is my full code:
    public class ObstacleCourse implements ObstacleCourseInterface {
         private String file = "";
         public ObstacleCourse(String filename) {
              file = filename;
         public boolean findTheExit(int row, int col) {
              boolean escaped = false;
              //System.out.println("row" + " " + row + " " + "col" + " " + col);
              //System.out.println(array[row][col]);
              //System.out.println("escaped" + " " + escaped);
              if (possible(row, col)){
                   //System.out.println("possible:" + " " + possible(row,col) + "\n");
                   array[row][col] = '.';
                   if (checkBorder(row, col)){
                   escaped = true;
                   else {
                    escaped = findTheExit(row+1, col);
                    if (escaped == false)
                    escaped = findTheExit(row, col+1);
                    else if (escaped == false)
                    escaped = findTheExit(row-1, col);
                    else if (escaped == false)
                    escaped = findTheExit(row, col-1);
              if (escaped == true)
                   array[row][col] = 'O';
              return escaped;
         public char[][] getArray() {
              char[][] result = null;
              try {
                   Scanner s = new Scanner(new File(file));
                   int row = 0;
                   int col = 0;
                   row = s.nextInt();
                   col = s.nextInt();
                   String x = "";
                   result = new char[row][col];
                   s.nextLine();
                   for (int i = 0; i < result.length; i++) {
                        x = s.nextLine();
                        for (int j = 0; j < result.length; j++) {
                             result[i][j] = x.charAt(j);
              } catch (Exception e) {
              return result;
         public int getStartColumn() {
              char[][] result = this.getArray();
              int columns = -1;
              for (int i = 0; i < result.length; i++) {
                   for (int j = 0; j < result[i].length; j++) {
                        if (result[i][j] == 'S')
                             columns = j;
              return columns;
         public int getStartRow() {
              char[][] result = this.getArray();
              int row = -1;
              for (int i = 0; i < result.length; i++) {
                   for (int j = 0; j < result[i].length; j++) {
                        if (result[i][j] == 'S')
                             row = i;
              return row;
         public boolean possible(int row, int col) {
              boolean result = false;
              char[][] array = this.getArray();
              if (array[row][col] != '+' && array[row][col] != '.')
                   result = true;
              return result;
         public String toString() {
              String result = "";
              try {
                   Scanner s = new Scanner(new File(file));
                   s.nextLine();
                   while (s.hasNextLine())
                        result += s.nextLine() + "\n";
              } catch (Exception e) {
              return result;
         public boolean checkBorder(int row, int col) {
              char[][] array = this.getArray();
              boolean result = false;
              int checkRow = 0;
              int checkColumns = 0;
              try {
                   Scanner s = new Scanner(new File(file));
                   checkRow = s.nextInt();
                   checkColumns = s.nextInt();
              } catch (Exception e) {
              if ((row + 1 == checkRow || col + 1 == checkColumns) && array[row][col] != '+')
                   result = true;
              return result;
    I thought that my problem would be not to read the file using the try and catch everytime in the method. How do I do this?? Do I have to create an array instance variable in my class?

  • How bad will this hurt?

    I have been considering buying a RV for a while. My boys aren't getting any younger. We currently have our house on the market. It seems like it is going to take forever to sell. My question is how bad do you think it will hurt my credit if I were to take out a small loan for approx $10,000 for a RV? My credit scores on fico 8 are around 660-670. I know waiting until after we buy a house is probably the best idea, but it just doesn't seem like it's going to sell anytime soon and I am dying to go camping and enjoy the summer with my husband and two boys.

    Kyliemarie85888 wrote:
    I have been considering buying a RV for a while. My boys aren't getting any younger. We currently have our house on the market. It seems like it is going to take forever to sell. My question is how bad do you think it will hurt my credit if I were to take out a small loan for approx $10,000 for a RV? My credit scores on fico 8 are around 660-670. I know waiting until after we buy a house is probably the best idea, but it just doesn't seem like it's going to sell anytime soon and I am dying to go camping and enjoy the summer with my husband and two boys.How about teaching your boys the joy of camping in a tent while hiking in the mountains or in a campground?  Most boys would rather do this than hang out in a motorhome.  (Motorhomes: Think retirees). I have been reading a lot about personal finance and the rule seems to be borrow only for necessities, pay cash for luxuries.    Just something to think about. I know RV's can easily cost 60K - 100K or more, so I might be concerned about a 10K RV needing expensive repairs. Your boys won't be boys forever, but the important part is that you spend time with them.  They don't need an RV to enjoy their parents. You could also rent a lot of nights in a nice cabin for less than 10K if you don't like sharing your bedroom space with bugs and bears.

  • Just how bad is this phone ? (E70 revisited)

    I have actually forgotten how frustrating Nokia phones can be as I had confirmed by (then) new E70 to the bottom drawer because with the firrmware on it, it wouldn't work in my bluetooth enabled BMer.
    What joy when I learned of the new version. Could it be that version 3.0633.09.04 (where do these numbers come from) would solve my problem ?
    Well I don't know. In fact I don't even know why I tried to put it on the phone. First I downloaded the latest PC Suite (the phone I have which actually works is NOT a Nokia, so I didn't have that on the PC ). Then I downloaded the software updater. Then I connected by recharged (and still plugged into the adaptor) E70, and fired up the updater.
    Next the USB message that my phone was disconnected from PC-Suite appeared, and as predicted the updater actually told me there was an update. I now had the option to leave or continue. When I continued, I got a message which told me the updater could not verify my phone !
    No WAIT !! I got past this by restarting, and while the message to get out was still on the screen, I used the utility in PCSuite to reselect my phone, and when the updater continued it started the download of 48.1M. Great.
    Next it came to the update bit. Again the process failed and again the solution was to do the little tinker with PC Suite to get past that point. In fact I got all the way to where the phone reboots, and shows the Nokia test screen. Here the phone seems to reconnect itself, but either its not fast enough or it's not connecting to the updater, because it reports that the update has failed. Sad but true.
    Should I have known ? Should I have guessed ? I have a buddy who has had an E61, an E70 and now wants to try the E90. Is he crazy or what ? S60 does for telephony what Locusts do for corn. If only words would describe how bad this series of phones really is...
    For those of you still here, who are in the queues for the E90, I admire your sense of endevour ! May the force be with you.

    02-Oct-200705:53 PM
    joevpt wrote:
    You'd think... Eh!
    What I found was that at various stages during the upgrade the NSU disconnects from the phone (which allows PC-Suite reconnect). When the NSU needs to reconnect, PC-Suite was holding onto the connection (because, I think, NSU only disconnects it once at the beginning... )
    Regards,
    Joe
    Patheticlly true.

  • So how bad is this?

    So today, for the first time in as long as I've owned my 2.0 GHz iMac G5, it just randomly shut down on me. I thought it was a one time thing, a power surge or something maybe, so I started it back up and went about my business. Then a few hours later, it happened again. And about 20 mins after that, again. By this point I knew something was up, so I backed up a couple vital files real quick, shut it down, and cracked it open.
    This is what I saw:
    http://img.photobucket.com/albums/v12/newtikki/DSC00185.jpg
    So, I figured it was overheating because of the symptoms, but that looks really bad. When I closed it back up, I felt the slit in the back and couldnt feel any air coming out the half that the CPU feeds to, however, the other half (which i presume is pumped from the video card) was pumping warm air. So, how can I resolve this? I bought it in probably June of last year, so I don't have any warranty remaining. How much is this going to cost me?
    Thanks,
    Michael
    iMac G5   Mac OS X (10.4.6)  

    Hi Michael,
    My bet is actually that your primary problem is that the power supply is failing, and that your fans just might be running poorly because of dirt buildup or lower power.
    Your Mac will cut out before heat doess any damage to the processor.
    There are three fans - one for the Hd, one for the processor , and one for the "system" generally. The HD fan is really the one that does the most work usually. Its "base" setting is at 2300 RPM, while the CPU one sits down around only 1500 when its not doing a lot of work. Its only under load that it kciks up higher, and even then it will rarely be running as fast as the HD fan.
    So you can almost always expect to feel a bit more breeze from the HD side than the processor side of the slot.
    The general system fan usually sits on about 1700 rpm until things really start to heat up.
    Cheers
    Rod

  • Need help - how to run this particular method in the main method?

    Hi all,
    I have a problem with methods that involves objects such as:
    public static Animal get(String choice) { ... } How do we return the "Animal" type object? I understand codes that return an int or a String but when it comes to objects, I'm totally lost.
    For example this code:
    import java.util.Scanner;
    interface Animal {
        void soundOff();
    class Elephant implements Animal {
        public void soundOff() {
            System.out.println("Trumpet");
    class Lion implements Animal {
        public void soundOff() {
            System.out.println("Roar");
    class TestAnimal {
        public static void main(String[] args) {
            TestAnimal ta = new TestAnimal();
            ta.get(); // error
            // doing Animal a = new Animal() is horrible... :(                   
        public static Animal get(String choice) {
            Scanner myScanner = new Scanner(System.in);
            choice = myScanner.nextLine();
            if (choice.equalsIgnoreCase("meat eater")) {
                return new Lion();
            } else {
                return new Elephant();
    }Out of desperation, I tried "Animal a = new Animal() ", and it was disastrous because an interface cannot be instantiated. :-S And I have no idea what else to put in my main method to get the code running. Need some help please.
    Thank you.

    Hi paulcw,
    Thank you. I've modified my code but it still doesn't print "roar" or "trumpet". When it returns a Lion or an Elephant, wouldn't the soundOff() method get printed too?
    refactored:
    import java.util.Scanner;
    interface Animal {
        void soundOff();
    class Elephant implements Animal {
        public void soundOff() {
            System.out.println("Trumpet");
    class Lion implements Animal {
        public void soundOff() {
            System.out.println("Roar");
    class TestAnimal {
        public static void main(String[] args) {
            Animal a = get();
        public static Animal get() {
            Scanner myScanner = new Scanner(System.in);
            System.out.println("Meat eater or not?");
            String choice = myScanner.nextLine();
            if (choice.equalsIgnoreCase("meat eater")) {
                return new Lion();
            } else {
                return new Elephant();
    }The soundOff() method should override the soundOff(); method in the interface, right? So I'm thinking, it should print either "roar" or "trumpet" but it doesn't. hmm..

  • How to access this.getNewNode() method within addTreeSelectionListener??

    Dear friends,
    I met anoother problem as follows:
    I defined a method called
    setNewNode(NewNode nn){
    getNewNode(){
    return nn;
    I tried to make regerence to this method:
    this.getNewNode();
    if I put this reference this.getNewNode(); outside of following code such as:
    this.getNewNode();
    tree.addTreeSelectionListener(new TreeSelectionListener() {
    everything fine,
    but If I put this.getNewNode(); within following code,
    so cannot pass compile, get error,
    tree.addTreeSelectionListener(new TreeSelectionListener() {
    this.getNewNode();
    now get error,
    How to make a successfule access to this method this.getNewNode() ??
    Thanks a lot.
    sunny
    //this.getNewNode();  // access ok
    tree.addTreeSelectionListener(new TreeSelectionListener() {
            public void valueChanged(TreeSelectionEvent evt) {
               // this.getNewNode();  // error, can not refer to this method.
                // Get all nodes whose selection status has changed
                TreePath[] paths = evt.getPaths();
                // Iterate through all affected nodes
                for (int i=0; i<paths.length; i++) {
                    if (evt.isAddedPath(i)) {
                        // This node has been selected
                    } else {
                        // This node has been deselected
        });

    good point, but it seems that
    OuterClassName.this.getNewNode() did not work,
    only OuterClassName.getNewNode() is acceptable.
    thanksThat indicates you must have made getNewNode() static. Glad it's working though...

  • Exactly how bad is this explain plan?

    Hi,
    I'm on Oracle 9i - 9.2.0.6.0.
    First, please excuse my question, I'm not that good at reading explain plans.
    I have this explain plan:
    | Id  | Operation                                 |  Name                      | Rows  | Bytes |TempSpc| Cost (%CPU)|                                                              
    |   0 | SELECT STATEMENT                          |                            | 70057 |    20M|       |   114K (12)|                                                              
    |*  1 |  FILTER                                   |                            |       |       |       |            |                                                              
    |   2 |   TABLE ACCESS FULL                       | DUAL                       |    82 |       |       |     3  (34)|                                                              
    |*  3 |   INDEX RANGE SCAN                        | CHANGELOG_1                |     1 |    44 |       |  2217   (3)|                                                              
    |   4 |  NESTED LOOPS OUTER                       |                            | 70057 |    20M|       |   114K (12)|                                                              
    |   5 |   NESTED LOOPS OUTER                      |                            | 67062 |    18M|       |   113K (11)|                                                              
    |   6 |    NESTED LOOPS OUTER                     |                            | 64194 |    16M|       |   111K (10)|                                                              
    |   7 |     NESTED LOOPS OUTER                    |                            | 61450 |    14M|       |   110K  (9)|                                                              
    |   8 |      NESTED LOOPS OUTER                   |                            | 58823 |    13M|       |   109K  (8)|                                                              
    |   9 |       NESTED LOOPS OUTER                  |                            | 56308 |    12M|       |   107K  (6)|                                                              
    |  10 |        NESTED LOOPS OUTER                 |                            | 53900 |    11M|       |   106K  (5)|                                                              
    |  11 |         NESTED LOOPS OUTER                |                            | 51596 |    10M|       |   105K  (4)|                                                              
    |  12 |          NESTED LOOPS OUTER               |                            | 49390 |  9212K|       |   104K  (3)|                                                              
    |  13 |           NESTED LOOPS OUTER              |                            | 47278 |  8310K|       |   102K  (2)|                                                              
    |* 14 |            HASH JOIN                      |                            | 31639 |  5067K|  4576K|  7331  (13)|                                                              
    |* 15 |             HASH JOIN                     |                            | 31639 |  4202K|  1936K|  1372   (9)|                                                              
    |  16 |              TABLE ACCESS FULL            | COMPANY                    | 76111 |  1040K|       |   335  (15)|                                                              
    |* 17 |              HASH JOIN                    |                            | 31649 |  3770K|       |   933   (7)|                                                              
    |  18 |               TABLE ACCESS FULL           | AGREEMENT                  |   149 |  3129 |       |     3  (34)|                                                              
    |* 19 |               HASH JOIN                   |                            | 31649 |  3121K|       |   928   (6)|                                                              
    |  20 |                TABLE ACCESS FULL          | CONCRETEAGREEMENT          | 34172 |   333K|       |    55  (24)|                                                              
    |* 21 |                TABLE ACCESS BY INDEX ROWID| SPECIFICATION              | 31649 |  2812K|       |   866   (4)|                                                              
    |* 22 |                 INDEX RANGE SCAN          | SPECIFICATION_DATE         | 37437 |       |       |   143   (5)|                                                              
    |  23 |             TABLE ACCESS FULL             | PERSON                     |  1786K|    47M|       |  4584  (11)|                                                              
    |* 24 |            TABLE ACCESS BY INDEX ROWID    | INFORMATION                |     1 |    16 |       |     4  (25)|                                                              
    |* 25 |             INDEX RANGE SCAN              | INFORMATION_SPECIFICATION  |     2 |       |       |     3  (34)|                                                              
    |* 26 |           TABLE ACCESS BY INDEX ROWID     | INFORMATION                |     1 |    11 |       |            |                                                              
    |* 27 |            INDEX RANGE SCAN               | INFORMATION_SPECIFICATION  |     2 |       |       |     3  (34)|                                                              
    |* 28 |          TABLE ACCESS BY INDEX ROWID      | INFORMATION                |     1 |    14 |       |            |                                                              
    |* 29 |           INDEX RANGE SCAN                | INFORMATION_SPECIFICATION  |     2 |       |       |     3  (34)|                                                              
    |* 30 |         TABLE ACCESS BY INDEX ROWID       | INFORMATION                |     1 |    14 |       |            |                                                              
    |* 31 |          INDEX RANGE SCAN                 | INFORMATION_SPECIFICATION  |     2 |       |       |     3  (34)|                                                              
    |* 32 |        TABLE ACCESS BY INDEX ROWID        | INFORMATION                |     1 |    11 |       |            |                                                              
    |* 33 |         INDEX RANGE SCAN                  | INFORMATION_SPECIFICATION  |     2 |       |       |     3  (34)|                                                              
    |* 34 |       TABLE ACCESS BY INDEX ROWID         | INFORMATION                |     1 |    13 |       |            |                                                              
    |* 35 |        INDEX RANGE SCAN                   | INFORMATION_SPECIFICATION  |     2 |       |       |     3  (34)|                                                              
    |* 36 |      TABLE ACCESS BY INDEX ROWID          | INFORMATION                |     1 |    12 |       |            |                                                              
    |* 37 |       INDEX RANGE SCAN                    | INFORMATION_SPECIFICATION  |     2 |       |       |     3  (34)|                                                              
    |* 38 |     TABLE ACCESS BY INDEX ROWID           | INFORMATION                |     1 |    15 |       |            |                                                              
    |* 39 |      INDEX RANGE SCAN                     | INFORMATION_SPECIFICATION  |     2 |       |       |     3  (34)|                                                              
    |* 40 |    TABLE ACCESS BY INDEX ROWID            | INFORMATION                |     1 |    17 |       |            |                                                              
    |* 41 |     INDEX RANGE SCAN                      | INFORMATION_SPECIFICATION  |     2 |       |       |     3  (34)|                                                              
    |* 42 |   TABLE ACCESS BY INDEX ROWID             | INFORMATION                |     1 |    17 |       |            |                                                              
    |* 43 |    INDEX RANGE SCAN                       | INFORMATION_SPECIFICATION  |     2 |       |       |     3  (34)|                                                              
    ---------------------------------------------------------------------------------------------------------------------                     I can see that there are some FULL TABLE SCAN, but this may be OK. What worries me is the combination with numerous NESTED LOOPS.
    A CTAS for approx 500.000 records out of 14.000.000 runs in about 180 mins. This is too much. My guess is that it should/could be brought down to something like 20 min.
    For completeness, the query in question:
    SELECT *
      FROM stik_spec_inf_v
    WHERE spdate >= to_date('15-03-2008', 'dd-mm-yyyy')
       AND spdate < to_date('15-04-2008', 'dd-mm-yyyy');Wher eview is created as
    CREATE OR REPLACE FORCE VIEW stik_spec_inf_v
    AS
       SELECT CAST(1 AS NUMBER(3)) dataversion
             ,sp.ID AS spid
             ,sp."DATE" AS spdate
             ,sp.valuedate
             ,sp.amount
             ,sp.amountcode
             ,sp.periodstart
             ,sp.periodend
             ,sp.ambcode
             ,sp.state AS spstate
             ,sp."TYPE" AS sptype
             ,sp.respitedate
             ,sp.stopcode
             ,sp.validcode
             ,sp.person
             ,sp.company
             ,sp.concreteagreement
             ,sp.reconciliation
             ,sp.partialscheme
             ,(SELECT 1
                 FROM dual
                WHERE EXISTS(
                         SELECT 1
                           FROM changelog
                          WHERE targetclass = 'com.csc.jpay.voucher.Specification'
                            AND targetid = sp.ID)) spchanged
             ,i1.startdate AS daekgagedato
             ,i1.amount AS daekgage
             ,i2.startdate AS prmgagedato
             ,i2.amount AS prmgage
             ,i3.employerpercent
             ,i3.employeepercent
             ,i3.voluntarypercent
             ,i5.salaryperiod
             ,i6.groupcontractcode
             ,i7.workinghourspercent
             ,i9.startdate AS hiringdate
             ,i10.startdate AS resignationdate
             ,i21.policenumber
             ,ix."TYPE" AS leavecode
             ,ix.startdate AS leavestartdate
             ,ix.enddate AS leaveenddate
             ,pe.cpr
             ,pe.ksdid
             ,co.opkr_number
             ,a.NAME AS agreement_name
         FROM SPECIFICATION sp
             ,information i1
             ,information i2
             ,information i3
             ,information i5
             ,information i6
             ,information i7
             ,information i9
             ,information i10
             ,information i21
             ,information ix
             ,person pe
             ,company co
             ,concreteagreement ca
             ,agreement a
        WHERE 1 = 1
          AND i1.SPECIFICATION(+) = sp.ID
          AND i1."TYPE"(+) = 1
          AND i2.SPECIFICATION(+) = sp.ID
          AND i2."TYPE"(+) = 2
          AND i3.SPECIFICATION(+) = sp.ID
          AND i3."TYPE"(+) = 3
          AND i5.SPECIFICATION(+) = sp.ID
          AND i5."TYPE"(+) = 5
          AND i6.SPECIFICATION(+) = sp.ID
          AND i6."TYPE"(+) = 6
          AND i7.SPECIFICATION(+) = sp.ID
          AND i7."TYPE"(+) = 7
          AND i9.SPECIFICATION(+) = sp.ID
          AND i9."TYPE"(+) = 9
          AND i10.SPECIFICATION(+) = sp.ID
          AND i10."TYPE"(+) = 10
          AND i21.SPECIFICATION(+) = sp.ID
          AND i21."TYPE"(+) = 21
          AND ix.SPECIFICATION(+) = sp.ID
          AND ix."TYPE"(+) > 10
          AND ix."TYPE"(+) < 21
          AND pe.ID = sp.person
          AND co.ID = sp.company
          AND ca.ID = sp.concreteagreement
          AND a.ID = ca.agreement;Please excuse my lengthy post. I still hope for some valuable input.
    Thanks
    Peter

    Hi,
    I have tried with an in-line view as John suggested. This give a FULL TABLE SCAN on information.
    SELECT /*+ RULE */ * FROM (
        SELECT sp.id spid, sp."DATE" spdate
         FROM (SELECT   SPECIFICATION
                       ,max(decode("TYPE", 1, startdate)) daekgagedato
                       ,max(decode("TYPE", 1, amount)) daekgage
                       ,max(decode("TYPE", 2, startdate)) prmgagedato
                       ,max(decode("TYPE", 2, amount)) prmgage
                       ,max(decode("TYPE", 3, employerpercent)) employerpercent
                       ,max(decode("TYPE", 3, employeepercent)) employeepercent
                       ,max(decode("TYPE", 3, voluntarypercent)) voluntarypercent
                       ,max(decode("TYPE", 5, salaryperiod)) salaryperiod
                       ,max(decode("TYPE", 6, groupcontractcode)) groupcontractcode
                       ,max(decode("TYPE", 7, workinghourspercent)) workinghourspercent
                       ,max(decode("TYPE", 9, startdate)) hiringdate
                       ,max(decode("TYPE", 10, startdate)) resignationdate
                       ,max(decode("TYPE", 21, policenumber)) policenumber
                       ,max(decode(sign("TYPE" - 10),1, decode(sign("TYPE" - 21), -1, "TYPE"))) leavecode
                       ,max(decode(sign("TYPE" - 10),1, decode(sign("TYPE" - 21), -1, startdate))) leavestartdate
                       ,max(decode(sign("TYPE" - 10),1, decode(sign("TYPE" - 21), -1, enddate))) leaveenddate
                   FROM information
                  WHERE TYPE BETWEEN 1 AND 21
               GROUP BY SPECIFICATION) i
             ,SPECIFICATION sp
        WHERE 1 = 1
          AND sp.ID = i.SPECIFICATION)
    WHERE spid = 1Any ideas on how to get around that?
    Regards
    Peter

  • How to code this : LE_SHIPMENT_BADI : method : At_Save

    Hi Friends:
    I'm working on LE_SHIPMENT_BADI. In the method At_Save, I've written the following code:
    METHOD if_ex_badi_le_shipment~at_save.
    This is just an additional check to ensure the following requirement:
    If the ship-to-party begins with XX, then Shipment type should be 'ZSTO'.
    If the ship-to-party doesn't begins with XX, then Shipment type should be '0001'.
      CONSTANTS : c_zsto  TYPE vttkvb-shtyp VALUE 'ZSTO',  "Constant for shipment type ZSTO
                  c_0001  TYPE vttkvb-shtyp VALUE '0001',  "Constant for shipment type 0001
                  c_xx(2) TYPE c            VALUE 'XX'.    "Constant for the first 2 characters of Ship-to-party
      DATA : v_kunwe TYPE vtrlk-kunwe,
             v_shp   TYPE vttkvb-shtyp,
             v_vttk  TYPE vttkvb.
      FIELD-SYMBOLS : <fs>    TYPE vtrlk.
    This provision is made if the internal table CHA_SHIPMENTS_AT_SAVE
    is initial, which is generally not the case. If such case is observed
    the the below mentioned code can be used.
    *if CHA_SHIPMENTS_AT_SAVE is initial.
    *CHA_SHIPMENTS_AT_SAVE = IM_shipments_AT_SAVE.
    *endif.
      READ TABLE cha_shipments_at_save-new_vtrlk ASSIGNING <fs> WITH KEY kunwe+0(2) = c_xx.
      IF sy-subrc = 0.
        v_shp = c_zsto.
      ELSE.
        v_shp = c_0001.
      ENDIF.
      v_vttk-shtyp = v_shp.
      MODIFY cha_shipments_at_save-new_vttk
             FROM v_vttk TRANSPORTING shtyp
             WHERE shtyp <> v_shp.
    ENDMETHOD
    Now I have to put one more check in it. There is a field LFART in table VTRLK . I want the above coding to work only when LFART = LF, ZLF, LR and ZLR. Please help me in implementing this.
    Suitable points will be Rewarded.
    Regards:

    Hello,
    If you have the values for LFART then simply check loke:
    CHECK ( lfart = 'XX'  or lfart = 'YY').
    and here check for the other condition,
    Regards,
    Sandeep

  • Another battery expansion... How bad is this?

    I was using my faithful MacBook Pro 17" to watch a 1080p video on my 42" LCD television, when I noticed that book was lifting up awkwardly. I turned it over and was startled to see the battery bulging from the laptop.
    At first I was startled and turned the system off, then proceeded to remove the battery. I googled for similar situations and found it was more common than I would have expected.
    It is a few few years old (I think it's an '08) model. What steps should or can I take regarding this situation; Is this covered by Apple or will I have to "bite the bullet" here and buy a new battery?

    Has this really happened? Having spoken with multiple "Authorized Apple" technicians, I'm told that this is an isolated issue that is usually replaced after a phone call to Apple. Well, I've phoned Apple after being sent BY Apple to these technicians.
    The result? I was told about all the customers that got free batteries for the same exact problem. In fact, I was told they were outside of their warranty period, AND did not require extended "AppleCare" due to the nature of this odd and rare occurrence. Furthermore, I was told that these batteries were replaced within three years from the date of purchase.
    My laptop is NOT older than three years.
    My laptop has been in the repair shop within the last few months already, and now my "laptop" cannot even leave the proximity of its power cord.
    I think I may be beginning to lose faith in the Apple brand.

  • Keyword Search in Bug Toolkit - How effective is this search method for you?

    When searching by keyword(s) in Bug Toolkit, do you receive relevant results or do you often have to redo your search?  Any specifics you can provide would be helpful!

    When searching by keyword(s) in Bug Toolkit, do you receive relevant
    results or do you often have to redo your search?  Any specifics you
    can provide would be helpful!
    Hi,
    With my experience i need to redo the search and very rarely i get in first attempt.But onething sure with previous experience bug tool kit search is good now at least it provides results with asked key word and search results are fast also.
    Ganesh.H

  • How to implement classes and methods in badi's ?

    how to implement classes and methods in badi's? and where i have to write the code based on the requirement?can anyone explain me briefly?

    Hi
    Every BADI by default Implements an INTERFACE which already contains some methods with parameters.
    So you have to find the relavenet method based on the related paramters (by checking the fields in that paramters) you have to double click on the method and to write the code.
    see the doc
    DEFINING THE BADI
    1) execute Tcode SE18.
    2) Specify a definition Name : ZBADI_SPFLI
    3) Press create
    4) Choose the attribute tab. Specify short desc for badi.. and specify the type :
    multiple use.
    5) Choose the interface tab
    6) Specify interface name: ZIF_EX_BADI_SPFLI and save.
    7) Dbl clk on interface name to start class builder . specify a method name (name,
    level, desc).
    Method level desc
    Linese;ection instance methos some desc
    8) place the cursor on the method name desc its parameters to define the interface.
    Parameter type refe field desc
    I_carrid import spfli-carrid some
    I_connid import spefi-connid some
    9) save , check and activate…adapter class proposed by system is
    ZCL_IM_IM_LINESEL is genereated.
    IMPLEMENTATION OF BADI DEFINITION
    1) EXECUTE tcode se18.choose menuitem create from the implementation menubar.
    2) Specify aname for implementation ZIM_LINESEL
    3) Specify short desc.
    4) Choose interface tab. System proposes a name fo the implementation class.
    ZCL_IM_IMLINESEL which is already generarted.
    5) Specify short desc for method
    6) Dbl clk on method to insert code..(check the code in “AAA”).
    7) Save , check and activate the code.
    Some useful URL
    http://www.esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt
    http://www.esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf
    http://www.esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc
    http://www.esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc
    www.sapgenie.com/publications/saptips/022006%20-%20Zaidi%20BADI.pdf
    http://www.sapdevelopment.co.uk/enhance/enhance_badi.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm
    Now write a sample program to use this badi method..
    Look for “BBB” sample program.
    “AAA”
    data : wa_flights type sflight,
    it_flights type table of sflight.
    format color col_heading.
    write:/ 'Flight info of:', i_carrid, i_connid.
    format color col_normal.
    select * from sflight
    into corresponding fields of table it_flights
    where carrid = i_carrid
    and connid = i_connid.
    loop at it_flights into wa_flights.
    write:/ wa_flights-fldate,
    wa_flights-planetype,
    wa_flights-price currency wa_flights-currency,
    wa_flights-seatsmax,
    wa_flights-seatsocc.
    endloop.
    “BBB”
    *& Report ZBADI_TEST *
    REPORT ZBADI_TEST .
    tables: spfli.
    data: wa_spfli type spfli,
    it_spfli type table of spfli with key carrid connid.
    *Initialise the object of the interface.
    data: exit_ref type ref to ZCL_IM_IM_LINESEL,
    exit_ref1 type ref to ZIF_EX_BADISPFLI1.
    selection-screen begin of block b1.
    select-options: s_carr for spfli-carrid.
    selection-screen end of block b1.
    start-of-selection.
    select * from spfli into corresponding fields of table it_spfli
    where carrid in s_carr.
    end-of-selection.
    loop at it_spfli into wa_spfli.
    write:/ wa_spfli-carrid,
    wa_spfli-connid,
    wa_spfli-cityfrom,
    wa_spfli-deptime,
    wa_spfli-arrtime.
    hide: wa_spfli-carrid, wa_spfli-connid.
    endloop.
    at line-selection.
    check not wa_spfli-carrid is initial.
    create object exit_ref.
    exit_ref1 = exit_ref.
    call method exit_ref1->lineselection
    EXPORTING
    i_carrid = wa_spfli-carrid
    i_connid = wa_spfli-connid.
    clear wa_spfli.
    Reward points for useful Answers
    Regards
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • PSP_PNR - how to get this fields in BADI of NME52N

    I have to find the value of the field "WBS element"-PSP_PNR in Tab Account Assignment of transaction ME52N.
    User exit MBCF0005 should give me the data from EKKN, which includes
    this field. However, the transaction ME52N doesn't stop in the User EXIT by break-point statment.
    How can I get the value of this field?
    BADI ME_PROCESS_REQ_CUST 
    both check methods and
    Process account is also checked
    no result
    Kindly help me

    Not getting replies.
    closing thread

  • Hi Experts, how add a column to MD04 via BADI or some other method?

    Hi Experts,
    the recommended BADI is MD_ADDD_COL_EZPS.
    I am working on a requirement about adding a column to MD04(when you input /nMD04 in the system you will see two tabs, one is Individual access and the other is Collective access), for the Individual access you input material and plant and press 'Enter', you will see a alv-like list about the material, I want to add a column next to the current last column(Available qty), so can anyone tell me how to solve this? thank you in advance!
    Kind regards
    Dawson

    Hi ,
    if u want to add a column in table control , you can not do using User exit or badi .
    for this u need developer access key , without developer access key , u can not add.
    Thanks
    Shambhu

  • I plug my iPhone 3gs into my laptop and it no longer syncs with my iTunes.  Ive tried all the trouble shooting methods and nothing works.  My iPhone doesnt appear on iTunes or under "my computer." Does anyone know how to fix this?

    I plug my iphone 3gs into my laptop and it no longer syncs with my iTunes.  I've tried all the trouble shooting methods and nothing works.  My iPhone doesn't appear on iTunes or under "My Computer." Does anyone know how to fix this?

    If AMDS is running, you are using a USB port directly on the computer and not a hub, you have disconnected other USB devices except keyboard and mouse, you have completely uninstalled and reinstalled iTunes as described in http://support.apple.com/kb/HT1925, You have tried cleaning the connector on the bottom of the phone, you have tried a different cable, you have installed the latest USB drivers for your computer, you have disabled your antivirus and firewall, you are running as an Administrator account and you have tried creating a new user on your computer and connected when logged in as that user then you have exhausted my knowledge. The only other thing to try is a different computer. If it isn't recognized on a different computer you have a hardware problem. Good luck!

Maybe you are looking for

  • Why do I get duplicate events in iCal when I input them on my iPhone?

    Every time I add a new event on my iPhone (as opposed to my iPad or desktop) I get a duplicate entry. This started to occur a few days ago for no apparent reason. This does not happen if I input the event on any other device. Is there a way to solve

  • Notes on Partial payments

    Hi guys, Here is the issue, the accounting clerk creates a note on a line item of a customer open item using DMC (deduction management component) with action codes and a partial payment has been paid by the customer on the same invoice and since a ne

  • Failed in JMF diagnostics in netscape browser 7

    I installed J2sdk 1.4.3 and jmf2.1.1e in Redhat Linux 7.3 and following their installation instruction to set up some environment variables. However I encountered two problems in configuring JMF. One is that when I configured the jmf-2_1_1e-linux-i58

  • Strange fan problem

    Whenever I plug my MBP into an external monitor (Apple brand), the fans go to 6,000rpm (basically max speed) and stay there. I've checked the core temperature and it's only about 60-65 celsius so there's not need for the fans to max out. I've also lo

  • AE CS6 keeps crashing upon opening

    Hi All, AE CS6 seemed to be working fine until last week and now I get the error message below and it shuts down. I cannot get it to work at all. Funny thing is I can still open AE CS4 and it works fine. I do not think I added anything to my system s