Code Structure Problem

My description really isn't that great, i found it quite difficult to explain so please ask if you have any more questions.
I have an Abstract class Called Animal, and two subclasses of this (which obviously extend Animal). The animal class implements an actor interface class called Actor in which there are 2 methods defined, one called act and the other called isAlive() .
My programme does a simulation of wild life, one of the animals kills the other (only 2 at the moment) and this was already implemented by the teacher, our job now is to do a few tasks which i have previously done and now the second to last task is to create a hunter.
The principle is that this new Hunter must define a new actor, ie an implementation of Actor(which means my new class Hunter has to implement the Actor class?)and must be a non animal, i chose a human, though it could have been the weather or some other scenario.
I based the new class on that of the hunter of the two animals.This is fine and it works, however i have some serious code duplication between the Hunter class and one of the animal classes of which i can see no solution too, this worries me as code duplication isn't good and i was hoping maybe someone could help me out with some tips for potential changes to the structure.
Regards

and must be a non animal, i chose a human, So are you claiming to be a mineral, or a maybe vegetable? Of course humans are Animals! This simple fact of reality invalidates your current model, leading to code duplication.
I suggest that you chose another scenario... Fire is-a Killer... I suppose one could define Fire in terms of an Actor having methods: act and isAlive ... fires burn and kill, and then they go out.
Edit:
Poignant at [the moment|http://images.google.com/images?q=victorian+bushfires].
could anyone point me to the java tutorials on delegation please?Ummm... I'm unaware of any... but the general idea is certainly explained by many online resources... google for "delegate pattern"... and yes (IMHO) that's a preferable solution your code duplication woes than defining some dodgy abstract super class... because type inheritance (interfaces) is more flexible than implementation inheritance (classes).
Cheers. Keith.
Edited by: corlettk on 1/03/2009 22:33 ~~ Typos, and stuff.

Similar Messages

  • IMac (March 2009) - Invalid Node Structure problem

    Hi All
    I was using my iMac as normal yesterday, when suddenly the system ground to a halt (something I never seen since using OS X). As I had work to do, after about an hour, I restarted, expecting it to be an app misbehaving or something straight forward, but on restart the same thing happened almost straight away.
    So, I restarted again, only for the iMac to get stuck on the blue screen which follows the grey 'cog' screen. After looking through these discussions, and some other Mac forums, I booted from the installer disk, tried to run Disk Utility, which found issues and couldn't repair the disk.
    I then tried Safe-User mode and fsck, which reported the aforementioned Invalid Node Structure problem. After checking a few more forums, I thought I would try to Erase the disk and reinstall Mac OS. I restored from my Time Machine backup, and finally got it to start, but the system moved at a snail's pace, and wouldn't open any apps or files.
    I've tried again with fsck, and also fsck_hfs -r /dev/disk0s2 but all I get is the same error message:
    disk0s2: I/O error.
    Invalid Node Structure
    (4, 38403)
    ** Volume check failed.
    /dev/rdisk0s2 (hfs) EXITED WITH SIGNAL 8
    So, does anyone know if there is anything I can do to save the iMac? Or does it need a new HD? It is my primary work computer, so I really need to get it back, and after buying it in the UK, am now in France for 6 weeks, so it's difficult for me to take it to an Apple specialist.
    Any help would be greatly appreciated, thanks in advance,
    Daniel

    As the last user stated, Disk Warrior maybe able to correct it, however if you search the net, you will see there are more than one user with this problem. I had the same problem, however, my machine is out of warranty, It started like you are saying, I RAN disk warrior which corrected the problem long enough to boot the system. In a matter of 10 minutes or so, the system started pausing (apps hung, but in a matter of seconds recovered). I was checking the disk with fsck_hfs and fsck while booted from a USB drive with a maintenance install of 10.5.6. After running fsck the 5th time with different options suggested from the internet, I rebooted with my disk warrior DVD only to find the drive NOT mounted, Drive utility see's it (even can attempt to run disk repair, but it locks up the system when trying this). Disk Warrior doesn't even see the disk to run a directory repair, although in the "check s.m.a.r.t status it sees it as a sata device, and SAYS ITS NORMAL).
    Since my iMac was out of warranty, I followed the online instructions to replace the hard drive (not too difficult) and everything is fine now.
    The old drive still wont mount, but another utility I bought (data rescue II) has been able to quick scan it and access all the data, even though it wont clear a fsck fsck_hfs or disk warrior, anyways, get it back while you can, IT IS THE hard drive itself, and lots of other iMac users online with the same issue (can you say WHY is my iMac SOOO HOT on the apple in the back (right where the drive is and not sufficient cooling in my opinion, but hey, some people might want to lay their computers face down and fry eggs on the it or something... ))
    -SD

  • Hot Code Replace Problem...

    Hi Everyone,
    I am using WebLogic 10 with Eclipse. Whenever i start the server in debug mode and make two three changes in the code... WHAM.... I get the Hot Code Replace error. Is there any way so that the server can keep up with the code changes. Publishing the app again takes approx 40 mins!

    Almost always this is a limitation of the JRE/JDK you are using and really
    nothing to do with Eclipse.
    Try a different VM and see if you have better luck
    HTH
    Darins
    "bobz" <[email protected]> wrote in message
    news:75257188f239cb376da31e19b214d2d9$[email protected]..
    > hi buddies,
    >
    > i am getting "hot code replace" problem whenever i change my
    > java code and build the project and access the website without re-starting
    > the server. so, finally i endup with re-starting the server whenever i
    > change the code. this consumes a lot of time. is there any possibility to
    > work without re-starting the server even after the code change.
    >
    > regards,
    > satish.

  • Hi,  We use a Mac os window. How can we get Adobe error code 16 problems in premier cs5. Before 6 da

    Hi,
    We use a Mac os window. How can we get Adobe error code 16 problems in premier cs5. Before 6 days premier does not loaded a Audio.
    please help me.

    I think you are posting to the wrong forum.  I'd post this in the Premier forum: http://forums.adobe.com/community/premiere/premierepro_current
    -Carl V.

  • Compile class file, check for code structure quality

    now i am trying to develop a system for my college final year project..the main function is to help the lecturer to mark the student java assignment
    any way to compile the java file..just to check for the error? if got error then 0 mark..no error got mark..and then check for the code structure and so...base on that ..to decide the student mark..like if good structure 20 mark..bad? 5 mark and so.
    is it possible to do so?
    Junit?
    any sample?

    Checking for errors is easy, just write a script to check if javac completed successfully. You can use similar approaches (possibly needing to parse the output) for jlint/PMD/whatever to check code structure. If there's any custom checks you want to do, though, I suggest you grab a parser (possibly witgh semantic analysis; I've found the Eclipse one is rather easily extracted and is good for this stuff) and write manual checks. It might be easier to write PMD rules, but you won't have the flexibility.

  • GL code Structure

    Dear gurus
    We are going for upgradation from 4.7E to ECC 6.0, in this we would like to convert GL Code structure(6 digit) to 8 digit Structure.
    Is it possible in ECC 6.0, if so, what r the consequence generally face.
    Can we create new GL Structure and can be transferred from 6 digit structure to 8 digit GL Code strucutre
    regards

    Hi,
    I give below my views :
    The chart of Account will hold upto 10 digits.
    You have to change the interval in OBD4 if you have given only 6 digit for accounts groups.
    The transaction data with old GL account numbers cannot be changed.
    The financial statement version derived so will have two accounts with same description.
    All the automatic account assignment has to be changed with new numbers.
    All the primary cost element numbers and the relative assignments in CO area has to be changed.
    The cut off date can be fixed as 31.03.2010 to enable you to take the balance sheet with old gl
    account numbers and thereafter upload the balances in new version is preferred.
    Regards,
    Sadashivan

  • Determining Code Structure

    Does anybody know if there is a way to determine the code structure (variables, statements, loops) of a pl/sql program unit (package, function, procedure, etc)?
    There are some code editors (e.g. PL/SQL developer) that makes avaliable a code structure window and a conventional code editor window. These windows are usually connected, so when you cilck on an item of the code structure window, the matching lines on the code editor window are highlighted.
    How does those kind of code editors determine the structure of a program unit? Do they have a client-side parser to read and analyze source code. Is there any Oracle API to get this information?
    Edited by: user630459 on 12/05/2009 05:10
    Edited by: user630459 on 12/05/2009 05:13
    Edited by: user630459 on 12/05/2009 06:05
    Edited by: user630459 on 12/05/2009 06:06

    Thanks, but unfortunetaly we use Oracle 10g Release 2. Since there aren't other options, I think I'll have to parse source code. I'm going to use an automatic paser generator (e.g. ANTRL framework) to save me from language processing stuff. Do you kown where I could find the PL/SQL Grammar?
    Edited by: user630459 on 12/05/2009 10:35
    Edited by: user630459 on 12/05/2009 10:36
    Edited by: user630459 on 12/05/2009 12:56
    Edited by: fadc80 on 13/05/2009 04:38
    Edited by: fadc80 on 13/05/2009 04:56

  • Code inspector problem

    Hi all,
    I'm checking the syntax before to release my order requests and I have several errors in code inspector.
    Ok, I've fixed these errors. The problem is if I execute the code inspector again the errors are displayed again... but the code is ok, there are no errors.
    It happened to me a lot of times, with several object types, may be the next day if I pass the code inspector the errors dissapears or may be not.
    It's very strange. I've tried with other users, doing log off and login again... but nothing...
    Do you know if exits some transaction code for "refresh" the code inspector? the buffer or something?
    Thanks in advance.

    Hi,
    I've worked with code inspector quite a lot and I've never spoted this kind of problem. I would suspect that this is not code inspector problem but rather something is wrong with your repository objects.
    If I were you I would try to debug code inspector. There is somewhere inside SCAN ABAP-SOURCE command used. Check what input is being used.
    BR
    Marcin Cholewczuk

  • HT203977 is there any way to restore factory settings on an Iphone 5s that will not connect to Itunes because the phone is locked with a pass code.  Problem is that the screen is completely shattered.

    is there any way to restore factory settings on an Iphone 5s that will not connect to Itunes because the phone is locked with a pass code.  Problem is that the screen is completely shattered.

    If the screen is completely shattered why bother to try and restore the phone?
    Forgot passcode for your iPhone, iPad, or iPod touch, or your device is disabled - Apple Support

  • GDE - function module.. code .. problem

    hi all,
    I am extracting data using FM
    from PAYR and REGUH.
    I need:
    Payr
    doc1 ven01.........filds.a b c.
    doc2 ven02.........filds..
    doc3 ven02.........filds..
    doc4 ven03.........filds..
    My Fm is working fine.
    I need from REGUH:
    doc1 ven01.........filds p q r..
    doc2 ven02.........filds..
    doc3 ven02.........filds..
    doc4 ven03.........filds..
    doc5 ven05.........filds..
    doc6 ven06.........filds..
    doc5 and Doc6 not there in Payr table. finally i need 6 records with a, b,c, p, q, r
    I wrote code:
    ========
    error : It returns dump..
    saying : INDEX problem..?
    Modify e_t_data index sy-tabix.
    FUNCTION z_biw_payr_get_data .
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(I_REQUNR) TYPE  SRSC_S_IF_SIMPLE-REQUNR
    *"     VALUE(I_DSOURCE) TYPE  SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
    *"     VALUE(I_MAXSIZE) TYPE  SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
    *"     VALUE(I_INITFLAG) TYPE  SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
    *"     VALUE(I_READ_ONLY) TYPE  SRSC_S_IF_SIMPLE-READONLY OPTIONAL
    *"     REFERENCE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT
    *"       SBIWA_C_FLAG_OFF
    *"  TABLES
    *"      I_T_SELECT TYPE  SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
    *"      I_T_FIELDS TYPE  SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
    *"      E_T_DATA STRUCTURE  ZBIW_AP_PAYR OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
    Example: DataSource for table SFLIGHT
      TABLES: payr.
    Auxiliary Selection criteria structure
      DATA: l_s_select TYPE srsc_s_select.
    Maximum number of lines for DB table
      STATICS: s_s_if TYPE srsc_s_if_simple,
    counter
              s_counter_datapakid LIKE sy-tabix,
    cursor
              s_cursor TYPE cursor.
    *internal tables:
    I_payr like payr occurs 0 with header line.
    I_reguh like reguh occurs 0 with header line.
    Select ranges
      RANGES: l_r_gjahr   FOR zap_payr-gjahr,
              l_r_vblnr   FOR zap_payr-vblnr,
              l_r_zbukr   FOR zap_payr-zbukr.
    Initialization mode (first call by SAPI) or data transfer mode
    (following calls) ?
      IF i_initflag = sbiwa_c_flag_on.
    Initialization: check input parameters
                    buffer input parameters
                    prepare data selection
    please Check DataSource validity
        CASE i_dsource.
          WHEN 'ZAP_PAYR'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE e009(r3). ENDIF.
    this is a typical log call. Please write every error message like this
            log_write 'E'                  "message type
                      'R3'                 "message class
                      '009'                "message number
                      i_dsource   "message variable 1
                      ' '.                 "message variable 2
            RAISE error_passed_to_mess_handler.
        ENDCASE.
        APPEND LINES OF i_t_select TO s_s_if-t_select.
    Fill parameter buffer for data extraction calls
        s_s_if-requnr    = i_requnr.
        s_s_if-dsource = i_dsource.
        s_s_if-maxsize   = i_maxsize.
    Fill field list table for an optimized select statement
    (in case that there is no 1:1 relation between InfoSource fields
    and database table fields this may be far from beeing trivial)
        APPEND LINES OF i_t_fields TO s_s_if-t_fields.
      ELSE.                 "Initialization mode or data extraction ?
    Data transfer: First Call      OPEN CURSOR + FETCH
                   Following Calls FETCH only
    First data package -> OPEN CURSOR
        IF s_counter_datapakid = 0.
    Fill range tables BW will only pass down simple selection criteria
    of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
          LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'GJAHR'.
            MOVE-CORRESPONDING l_s_select TO l_r_gjahr.
            APPEND l_r_gjahr.
          ENDLOOP.
          LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'VBLNR'.
                  MOVE-CORRESPONDING l_s_select TO l_r_vblnr.
            APPEND l_r_vblnr.
          ENDLOOP.
          LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'ZBUKR'.
            MOVE-CORRESPONDING l_s_select TO l_r_zbukr.
            APPEND l_r_zbukr.
          ENDLOOP.
    Determine number of database records to be read per FETCH statement
    from input parameter I_MAXSIZE. If there is a one to one relation
    between DataSource table lines and database entries, this is trivial.
    In other cases, it may be impossible and some estimated value has to
    be determined.
    Extracts from Tableu2026..1
          OPEN CURSOR WITH HOLD s_cursor FOR
          SELECT mandt zbukr hbkid hktid rzawe chect checf laufd laufi lifnr
            kunnr empfg ubhkt vblnr gjahr zaldt waers rwbtr strgb pridt
            priti prius xmanu xbanc bancd extrd extrt xbukr zanre znme1
            znme2 znme3 znme4 zpstl zort1 zstra zpfac zland zregi zbnks
            zbnkn zbnkl zbkon voidr voidd voidu checv hbkiv hktiv zpst2
            xragl pernr seqnr btznr rec_belnr rec_gjahr zpfor uzawe ichec
            irefe rwskt
          FROM  payr
          WHERE zbukr  IN l_r_zbukr
                AND   vblnr  IN l_r_vblnr
          AND   gjahr  IN l_r_gjahr.
        AND   rzawe  EQ 'C'.
        ENDIF.                             "First data package ?
    Fetch records into interface table.
      named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR s_cursor
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE e_t_data
                   PACKAGE SIZE s_s_if-maxsize.
        IF sy-subrc <> 0.
          CLOSE CURSOR s_cursor.
          RAISE no_more_data.
        ENDIF.
    **get all u2018Du2019 and 2 series VBLNR records from REGUH
    _** --- CHECK the codes for WITH CASE 1 OR CASE 2._
    Case 1 :
    *Select * from reguh*
         Into corresponding fields of table i_reguh
         For all entries in e_t_data
         Where lifnr = e_t_data-lifnr
          And  rzawe = u2018Du2019
          and  Vblnr like u20182%u2019.
    Or u2026u2026 Or u2026u2026 Or u2026u2026
    Case2 :
    *Select * from reguh*
         Into corresponding fields of table i_reguh
         Where rzawe = u2018Du2019
          and  Vblnr like u20182%u2019.
    Loop at e_t_data.
      Read table i_reguh with key lifnr = e_t_data-lifnr
        If sy-subrc = 0.
          E_t_data-laufi  like reguh- laufi.
          E_t_data-Zbukr like reguh-zbukr.
          E_t_data-lifnr like reguh- lifnr .
          E_t_data-empfg like reguh- empfg.
          E_t_data-vblnr  like reguh-vblnr
          E_t_data-waers like reguh-waers
          E_t_data-srtgb like reguh-srtgb.
          E_t_data-znme1 like reguh- znme1.
          E_t_data-znme2  like reguh- znme2.
          E_t_data-znme3 like reguh- znme3.
          E_t_data-znme4 like reguh- znme4.
          E_t_data-zpstl like reguh-zpstl.
          E_t_data-zort1   like reguh-zortl.
          E_t_data-zstra like reguh-zstra.
          E_t_data-zpfac like reguh-zpfac.
          E_t_data-zland like reguh-zland.
          E_t_data-zregi like reguh-zregi.
          E_t_data-zbnkl like reguh-zbnkl.
          E_t_data-rzawe like reguh-rzawe.
          E_t_data-hktid like reguh-hktid.
          E_t_data-hbkid like reguh-hbkid.
          E_t_data-zpst2 like reguh-zpst2.
          E_t_data-uzawe like reguh-uzawe.
                E_t_data-pernr like reguh-pernr.
         E_t_data-btznr like reguh-btanr.
         E_t_data-laufd like reguh-laufd.
         E_t_data-zaldt like reguh-zaldt.
         E_t_data-rwbtr like reguh-rwbtr.
         E_t_data-rwskt like reguh-rwskt.
         Modify e_t_data index sy-tabix.
    Else.
         E_t_data-laufi  like reguh- laufi.
                E_t_data-Zbukr like reguh-zbukr.
         E_t_data-lifnr like reguh- lifnr .
         E_t_data-empfg like reguh- empfg.
         E_t_data-vblnr  like reguh-vblnr
         E_t_data-waers like reguh-waers
         E_t_data-srtgb like reguh-srtgb.
         E_t_data-znme1 like reguh- znme1.
         E_t_data-znme2  like reguh- znme2.
         E_t_data-znme3 like reguh- znme3.
         E_t_data-znme4 like reguh- znme4.
         E_t_data-zpstl like reguh-zpstl.
         E_t_data-zort1   like reguh-zortl.
         E_t_data-zstra like reguh-zstra.
         E_t_data-zpfac like reguh-zpfac.
         E_t_data-zland like reguh-zland.
         E_t_data-zregi like reguh-zregi.
         E_t_data-zbnkl like reguh-zbnkl.
         E_t_data-rzawe like reguh-rzawe.
         E_t_data-hktid like reguh-hktid.
         E_t_data-hbkid like reguh-hbkid.
         E_t_data-zpst2 like reguh-zpst2.
         E_t_data-uzawe like reguh-uzawe.
         E_t_data-pernr like reguh-pernr.
         E_t_data-btznr like reguh-btanr.
         E_t_data-laufd like reguh-laufd.
         E_t_data-zaldt like reguh-zaldt.
         E_t_data-rwbtr like reguh-rwbtr.
         E_t_data-rwskt like reguh-rwskt.
    Modify e_t_data index sy-tabix.
    Endif.
    Endloop.
    Logic for eliminating voided Checks Begin
        itab[] = e_t_data[].
        SORT itab BY chect.
        LOOP AT itab WHERE ( voidu NE space ) AND ( voidd NE space ).
          wa_idx = sy-tabix.
          wa_chect = itab-chect. CLEAR wa_found.
                wa_zbukr = itab-zbukr.
          wa_hbkid = itab-hbkid.
          wa_hktid = itab-hktid.
          wa_rzawe = itab-rzawe.
          DO.
            SELECT SINGLE * FROM payr WHERE
            zbukr = wa_zbukr AND
            hbkid = wa_hbkid AND
            hktid = wa_hktid AND
            rzawe = wa_rzawe AND
            chect = wa_chect.
            IF sy-subrc NE 0.
    Not transferring this record to BW
          message 'Invalid Check No.' type 'I'.
              DELETE itab.
              wa_found = 'Y'. EXIT.
            ENDIF.
            IF ( payr-voidu NE space ) AND ( payr-voidd NE space ).
              wa_chect = payr-checv.
              wa_zbukr = payr-zbukr.
              wa_hbkid = payr-hbkid.
                        wa_hktid = payr-hktid.
              wa_rzawe = payr-rzawe.
    If the Replacement Check # points to Original Check No., this record
    will be skipped.
              IF itab-chect = payr-checv.
                DELETE itab INDEX wa_idx.
                EXIT.
              ENDIF.
            ELSE.
              MOVE-CORRESPONDING payr TO itab.
              APPEND itab. wa_found = 'Y'.
              MOVE-CORRESPONDING itab TO itab1.
              APPEND itab1.
              EXIT.
            ENDIF.
            IF wa_found = 'Y'.
              EXIT.
            ENDIF.
          ENDDO.
        ENDLOOP.
        SORT itab by zbukr hbkid hktid rzawe chect.
            DELETE ADJACENT DUPLICATES FROM itab COMPARING zbukr hbkid hktid
        rzawe chect.
        LOOP AT itab1.
          READ TABLE itab WITH KEY
          zbukr = itab1-zbukr
          hbkid = itab1-hbkid
          hktid = itab1-hktid
          rzawe = itab1-rzawe
          chect = itab1-chect BINARY SEARCH.
          IF ( itab-voidu IS NOT INITIAL ).
            DELETE TABLE itab FROM itab1.
          ENDIF.
        ENDLOOP.
    04/13/08 commented to satisfy 4th condition
    Do not extract the Original record of the replaced Check
       LOOP AT itab.
         IF ( itab-voidu IS NOT INITIAL ) AND
            ( itab-voidd IS NOT INITIAL ).
           DELETE itab.
         ENDIF.
       ENDLOOP.
    04/13/08 commented to satisfy 4th condition
    Logic for eliminating voided Checks End
    ***The below process can be used for Delta Extraction using Time Stamp
       loop at itab.
         concatenate itab-pridt itab-priti into wa_timstmp.
         move wa_timstmp to itab-timstmp.
         move-corresponding itab to e_t_data.
         append e_t_data.
       endloop.
        e_t_data[] =    itab[].
        s_counter_datapakid = s_counter_datapakid + 1.
      ENDIF.              "Initialization mode or data extraction ?
    ENDFUNCTION.
    =========
    Please advise me and where will i correct the code.
    Thanks in advance,
    Siri.
    Edited by: SIRI SIRI on Jun 3, 2008 3:26 PM

    Hi,
    use the following:
    define a index variable.
    data: l_index type sy-tabix.
    in your loop at e_t_data.
    loop at e_t_data.
    new statement
    l_index = sy-tabix.
    changed statement
    modify e_t_data index l_index.
    endloop.
    The other read operations on internal tables will reset sy-tabix so that it will point to a invalid record.
    regards
    Siggi

  • Correction Invoice and "invalid document structure" problem

    Hello!
    Can anybody explain what properties are obligatory for correction invoices? I'm trying to add() one and it always say -5002: invalid document structure.
    In the CSI1 table I see linenum has to be unique, every baseline is twice. Do I make any stupid mistake? If so - where? What's wrong? Something is ommitted?...
                                                                                    Thanks in advance!
                                                                                    This is a snippet (two loops are unnecessary, I was looking for other ways). I'm trying just to zero the invoice. Should quantity in was lines be negative? It does not matter - everytime -5002...
         @Test
         public void testSAPCorrectionInvoice() throws SBOCOMException {
              ICompany company = sapConnector.getCompany();
              // Integer srcDocEntry = 6457;
              Integer srcDocEntry = 7084;// this one has no batches
              logger.debug("Creating correction to: " + srcDocEntry);
              // source doc
              IDocuments srcDoc = SBOCOMUtil.getDocuments(company,
                        SBOCOMConstants.BoObjectTypes_Document_oInvoices, srcDocEntry);
              logger.debug("srcDoc: " + srcDoc.getDocObjectCode() + ", "
                        + srcDoc.getDocNum());
              IDocuments sapDoc = SBOCOMUtil.newDocuments(company,
                        SBOCOMConstants.BoObjectTypes_Document_oCorrectionInvoice);
              // header:
              sapDoc.setHandWritten(SBOCOMConstants.BoYesNoEnum_tNO);
              sapDoc.setSeries(317);
              sapDoc.setDocType(SBOCOMConstants.BoDocumentTypes_dDocument_Items);
              sapDoc.setCardCode(srcDoc.getCardCode());
              sapDoc.setCardName(srcDoc.getCardName());
              sapDoc.setAddress(srcDoc.getAddress());
              String federalTaxID = srcDoc.getFederalTaxID();
              if (federalTaxID.length() > 0)
                   sapDoc.setFederalTaxID(federalTaxID);
              sapDoc.setDocDate(new Date());
              sapDoc.setDocDueDate(new Date());
              sapDoc.setSalesPersonCode(srcDoc.getSalesPersonCode());
              sapDoc.setDocCurrency(srcDoc.getDocCurrency());
              sapDoc.setPaymentGroupCode(srcDoc.getPaymentGroupCode());
              sapDoc.setTransportationCode(srcDoc.getTransportationCode());
              sapDoc.setContactPersonCode(srcDoc.getContactPersonCode());
              // sapDoc.setDiscountPercent(0.0);
              sapDoc.setComments("zwrot towaru");
              // sapDoc.setDocTotal(0.0);
              sapDoc.setVatDate(srcDoc.getVatDate());
              // items
              IDocument_Lines lines = sapDoc.getLines();
              int lineno = 0;
              IDocument_Lines srcLines = srcDoc.getLines();
              for (int i = 0; i < srcLines.getCount(); i++) {
                   srcLines.setCurrentLine(i);
                   logger.debug("line " + i + ", item: " + srcLines.getItemCode());
                   if (lineno > 0)
                        lines.add();
                   lines.setCurrentLine(lineno++);
                   lines.setItemCode(srcLines.getItemCode());
                   lines.setItemDescription(srcLines.getItemDescription());
                   lines.setWarehouseCode(srcLines.getWarehouseCode());
                   lines.setPrice(srcLines.getPrice());
                   lines.setDiscountPercent(srcLines.getDiscountPercent());
                   lines.setTaxCode(srcLines.getTaxCode());
                   lines.setBaseEntry(srcDocEntry);
                   lines.setBaseType(srcDoc.getDocObjectCode());
                   lines.setBaseLine(i);
                   lines.setVatGroup(srcLines.getVatGroup());
                   lines
                             .setCorrectionInvoiceItem(SBOCOMConstants.BoCorInvItemStatus_ciis_Was);
                   double quantity_was = srcLines.getQuantity();
                   lines.setQuantity(quantity_was);
              for (int i = 0; i < srcLines.getCount(); i++) {
                   srcLines.setCurrentLine(i);
                   logger.debug("line " + i + ", item: " + srcLines.getItemCode());
                   if (lineno > 0)
                        lines.add();
                   lines.setCurrentLine(lineno++);
                   double quantity_diff = 0;
                   lines.setItemCode(srcLines.getItemCode());
                   lines.setWarehouseCode(srcLines.getWarehouseCode());
                   lines.setPrice(srcLines.getPrice());
                   lines.setDiscountPercent(srcLines.getDiscountPercent());
                   lines.setTaxCode(srcLines.getTaxCode());
                   lines.setBaseEntry(srcDocEntry);
                   lines.setBaseType(srcDoc.getDocObjectCode());
                   lines.setBaseLine(i);
                   lines.setVatGroup(srcLines.getVatGroup());
                   lines
                             .setCorrectionInvoiceItem(SBOCOMConstants.BoCorInvItemStatus_ciis_ShouldBe);
                   double quantity_was = srcLines.getQuantity();
                   double quantity_is = 0; //quantity_was - quantity_diff;
                   lines.setQuantity(quantity_is);
              int result = sapDoc.add();
              String info = company.getLastErrorDescription();
              logger.debug("res = " + result + ", info: " + info);
              if (result != 0)
                   throw new EBladKorektyNrPartii(
                             "Cannot create document: " + info);
    Edited by: WodzGalopujacySkleroz on Jul 4, 2011 5:03 PM

    Hello,
      Maybe it's an old thread, and you might have the solution or workaround for this. Nonetheless i try to answer, it might be useful for those trying to find a solution for the same problem.
      The two loops are necessary indeed. DI API expects only this structure: Start with all the "ShouldBe" lines, and follow them with all the "Was" lines. So your code is almost good, but you should have swap the two loops with each other.

  • Event structure problem

    HI!
    I am a Labview Newbie and i have some problems with my event structure in the program "Biegelinie"! I get always failure from the event-structure in the failure-list!
    Could somebody help me???
    best regards,
    Peter
    Labview 7.1 on Windows 2000
    Attachments:
    program.zip ‏134 KB

    For a less complicated system, you can achieve nearly the same
    functionality without using an event structure.  Simply poll the
    state of the booleans you require and feed them into case
    structures.  By placing these case structures and the polling into
    a loop with a "wait until ms multiple" set to around 50 or 100ms, the
    responsiveness of the code should be high enough without bogging the
    processor down with the polling.
    If you want have a look at the example VI I've attached.
    Hope this helps
    Shane.
    PS Are you sure the document linked below is relevant for you?  It
    states that the event handler isn't in the base 6.1 version of LabVIEW,
    but your sig says you're using 7.1........
    Message Edited by shoneill on 07-25-2005 11:30 AM
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
    Attachments:
    Polling boolean.vi ‏23 KB

  • Cause Code - Structure for Plant Maintenance Notification

    Dear firends,
    I am trying to create cause code group structure for a notification as follows,
    --> Superior Level Cause Code Group ( XXXX)
                        - -> Cause Code Group (XXXX-SUB)
                                       - -> Cause Code ... (1010)
    In standard SAP we can create a Cause code group for a catalog then assign the Cause codes to the Cause code groups then assign to the Catalog profile ...and the structure looks like as follows (AS IS)
            - -> Cause Code Group(XXXX-SUB)
                                       - -> Cause Code ...(1010)
    But in my case i need to add one more level above the "Cause Code Group" as shown below ( TO BE)
    --> Superior Level Cause Code Group ( XXXX)
                        - -> Cause Code Group (XXXX-SUB)
                                       - -> Cause Code ... (1010)
    Please assist me is there any way to accomplish this requirement through user exit or something else.Thanks.
    Regards,
    MJ.
    Edited by: MJ Masi on Sep 23, 2009 10:43 PM

    Babu,
    Do the Divisions have its own Equipment base?          - Ans  : NO
    Do they create Notification for the same Equipment?   - ANS : YES
    So, lets take the case 2 you mentioned ...
    Case2:
    If they are creating notification for a same equipment (EQ01 is common for all Divisions), you can create Defect code group with Division Name CHEMDEF1, CHEMDEF2,... BIODEF1, BIODEF2... etc ...
    User has to select appropriate Defect code group and defect code.... If he enters Def code as Cause code group system will populate caused relevant for particular Def Code ...
    Problem here is lets say the Defect Code Group CHEMDEF1 has two defect code A010 & A020 ,
                                                                                  CHEMDEF2 has three defect code B010, B020 & B030.
    I would like to bring this Defect Code Group CHEMDEF1 & CHEMDEF2 under DIV1 and Defect Code Group BIODEF1 & BIODEF2 under DIV2.
    Example : The structure should look like this ..
                    - DIV1  ( Superior level needs to be added on the Structure)  - Will it be possible ?
                            - CHEMDEF1  ( Defect Code Group)
                                           - A010 ( Defect Code)
                                           - A020( Defect Code)
                            - CHEMDEF2( Defect Code Group)
                                           - B010( Defect Code)
                                           - B020( Defect Code)
                                           - B030( Defect Code)
                    - DIV2 ( Superior level needs to be added on the Structure)  - Will it be possible ?
                            - BIODEF1
                                           - C010
                                           - C020
                            - BIODEF2
                                           - D010
                                           - D020
                                           - D030
    Please let me know.Thanks.
    Regards,
    MJ Masi

  • Code Structure / Component Question

    I'm new to Flex and trying to learn as much as I can on my own without help, but I've run into a question that I'm not finding an answer for.
    I've read about creating MXML components and understand that, as well as creating AS classes, that that makes sense too.
    I have code in the default package which displays the Datagrid component (MXML) but also has ActionScript code in the same source file to load the datagrid via PHP (HTTPService) as well as define what happens when cells are updated (sending data back to update the DB via PHP).
    This is all pretty much a self-contained "component" for manipulating data from a particular MySLQ table from this single datagrid.  I have the grid displayed on one tab of the tab navigator.
    My problem is that I'd like to create a similar datagrid on a separate tab which does the same thing for a different table.   I know this code needs to be separated and not in one MXML file, but I'm not finding how to either structure my project to do this, or else make each datagrid (along with the associated AS code) into a separate component.
    Would appreciate any help or examples you may have.
    Thanks,
    Gary

    Thanks for pointing me in this direction -- I had started that way, but got confused.  Here are the first few lines of my current code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                                            width="998" height="656" creationComplete="init()" layout="absolute">
              <mx:Script>
                        <![CDATA[
                                  import mx.controls.Alert;
                                  import mx.events.PropertyChangeEvent;
                                  import mx.events.CollectionEventKind;
                                  import mx.events.CollectionEvent;
                                  import mx.events.DataGridEvent;
                                  import mx.controls.TextInput;
                                  import mx.rpc.events.ResultEvent;
                                  import mx.collections.ArrayCollection;
                                  import com.adobe.serialization.json.JSON;
                                  import com.adobe.viewsource.ViewSource;
                                  [Bindable]
                                  private var callbackUrl:String;
    Naturally, my datagrid tag is dozens of lines below this:
    <mx:TabNavigator x="23" y="10" width="831" height="506">
    <mx:Canvas width="100%" height="100%" label="Learners">
    <mx:DataGrid id="dgData"
    x="27"
    y="19"
    width="778"
    Can you show me a quick example of how I'd put this together with the top tag as you described?
    Thanks again,
    Gary

  • Source code managements problems

    Hi all.
    I work for a coperation that mandates the use of a particular source code management software, MKS. They are moving to another solution soon, so it doesn't make sense to write an extension for it.
    My objective is to use MKS to manage source changes as a standalone tool, while using JDeveloper to modify and debug application code.
    I also have a requirement to put all runtime code into MKS as well, so that a complete runtime build can be performed from within any project sandbox and deployed (No 3rd party installations required). This would include jdeveloper jar files and compiled objects from other MKS / Jdeveloper projects.
    So far, I've discovered that the JDeveloper project libraries are referenced by full pathname, including drive letter. This means that each develeper sandbox directory must have the same root path and drive letter or each projects libraries must be maintained seperately. Neither I think is very pretty. Is there a way to use relative pathnames?
    I'm also wondering how many other problems I may encounter as I proceed. What is the intended model for supporting concurrent development using standalone source code management?
    Any ideas or suggestions would be greatly appreciated.
    Thanks in advance
    Keith.

    Yes.
    The issue comes into play when developer A may be developing on c:\jdev and developer B may be developing on d:\dev\3m\jdev. I would rather not have to mandate directory structure standards for the parent directories.

Maybe you are looking for

  • In Contacts how do I enlarge the font size?

    In Contacts how do I enlarge the font size?

  • Selection-screen functionality

    Hi, I have 2 questions regarding selection-screens: 1. I have 2 select-options like this in my selection-screen: Matnr:  s_matnr Vendor: s_lifnr How can I make a check that if Matnr is filled then Vendor has to be filled as well and vice versa ? 2. I

  • Saving work to a CD-Rom

    How do I save a Word document to my CD-Rom?

  • One SO , one DN and combine billing

    hi, i have below requirement one SO, have several delivery date, let said, 29/11 and 30/11. If another SO also have the same delivery date. Two DN must be separated created for 19/11. I want to use VL10G "background" button, however, this only make t

  • Unable to seek() to Chapter Markers?

    Hello there, In FCP 7 I add Chapter markers to the clip. They are shown in Compressor, and when I open the clip after compression (H.264) in QuickTime player, I can navigate to these markers. But the Video Player that is based on LightWeightVideoElem