Shopping cart problem.

I have the following method in the ShoppingCart.class.
When an object of MusicRecording passed into this method, it is intended to return how many objects of the passed MusicRecording object there are in the shoppingCart ArrayList. But this method didn't work, it always returns 0 even when I was sure that the object I passed in should exist in the shoppingCart ArrayList.
Please help me. Many thanks to you all.
ArrayList shoppingCart;
public int getQuantity(MusicRecording m) throws RemoteException{
int quantity=0;
for(int i=0;i<shoppingCart.size();i++){
     if(  (  shoppingCart.get(i) ).equals(m)){
          quantity+=1;
.....................

public int getQuantity(MusicRecording m) throws
RemoteException{
int quantity=0;
for(int i=0;i<shoppingCart.size();i++){
     if(  ( (MusicRecording) shoppingCart.get(i) )==m){ //you're doing exactly the same the default behavior of equals() method does.
          quantity+=1;
return quantity;
}You should override both hashCode() and equals() in the MusicRecording class. Provide the logic that you consider will define two equal MusicRecording's

Similar Messages

  • JSP Shopping Cart problem

    Hello,
    I'm writing a JSP page with a shopping cart so the user can add products to it, nfortunately the thing won't work.. I keep getting an NullPointerException.. I'm probably screwing up somewhere.. I would be very thankful if you could help me out..
    this is the code for the Shopping Cart Bean:
    [myCart.java]
    package myCart;
    import java.util.*;
    public class myCart implements java.io.Serializable{
         private Vector items;
    public String[] getItems(){
         String strTemp[] = new String[items.size()];
         items.copyInto(strTemp);
         return strTemp;
    public void setItems(Vector newItems){
         items=newItems;
    public void addItem(String newId){
         items.addElement(newId);
    This is the JSP page that I'm using:
    [myCart.jsp]
    <%@ page import="java.sql.*" %>
    <%@ page import="java.util.*" %>
    <jsp:useBean id="myCart" class="myCart.myCart" scope="session" />
    <%
    Connection con;
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:produkten");
    Statement stmt = con.createStatement();
         ResultSet rs = stmt.executeQuery("SELECT * FROM tblProdukten WHERE NR= "+request.getParameter("nr")+"");
    while (rs.next()) {
         String merk = rs.getString("MERK");
         long temp = rs.getLong("NR");
         String nr = Long.toString(temp);
    -----> myCart.addItem(nr);
         %>
         <BR>Nr     : <%=nr%>
         <BR>test :     <%=merk%>
         <HR>
    <% } %>
    <%
         con.close();
         catch(ClassNotFoundException cnfex)
              out.println("jdbc odbc driver not found // muzz");
         catch(SQLException sqlex)     
              out.println(sqlex);
    %>
    </TABLE>
    </BODY>
    </HTML>
    I think I probably(??) put the <myCart.addItem> in the wrong part of the code..??
    Greetings,
    Michael

    yes, I see, I forgot to initiate that, I'm still
    learning so please bare with me :)
    I now initiated the <items> vector like this:
    Vector items = new Vector();
    and added this:
    myCart.items.addItem(nr);
    But it still won't work correctly >>
    First error: Your Vector items is not a public variable. Therefore, outside classes will not be able to access it. No problem though, you have a method to take care of that. Instead of what you're doing, simply call
    myCart.addItem(nr)This calls the public method addItem(String) which accesses your private Vector items, and adds a string to the vector.
    Your second error should be taken care of. It is resulting from the fact that instead of calling the method addItem() from teh class instance, youre trying to access the Vector items first, and then trying to call addItem() from that... not only can you not access that variable, as stated above, but there is no method in Vector called addItems(). You could conceivably make items public, but I'd stick with what you've got.

  • Shopping cart problems with 7.6 (29)

    I just installed Itunes 7.6 (29) and I can not view my shopping cart. I get a window that says the terms and conditions have changed. I put a check in (I have read and agree to the terms) and then press continue and it keeps jumping back to the same terms screen. I can not view my shopping cart. Anyone else have this problem?

    This seems to be problem on the server end.
    I tried to purchase with iTunes 7.4 and it came up with the new Terms and Conditions, so it is not limited to iTunes 7.6.
    After logging out and quitting & restarting iTunes a few times it finally worked.
    My guess is the iTunes store servers are being worked to death. These problems go away as the demand slows back to normal ( afew days).

  • ITunes Shopping Cart Problem

    Hello,
    I have the strangest issue with my shopping cart. I had some items that I was going to purchase but decided not too and left them in my cart. I went to remove them from my cart the other day and I can't! I recieve the following error when I clice the x next to each item:
    Could not remove an item from your cart. An Unknown error occurred (1011).
    There was an error in the iTunes Store. Please try again later.
    I did try again later, many times, to no avail. The items that are in my cart are no longer available in the iTunes store which I'm positive is contributing to the problem. Any help that someone could give would be appreciated!
    Thanks again.
    Dell   Windows XP Pro  

    This is a bit of a long shot, but it worked for another user, so it's worth a try. Go to the iTunes Store preferences, select "Buy and Download Using 1-Click", close the preferences window, reopen the preferences window and reselect "Buy and Download Using Shopping Cart". Then see if your Shopping Cart will clear.
    If that doesn't help, you'll need to contact the iTunes Music Store customer support department through the form at the bottom of this web page and explain the problem to them.
    Hope this helps.

  • Shopping Cart Problem...plz help

    Hello Gurus,
    I have a Cart created by my user,
    the problem is the Cart is not moving to the backend to create
    the follow on document,i.e the PR,
    Checked the BBP_PD,it shows I111 as the status,
    i am unable to get where the exact problem is,
    The Approval is completed,
    can any 1 advise why this is stuck.
    where can i see the problem?
    (checked RZ20)no clues..:-(
    tried to Update by bbp_get_status_2...:-( no use...
    plz help..
    Points gaurenteed.
    Thanks

    Hi Arshad,
    You have to apply OSS notes to resolve this issue.Please find the relavent OSS notes :
    <b>Note 729967 - Shoppng cart:Status I1111,no follow-on docs->analysis report</b>
    <b>Note 949162 - Follow-on documents exist, status I1111 and I1113 active</b>
    <b>Note 854478 - Alert monitor: No longer possible to transfer shopping cart</b>
    <b>Note 728536 - Shopping cart: Follow-on docs => analysis-/correction report</b>
    <b>Note 900142 - BBP_PD_SC_RESUBMIT: All items set to status I1111</b>
    Hope the above notes will resolve your issue.
    Let me know once it gets resolved or in case of any further clarifications.
    Award points for suitable answers.
    Rgds,
    Teja

  • SRM Shopping Cart Problem in coding.please help

    Hi SAPGURUS,
    Please help me with this code,its fetching me no result in SRM for these conditions.This code is not changing anything and not giving the desired result.
    I am using BBP_DOC_SAVE_BADI
    Please see the doc for CONDITIONS
    [http://www.2shared.com/document/dXlymF0Y/rules.html]
    Please see the code here.
    [http://www.2shared.com/document/bMWByy1f/code.html]

    First you might want to describe what you are trying to achieve. In case you intend to change or validate the changed document, one common BADI to implement is BBP_DOC_CHANGE_BADI.

  • With WBS element unable to create the Shopping cart

    Hi,
    With WBS element unable to create the Shopping cart
    Problem description:
    Shiopping cart >Item detail > Account assignment
    A/c assignment category " WBS element", Assignment no (some no,eg 1000-2 ).System picks the G/L account and business area,unable to create the shopping cart.Getting error message that
    "The account assignment objects are defined for different business areas  "
    Did i missed anything ,please
    Thanks
    Hareesha

    Hi Hareesha,
    As Sreedhar has rightly said the issue is definitely with the correctness of the data.
    Check the assignment of WBS to the proper business area which you are using to create the shopping cart.Check your org. structure and attributes and their assignments once again.
    Neverthless some OSS notes for your reference if in case you can not able to make P.Os or the SC's / P.Os are not getting transfered to back end R/3.
    <b>Note 727897 - WBS element conversion in extended classic scenario</b>
    <b>Note 1000184 - Account assignment error when document transfer to back end</b>
    Even after validating the data if the problem still persists please explain it clearly with the errors for further help.
    Rgds,
    Teja

  • Problem with Shopping cart's currency

    Hello,
    I've got a problem with shopping cart's currency. I create the shopping cart with 1 item currency "EUR", I see in my backend ECC 5.0 , my purchase requisition have got a currency in "CHF".
    System SRM : SRM 5.5
    System ECC : 5.0
    The scenario for approval shopping cart is automatic, the workflow WS1000060 is active.
    Can you help me please, thanks very much.
    Lionel

    Hi Sambit,
    Yes I found the solution.
    You must implemente this BADI BBP_CREATE_BE_RQ_NEW with method FILL_RQ_INTERFACE. 
    You can see my code :
    METHOD if_ex_bbp_create_be_rq_new~fill_rq_interface.
      DATA : wa_requisition_items TYPE bbps_badi_rq_item,
             wa_item TYPE bbp_pds_transfer_item,
             w_tabix TYPE sy-tabix,
             w_check.
      LOOP AT cs_rq_document-it_requisition_items INTO wa_requisition_items.
        w_tabix = sy-tabix.
        READ TABLE is_sc_document-item INDEX w_tabix INTO wa_item.
        IF wa_requisition_items-currency NE wa_item-currency.
          wa_requisition_items-currency = wa_item-currency.
          wa_requisition_items-c_amt_bapi = wa_item-gross_price.
        ENDIF.                                               
        MODIFY cs_rq_document-it_requisition_items FROM wa_requisition_items INDEX w_tabix.
        CLEAR : wa_requisition_items,
                wa_item.
      ENDLOOP.
    ENDMETHOD.
    I hope that will help you.
    Kind regards.
    Lionel
    Edited by: Lionel Lacotte on Jun 24, 2008 2:22 PM

  • Problem with shopping cart

    When I click on "buy now" i get an error message saying items in my cart have changed, etc and to check it again and then hit buy now. I just keep getting same message over and over. If I choose one-click shopping, I can buy. But I hate having 20-25 .99 purchases going on my debit card. I used the shopping cart option a couple of weeks ago with no problem. What am I doing wrong? I didn't change anything. Yikes
      Windows XP  

    i need the shopping cart where i stored thousand of music that i had to buy!
    Using the Shopping Cart as a "wish list" and keeping a lot of tracks there for future purchase is a mistake. If the iTunes Store has to remove one (or more) of the tracks, it can corrupt your Shopping Cart. To keep tracks for future purchase, create a normal playlist (call it "wish list" if you like) and drag the tracks from the iTunes Store to that playlist. Then use the Shopping Cart only for tracks you intend to purchase very soon.
    As to your current problem, contact the iTunes Music Store customer support department through the form at the bottom of this web page and explain the problem to them. They'll probably need to clear your Shopping Cart to get it to work again.

  • Shopping Cart Approval Problem

    Hi.
    I have a shopping cart which is going through the loop to the approvers.
    As per the conditinos, it needs to go to only 2 approvers.
    after the 2nd approver approved it , it going back to the 1st approver again.
    now 2 approvers approved twice but again it is going back to the first approver.
    What could be the problem and where to check for this error and the solution.
    -erpMAN-

    Hi,
    Which SRM version are you working on??
    See if the foll  note   applies for your system which may help to solve your problem
    OSS note 896556
    See also the foll related threads for more hints:
    Re: ADMINISTRATOR_APPROVAL parameter in n-step approval badi
    chaging description by the approver causes worng behaviour of workflow
    BR,
    Disha.
    Do reward points for  useful answers.

  • Problem with Adhoc approver in shopping cart approval

    Hi Experts,
    We have Classic  and extended classic scenario in our SRM 5.0 system. Though in the settings the extended classic  scenario is not set,  based on the product category PO will be created for the respective scenario.  
    In extended classic scenario the above mentioned two scenarios are executed with out error.
    Now we have a problem with the two cases  :
    whenever adhoc approver is added in the classic scenario for n-step Shopping cart workflow , the workflow is in infinite loop. work item is again in approvers inbox  even after approval.
    The same scenario is repeating  when we forward the workitem to other user for approval
    Could someone explain why the workitem is again in inbox ?
    Thanks & Regards,
    Phanidhar

    Adhoc Agent must be getting filled with the same approver everytime and it is sending the workitem. Check the Workflow log and try testing the workflow alone.
    Another option is, if you are not using Adhoc agent assignment for this task is to create your own Agent Determination Rule with function module using transaction PFAC.

  • Problem displaying japanese character set in shopping cart smartform

    Hi All,
    whenever users are entering some text in Japanese character set while creating a shopping cart in SRM, the smartform print output is displaying some junk characters!! even though the system is unicode compatable, did any one have problem ??
    Thanks.

    Hi,
    May be there is some problem with UNICODE conversion.
    See the foll links;
    Note 548016 - Conversion to Unicode
    http://help.sap.com/saphelp_srm50/helpdata/en/9f/fdd13fa69a4921e10000000a1550b0/frameset.htm
    Europe Languages  work  in  Non- Unicode  System
    Re: Multiple Backends
    Re: Language issue
    Standard Code Pages in Non-Unicode System
    Re: Upgrade from EBP 4.0 to SRM 5.0
    http://help.sap.com/saphelp_srm50/helpdata/en/e9/c4cc9b03a422428603643ad3e8a5aa/content.htm
    http://help.sap.com/saphelp_srm50/helpdata/en/11/395542785de64885c4e84023d93d93/content.htm
    BR,
    Disha.
    Do reward points for  useful answers.

  • Problem in getting data while creating public template shopping cart(urgen)

    Hi Gurus,
    I am technical guy...Could you please suggest me how to populate the purchase organisation details(be_pur_org) which is of type bbps_sc_app_item.
    The problem is while creating normal shopping cart template it is displaying the vendor and inforecord details..when I use the same data for creating the public shopping cart it is not displaying the values (vendor and inforecord details) this is due to the missing of purchase organisation field value which is populated in the field be_pur_org which is of type bbps_sc_app_item.
    Is there any badi's to populate the purchase organisation details...?
    awaiting for all your replies..points will be rewarded with lots of appreciation
    Thanks & Regards,
    Ravi Ganji

    Hi
    <u>You can use either of the BADIs depending on your requirement.</u>
    BAdI Definition Name Description                                                                               
    BBP_PGRP_ASSIGN_BADI EBP Purchasing Documents: Assign Purchasing Group(s)       
    BBP_PGRP_FIND        Shopping Cart: Determine Responsible Purchasing Group(s)                                                                               
    BBP_DOC_CHANGE_BADI
    BAdI for Changing EBP Purchasing Documents
    <b>Please read the Standard documetation available with them using SE18 transaction in SRM system.</b>
    Which SRM version you are using ?
    Hope this will help.
    Please reward suitable points.
    Regards
    - Atul

  • Problem to repatraite the items for shopping cart status Held

    Hello all experts,
    In a scenario standalone I have a problem to repatriate the items for my shopping cart that have a status held.
    I verify the data of item and catalog we don't have a difference for pricing product etc ......
    If I repatriate item I see never data for my new shopping cart.
    For other informations status for item is To be Processed.¨
    Please help for this problem for all experts.

    Hello Steve,
    To remove action from specific workitems, you can do this in the UWL  configuration file.
    1) Download the configuration file (in ZIP format). Go to:
    System Administration &gt; System Configuration &gt; Universal Worklist &#38; Workflow &gt; Universal Worklist Administration
    Click to "Administrate Item Types and View definition".
    Then download file 'com.sap.pct.srm.core'.
    2) Navigate to each WI you would like to change:
    - &lt;ItemType name="uwl.task.webflow.srm.TS40007952"... (SC Completion)
    - &lt;ItemType name="uwl.task.webflow.srm.TS40007953"... (SC Approval)
    - &lt;ItemType name="uwl.task.webflow.srm.TS40007954"... (SC Approval)
    3) Within those item types, put a new property to action reference "reject" for 'Actions' definition like below:
    <Properties>
       <Property name="display_order_priority" value="uwlExcludeFromPreviewDetail" />
    </Properties>
    4) Save and upload file again.
    Regards.
    Laurent.

  • Problem when creating Limit Item in shopping cart

    Hi SRM Gurus,
    Need your help.
    When I am creating the blaknket shopping cart using the Functionality "Create Limit Item", system is throwing the Error BBP_PD 002 ( "Interface data contais errors").
    In debug mode for the BADI BBP_DOC_CHANGE_BADI(method BBP_SC_CHANGE),I have checked that the ITEM Type for this Limit Order is "LIMI".
    Even all the basic data, cost assignment are not coming properly.
    So please help regarding this issue.
    Thanks for your help in advance.
    Thanks
    Shraman

    Hi SRM Gurus,
    Now the Limit Order SC has been created successfully in SRM and the PO is also getting populated in ECC too.
    But the problem is like,
    When we create Limit Order(blanket) Shopping cart, then there has 2 options to do that.
    (Under Follow-Up Action)
    1. Confirmation and invoice
    2. Invoice Only.
    Depending on the above in ECC, the Item category for the PO will be D(Confirmation and Invoice only)and B (Invoice Only).
    But for my case it's always showing Item Category D in both of the cases.So as because of this issue, some thing is going wrong from ECC perspective.
    So please help me out from this problem.
    Thnaks for your help in advance.
    Full points for the answer.
    Thanks again,
    Shraman
    Edited by: shraman saha on Aug 29, 2008 10:48 AM

Maybe you are looking for

  • Software-Driver Installation with Windows 8.1

    After installing the Win8.1 "upgrade", I was able to print with my Photosmart Premium C410a, but several days later when I first attempted to scan, I was unable to. Though there is an HP Printer Control tile on my Start screen, when I launch it, ther

  • [SOLVED] Steam troubles. Segfault after login.

    Hello. I'm usually pretty good about solving my own problems, but this one has me beat. So, yay, first post. Recently my nephew brought me his computer for a nuke and pave, and since he doesn't have a legit Windows key and I don't use Windows anymore

  • Sliced images shift

    Hi all, I am new to dreamweaver, but have been reading books and checking out online tutorials. I created a design in photoshop and created layer based slices where appropriate then saved for the web as html with images. I brought that html page into

  • Grant / grant management dependancy on Funds Management

    Hello experts, Based on a quick look at documentation, I am not sure if GM requires FM or not. If you have organization which does not have a requirement to use FM (commitment items etc.) but has a large number of projects with multiple financing sou

  • WRT160N version without opening the box.

    Hi, I want to buy a a new router - WRT160N. Is there an option to find out the version of the router without opening the router box? I got the S/N, MAC and FG no. from the box of the router. Is there any way to find out the version of the router from