Collection of Items

Hi virtual colleagues! Could anyone please ans. my comments in the code.
Thanks for any help! : )
//This is TEST DRIVER for VendingMachine Class.
public class VmTrial
public static void main(String []args)
  VendingMachine vm = new VendingMachine();
  String in = new String();
  IO.println("Enter items to add into vending machine:");
  in = IO.readLine();
  int pin = IO.readInt();
  int q = IO.readInt();
  vm.addItemType(new ItemType(in,pin,q)); // keeps on adding items into ARRAYLIST of Vending
//machine class
  } while(in != null)
// but this loop is not working!!
// I am only able to add ONE item! How can I keep on adding items continuously into ArrayList?
//Method in VendingMachine class
public void addItemType(ItemType item)
     ItemType aitem = item;
     list.add(aitem);
    } //END of addItemType()
private ArrayList list = new ArrayList();

You should try this:
//This is TEST DRIVER for VendingMachine Class.
public class VmTrial
  public static void main(String []args)
    VendingMachine vm = new VendingMachine();
    String in;
    while (true)
      IO.println("Enter items to add into vending machine:");
      in = IO.readLine();
      if ((in == null)) || (in.length() == 0))
        break;
      int pin = IO.readInt();
      int q = IO.readInt();
      vm.addItemType(new ItemType(in, pin, q)); // keeps on adding items into ARRAYLIST of Vending machine class

Similar Messages

  • Closing Collections Work Items based on FI-CA Transactions

    Hello Colleagues,
    We have a requirement to close Collections Work Items when certain transactions are performed, e.g. Creation of Instalment Plan, Write-off, Payments to name just a few.
    Because some of  these items involve clearings,  Dunning  will not be triggered for the cleared items. Therefore I assume the Dunning BRF configuration cannot be used to close the Work items.
    Is the  only way to close work items when these FICA transactions are performed is by coding FICA Event logic that is specific to each of the transactions? (e.g. use a Write-Off Event to close work items when items are written off, an Installment Plan Event  when Installment Plan is created, and so on? )
    Your insights will be very helpful.
    Thanks in advance,
    Ivor Martin

    Thanks Bill.
    I understand and agree with  the expectation gap about Instalment Plans.
    Some good news on clearing of dunned items:
    We did some more testing after un-checking the  "Enforcement" Work item in the Work item category configuration.
    Now the work item is closed when the document that is in dunning is cleared (i.e. via payments, write-offs, reversals, acct maintence, etc). The Work item Status turns to "G" (closed due to incoming payment).
    I have logged an OSS in regards to the Instalment Plan on the request of my client - I would  be surprised if they send us a fix to close the work item upon creation of an Instalment Plan. I think we will end up coding our work item closing logic in FI-CA Event 3040 (after the Instalment Plan is created).
    Regards,
    Ivor

  • Strange problem with Outlets and Collection View Items

    This is a strange issue. I am using XCode 3.2.2 and I am building a Collection View. To do this I have a non-document based application that uses Core Data.
    *Collection View Item Class*
    I created a new class that inherits NSCollectionViewItem and built it to have an outlet to the Label.
    *Collection View Item NIB*
    I created a Empty NIB for my Collection View Item. To the NIB I added a Custom View object and set the Class Identity to NSBox. I then added a Label to the new NSBox. I changed the File Owner to the new class and connected the "view" outlet to the new NSBox and the Label to the label outlet.
    *Main Menu NIB*
    I added a new NSCollectionViewItem object to the Main Menu NIB and set the Class Identity to the new class mentioned above. I then set the NIB Name to the name of the NIB mentioned above. In the window I added a NSCollectionView then set its Item Prototype to the new NSCollectionViewItem object I just configured. This is the typical way to set up a collection view with its item in a different NIB.
    *Back to the problem*
    Everything seem to work well except that in the setRepresentativeObject in the Collection View Item class when it attempts to set the Label to a value. Nothing happens. When I check closely I find that the Label is coming back nil. It is properly linked. I deleted everything and rebuilt the collection view item and relinked everything without success.
    *How I made it work but not happy with it*
    I have finally made this work by simply putting the line "[self view];" just before I attempt to run "[label setStringValue:name];". If I remark out the "[self view];" the label returns nil. I have a note near the line to make it easier to spot. It seems that I should not need to access the superclass's "view" accessor just to access one of view's subviews. Is this a bug or have I written this wrong?
    The Collection View Item code is below. Any help is appreciated.
    Thanks,
    Rob
    #import <Cocoa/Cocoa.h>
    #import "PersonManagedObject.h"
    @interface PersonSelectionViewItem : NSCollectionViewItem {
    NSTextField *label;
    #pragma mark Finalizers
    - (void)dealloc;
    #pragma mark Outlets
    @property (nonatomic, assign) IBOutlet NSTextField *label;
    #pragma mark Instance Methods
    - (void)configureKeyValueObserving;
    - (void)removeKeyValueObserving;
    #pragma mark Overrides
    - (void)setRepresentedObject:(id)representedObject;
    - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context;
    @end
    #import "PersonSelectionViewItem.h"
    @implementation PersonSelectionViewItem
    #pragma mark Finalizers
    - (void)dealloc{
    [self removeKeyValueObserving];
    [super dealloc];
    #pragma mark Outlets
    @synthesize name;
    #pragma mark Instance Methods
    - (void)configureKeyValueObserving{
    PersonManagedObject *person = (PersonManagedObject *)[self representedObject];
    [person addObserver:self forKeyPath:@"lastNameFirstName" options:0 context:NULL];
    - (void)removeKeyValueObserving{
    PersonManagedObject *person = (PersonManagedObject *)[self representedObject];
    [person removeObserver:self forKeyPath:@"lastNameFirstName"];
    #pragma mark Overrides
    - (void)setRepresentedObject:(id)representedObject{
    [super setRepresentedObject:representedObject];
    NSString *personName = (NSString *)[representedObject valueForKey:@"lastNameFirstName"];
    [self view]; //<---Without this line the "label" variable 2 lines down will be nil.
    if (personName) {
    [label setStringValue:personName];
    [self configureKeyValueObserving];
    - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
    if ([keyPath isEqualToString:@"lastNameFirstName"]) {
    [[self label]setStringValue:[object valueForKey:@"lastNameFirstName"]];
    } else {
    [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
    @end

    I think you must be correct. I just ran into the problem again in yet another NIB. It was in the setRepresentedObject method. I simply put in the same line "\[self view\]" just before I needed to set the value of the view component and it worked again. If it is the same in other components I guess I just need to pay attention to it. Thanks for the information.
    Message was edited by: Cycles4Fun

  • Is it possible to directly pull liquid tag from an available collection of items without looping

    I'm wondering if it is possible to directly render a liquid tag from an available collection of items without first looping through those items.
    So lets say I output a webapp module to a collection and I know I just want to get the first item's name from those item/s (perhaps the webapp is intended to only store one item for example).
    Could I do something like:
    {{webapp_1.items[0].name}}
    Or a particular item number, say the 3rd item:
    {{webapp_1.items[2].name}}

    Ah ok I see now. I was using the object name (webapp_1) I saw in the {{this | json}} output BEFORE I made a collection for the webapp.
    So why does this data look to be available in the json output before assigning a collection but it can't be accessed by liquid until a collection is made, and when a collection is made it changes the object name in the json from 'webapp_1' to 'myCollection' ... whereas the globals object is available but there is no collection for it as such???

  • Collections Work Item (Processing deadline)

    Hello Colleagues,
    I am trying to determine how the Processing deadline works for Collections Work Items in IS-U.
    If I assign a Work Item Category a Processing deadline of 7 days,  (Mandatory = Blank) and I trigger a Work Item today,  I can see that the Run Date on the header table DFKKWL is set to 7 days past the creation date of the Worklist.
    However, when I do run dunning with Issue date 7 days later, the Work Item is not closed (Still Open). This is not an enforcement work item.
    If you have successfully worked with Processing Deadlines before, I'd really appreciate it if you could share your experiences.
    Thanks a lot.
    Regards,
    Ivor Martin

    Hi William,
    in my project we want to use processing deadlines to automatically close work items when run date is past for work items (mandatory= blank and enforcement= blank) which are still open (statuts New or In process). This should be done before dunning is launched each day.
    I understood that the processing deadline is informational and has no functionality in dunning.
    But I was hoping that a standard way would exist do it? (in function module FKK_0350_WLI_CREATE_AND_CLOSE, or other standard program to launch)
    I didn't find anything about that and any help would be appreciated.
    Thanks a lot.
    Regards,
    Emilie

  • Query for create manual tabular form using apex collection using item textfield with autocomplete

    can we create a manual tabular form inside item textfield with autocomplete ?
    how it is possible?
    with Apex_item API used for this item.
    i used this code for creat  cascading select list
    select seq_id,
    APEX_ITEM.SELECT_LIST_FROM_QUERY(
            p_idx                       =>   1,
            p_value                     =>   c001,
            p_query                     =>   'SELECT C001 D
         , C002 R
      FROM APEX_COLLECTIONS
    WHERE COLLECTION_NAME = ''col1''',
            p_attributes                =>   'style="width:150px" onchange="f__name(this,parseInt(#ROWNUM#));"',
            p_show_null                 =>   'Yes',
            p_null_value                =>   null,
            p_null_text                 =>   '- Select name -',
            p_item_id                   =>   'f01_'|| LPAD (ROWNUM, 4, '0'),
            p_item_label                =>   'Label for f01_#ROWNUM#',
            p_show_extra                =>   'NO') name,
    APEX_ITEM.SELECT_LIST_FROM_QUERY(
            p_idx                       =>   2,
            p_value                     =>   c002,
            p_query              =>   ' SELECT null d, null r FROM dual WHERE 1 = 2
            p_attributes                =>   'style="width:150px"',
            p_show_null                 =>   'Yes',
            p_null_value                =>   null,
            p_null_text                 =>   '- Select name -',
            p_item_id                   =>   'f02_'|| LPAD (ROWNUM, 4, '0'),
            p_item_label                =>   'Label for f02_#ROWNUM#',
            p_show_extra                =>   'NO')name2,
    from apex_collections
    where
    collection_name = 'COLLECTION1'
    It is fine .
    but i want item in tabular form  textfield with autocomplete and remove select list. my requirement is using textfield with autocomplete select a employee name and second item textfield with autocomplete display dependent perticular employee related multiple task.
    how it is created.i have no idea related textfield with autocomplete.Please help me....

    pt_user1
    I understand that the add row button is currently doing a submit.
    To not submit the page you need a dynamic action on the page.
    Does the javascript function addRow do what you want?
    Otherwise have a look at the following two threads Add row in manual tabular form using dynamic action and Accessing Tabular Form & Add Elements to Collection without Page Submit.
    You're process could be something like:
    Add the new values to the collection using the idea's in the second thread and at the same time add the new row.
    And as second action refresh your tabular form.
    If you get stuck set up what you have done on apex.oracle.com using the tables from the demo application.
    Nicolette

  • Collection  of items for searching

    I have number of items.
    An item has:
    - option 1 and price 1
    - option 2 and price 2
    I want to have a collection to store these items so I can
    - get a price base on itemId and option
    - get all prices base on itemId
    - get all prices based on option (1 or 2)
    At the moment, I use List<String[3]> to store these items and go through the list to search. It is slow...
    I want to use Map but map only stores key and value but I have three values
    Any suggestion, please ...
    Many thanks

    I have number of items.
    An item has:
    - option 1 and price 1
    - option 2 and price 2From your description an item also has an id.
    Create an Item class which groups together the id and both prices. Instances of this class can then be used in collections: as the values of a Map, or the elements in a List etc.

  • ASCP collections not collecting the Items description from source Instance

    Hi,
    We have defined one item in source instance with item's description in Inventory. After the collection and planning, in workbench we could not able to see the Item's description. Can anyone advice me why the Item's description was not collected and shown in ASCP workbench?
    Thanks & Regards,
    Bharathram.N

    Hi Kevin,
    Thanks for your update. Now I can able to see Item's description in workbench.
    Actually somebody have mistakenly deleted the decription field in the backend in the table MTL_SYSTEM_ITEMS_B but the same item's dscription was present in MTL_SYSTEM_ITEMS_TL and thats how we found somebody have done this deletion manually from backend and not through the ITEM API.
    Now we have populated the description field in MTL_SYSTEM_ITEMS_B and ran the standard collection and the same being shown in ASCP Workbench.
    Thanks for your inputs.
    Thanks & Regards,
    Bharathram.N

  • HOW TO COLLECT INCORRECT ITEM

    Hi Everyone,
    I have used Lsmw for PO uploading around 200 records in that 150 are uploaded successful remaining 50 are incorrect as follow's
    The Material XXXXXX is activated or doesn't exist.
    I know why was the above error because i haven't maintained material.
    How to collect the incorrect 50 records back.
    BR
    govind

    hi,
    well! i don't think there is any such table....you can create your own Ztable with the help of ABAP consultant....
    regards
    Priyanka.P

  • Excluding Items from Demantra collection

    Hi,
    Is it possible to exclude the items from being collected to Demantra? Basically, the sales history in Demantra remains, but I don’t want to collect the history going forward.
    Thanks
    Praveena Dasalakunte

    Hi Praveena,
    Oracle Demantra does not have the feature of blocking an item as such. But, your requirement can be met using one of the two approaches:-
    1. Mark the “Planning Method” of the item to “Not Planned” in Item Master. This would exclude the item from getting collected. With this option, the older history in Demantra would remain (unless you delete it manually) but the new history won’t be collected. Please note that this option would not collect the Item in ODS itself. So, using this option means excluding the item from Other VCP products as well (ASCP, RP, SNO etc).
    2.Use the Custom Hooks to manually remove this item in the Demantra Item and Sales Staging table. This would need some development as you may need to have a GUI/table maintaining the list of items to be excluded.
    Hope, this helps.
    Thanks, Kunal

  • Ordering items in collection

    Using this code I am able to order each item in collection:
    import java.util.Iterator;
    import java.util.TreeSet;
    public class Item implements Comparable<Item>{
         public Integer param1 = 0;
         public Integer param2 = 0;
         public int compareTo(Item i) {
              return param1.compareTo(i.param1);
         public static void main(String[] args) {
              // collection
              TreeSet<Item> mySet = new TreeSet<Item>();
              // create items
              Item i1 = new Item();
              i1.param1 = 4;
              i1.param2 = 4;
              Item i2 = new Item();
              i2.param1 = 3;
              i2.param2 = 7;
              Item i3 = new Item();
              i3.param1 = 5;
              i3.param2 = 7;
              // add items
              mySet.add(i1);
              mySet.add(i2);
              mySet.add(i3);
              // output
              for (Iterator<Item> iter = mySet.iterator(); iter.hasNext();) {
                   Item element = iter.next();
                   System.out.println("ITEM: param1="+element.param1+"  param2="+element.param2);
    }Please, could anyone give me some hint - I need to have for example this classes:
    class TreeSetOrderByParam1 { ... }and
    class TreeSetOrderByParam2 { ... }and I need inserted items will be ordered differently (according to name of its class).
    Thanks in advance for any help.
    Message was edited by:
    radone

    Hello,
    there appears to be some confusion here. You can't order the items in a set. There are basically three collection types in java.util: lists, sets and maps.
    Lists are an ordered collection of objects. You have ArrayList, which is fast for access but slow for inserting and deleting objects. You have LinkedList, which is a bit slower for access, but much faster for inserting and deleting objects.
    Sets are an unordered collection of objects. You have HashSet, which is fastest for access. You have TreeSet, which is a bit slower for access, but stores the objects in their natural order. However, you can't change the order!
    Maps are for storing (key, value) pairs. You have HashMap, which is fastest for access and TreeMap, which stores the pairs according to the natural order of the keys.
    If you want to order and reorder objects you have to use lists!
    There are two ways for ordering objects. The first is that the objects implement the Comparable interface. The method
    public int compareTo(Object o)determines the natural order of the objects. The method returns a negative integer if this object is less than the object in the argument. The method returns 0 if this object is equal to the method in the argument. The method returns a positive integer if this object is greater than the object in the argument.
    You can order the objects in a list according to their natural order with the method Collections.sort(List<T> list) in the package java.util.
    If you want to define a custom order on your objects, you have to create an object that implements the Comparator<T> interface in the package java.util. This interface has two methods:
    public int compare(T o1, T o2)
    public boolean equals(Object obj)The compare method returns a negative integer if o1 < o2, returns 0 if o1 == o2 and returns a positive integer if o1 > o2. The equals method returns true if and only if this comparator object is equal to the object in the argument. (The latter method makes only sense if you also include the comparator object in your list.)
    You can order the objects in a list according to a custom order defined by a comparator with the method Collections.sort(List<T> list, Comparator<? super T> c) in the package java.util.

  • How do I get an ordered collection with a CMP relatioship?

    Hello,
    I'm actually learning to use CMP. I'm trying to read a list of items from a table. I defined a getItemCollection function, linked to a relationship defined in my ejb-jar.xml. When I call the getter function, It returns a randomly unordered collection. I was expecting to get the returned collection in natural order.
    So my question is:
    1) how do I get a collection of items in natural order with a relationship defined getter?
    2) how do I get an ordered collection from a relationship defined getter?
    If I would be using a ejbSelect function, I would use an "order by", but in this case, I couldn't find any information.
    Thanks for any help.

    #div1 {
        background: url(BG-img1.jpg) no-repeat center center fixed;
        /**for Safari,Chrome**/
        -webkit-background-size: cover;
        /**for Firefox**/
        -moz-background-size: cover;
        /**for Opera**/
        -o-background-size: cover;
        /**for other browsers**/
        background-size: cover;
    #div2 {
        background: url(BG-img2.jpg) no-repeat center center fixed;
        /**for Safari,Chrome**/
        -webkit-background-size: cover;
        /**for Firefox**/
        -moz-background-size: cover;
        /**for Opera**/
        -o-background-size: cover;
        /**for other browsers**/
        background-size: cover;
    HTML
    <div class="gridContainer clearfix">
         <div id="div1">
              div 1 content goes here....
         </div>
         <div id="div2:>
              div 2 content goes here...
         </div>
    </div>
    Nancy O.

  • Collecting data from multiple rows into one column

    I'd like to run a query and put a collection of items into one output column instead of multiple rows. See the example below:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Prod
    PL/SQL Release 10.2.0.5.0 - Production
    "CORE     10.2.0.5.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
         CREATE TABLE "SKIP"."INGREDIENTS"
       (     "INGRED_ID" NUMBER,
         "INGRED_NAME" VARCHAR2(20 BYTE),
         "STORES" VARCHAR2(20 BYTE)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.INGREDIENTS
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (1,'SEA SALT','Food lion');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (2,'TABLE SALT','Food lion');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (3,'FLOUR','Piggly Wiggly');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (4,'YEAST',null);
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (5,'BEER','ABC Store');
      CREATE TABLE "SKIP"."PRETZELS"
       (     "PRETZEL_ID" NUMBER,
         "PRETZEL_NAME" VARCHAR2(20 BYTE),
         "PRETZEL_DESC" VARCHAR2(100 BYTE)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.PRETZELS
    Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (1,'CLASSIC','Classic knot pretzel');
    Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (2,'THICK STICK','Straight pretzel, abt 1/2" in dia');
      CREATE TABLE "SKIP"."INGRED_XREF"
       (     "PRETZEL_ID" NUMBER,
         "INGRED_ID" NUMBER
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.INGRED_XREF
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,1);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,2);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,4);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,2);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,3);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,5);
    --  Constraints for Table INGRED_XREF
      ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("PRETZEL_ID" NOT NULL ENABLE);
      ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("INGRED_ID" NOT NULL ENABLE);
    {code}
    Desired output (note how the ingredients are all listed in one column, separated by commas):
    {code}
    PRETZEL_ID PRETZEL_NAME     PRETZEL_DESC                        INGREDIENTS
    1          CLASSIC          Classic knot pretzel                SEA SALT, TABLE SALT, YEAST
    2          THICK STICK      Straight pretzel, abt 1/2" in dia   TABLE_SALT, FLOUR, BEER

    See the FAQ : {message:id=9360005}
    Especially links concerning string aggregation.

  • Collections Missing Files - Is there a way to fix them all at once?

    Hello,
    Due to new computer, all files has been moved to a new location.
    Obviously, the collections I have can't find them now and reporting "Missing Files".
    Now, I need to fix them by finding them folder by folder, and since the collections contains items from many folders, It will take hours to fix them all so I wondered if there is a way to tell Bridge about the new location of the files all at once.
    I hope I managed to explain what I'm looking for.
    Thank you,
    shlomit

    Which OS?  If on Windows you can find your Bridge collections list at (win 7 bridge cs6 example):
      C:\Users\user-name\AppData\Roaming\Adobe\Bridge CS6\Collections
    The files in Collections folder are .filelist - text xml format.  You could copy filelists from the old system's Collections folder to the Bridge AppData Collections folder in your new system so long as all the referenced files listed in the collection filelists are in the same disks and folders on your new system.

  • Restrict Item Category Item Creation using Reference Only

    Hi All
    Here is the scenario, I want  "Restrict Item Category Item Creation using Reference Only"
    a.Retrieve document number VBELN from sales order header table VBAK for the current order. Check if the sales order is of type ‘ZAB’ referencing field AUART in table VBAK.
    note : Any changes to existing sales order "ZAB" will be performed in thesame sales order type(ZAB) in VA02 transaction.
    b.If step a is passed, check internal table structure for sales order item level as XVBAP-PSTYV for possible item category values of 'ZDEF' for the entered line item and document number (XVBAP-VBELN).
    c.If the cancel/change item category values are found on the line item, check internal table structure for document flow (XVBFA) if the cancel/change item category was created as reference:
    i.Check if entry exists in XVBFA for the preceding document number field VBELV with value equal to value in the subsequent document number field VBELN. This value must equal the current sales document number VBELN in table VBAK.
    ii.The above check must be done in conjunction with the following check:
                1.Check if entry exists in XVBFA for the preceding document type field VBTYP_V with value ‘C’ equals subsequent document type field VBTYP_N with value of ‘C’.
    d.Once the above checks are passed, collect the item number from internal table XVBAP (Field: POSNR) for the change/cancel item category line item added to the sales order.
    e.Check if the item number retrieved in the previous step exists in table VBAP (Field: POSNR) with an item category that is not part of the list of cancel/change item category defined in step b.
    f. Check if the item number collected in the previous step exists in the subsequent item number (Field : POSNN) in internal table XVBFA for the row that passed checks in steps b and c.
    g.If item number exists, check if this subsequent item number field equals the preceding item number field value (Field: POSNV) in table XVBFA.
    h.If step g fails, generate an error message stating that the user needs to the create the cancel/change item category line item with reference to the original line item and do not allow the user to proceed with the transaction.
    i.If step g succeeds, allow the user to proceed with the transaction.
    can any one send me the logic for this scenario.
    Rgds
    Chinna

    Hi Chinna,
      Please use BADI "BADI_SD_SALES_ITEM" to achieve your requirement..
      Let me know if you have further questions..
    BR
    Rakesh

Maybe you are looking for