Line Number in sequence for Order No

HI,
I am using AIA Approach to Insert data from Legacy System to Target Sysytem(Database Adapter).
I need to insert line number in the database for eache OrderNo and for same repeated Order No, it shoud count plus 1 and if differnt Order number will come need to count from 1.
can we achieve this using XSLT by Grouping??
or
we need to do query in the databse?
I want to insert line no inthe field, if orderNo is already exist in the database it shoud count +1.
i.e. order no is 123 count as 1
if order no will repeate again as 123 count as 2
if there is diffferent order no come as "xyz" count again as 1
PLease Help me on this.
Thanks For Advance.
Edited by: 895089 on May 14, 2012 4:48 AM

This can be done in XSL OR in procedure on the DB side. Performance wise better to do in procedure as mentioned by other use. You can choose to go with DB or XSL approach depending on number of orders you are expecting in a single message. If it is going to be 100s or few thousand messages then keeping it in XSL is not a problem. But if you are planning tens or hundreds of thousands of orders in the same request then better do it in stored procedure.
How do you do in XSL?
1. Put a for each on every unique order no. You can use xsl:Key or xslt:distinct-values() for this.
2. Within for each unique value of order no, use position() function to pass line/order no as 1,2,3... etc. As soon as the loop moves to second iteration for the next unique order no, count will automatically start again from 1,2,3... and so on.
Apart from slightly slower processing time, another drawback from this approach is that the data in the XML you send to DB procedure will be sorted by order numbers. All orders with same number will appear together.
Another problem with this approach is that this will work only within one request, i.e. if the next request contains an order with same no which was already sent in a previous request, for this order the count will again start from 1. So if you want to keep the sequencing maintained across multiple requests, the easiest way to do is in the DB procedure where you can lookup in the table before inserting a new row and insert with next sequence of that order no.

Similar Messages

  • Delivery schedule line number in make to order

    Hi all,
    i am doing make to order scenario with 20 strategy group. In sales order we r defining the different delivery schedule lines.when i run the MRP and getting the plan orders for all the FG material and semifinished material, the sale order number and sale order item number is getting updated in production order . Beside these two , delivery schedule line number is not populated and delivery date is not picking correctly in production order.
    please give your valuable suggestion .
    i would be highly thankful to u
    regards
    piyush

    Hi
    When you do the MRP Run at MD02, maintain the Delivery Schedules as 3 (schedule lines), so when ever you do the MRP Run, it will run along with the delievry date.
    reward if it helps
    Regards
    Prasanna R

  • Delivery schduline line number in make to order

    Hi all,
    i am doing make to order scenario with 20 strategy group. In sales order we r defining the different delivery schedule lines.when i run the MRP and getting the plan orders for all the FG material and semifinished material, the sale order number and sale order item number is getting updated in production order . Beside these two , delivery schedule line number is not populated and delivery date is not picking correctly in production order.
    please give your valuable suggestion .
    i would be highly thankful to u
    regards
    piyush

    Hi
    When you do the MRP Run at MD02, maintain the Delivery Schedules as 3 (schedule lines), so when ever you do the MRP Run, it will run along with the delievry date.
    reward if it helps
    Regards
    Prasanna R

  • How do I get the line number of the sales order and how do I save info?

    I am trying to create a form that is able to be called from a right click on the sales order matrix and will display some of the user defined fields associated with the line.
    I've managed to create a form and add a menu option to the right click but I'm now stuck because of the following:
    1. How to I know which line the user selected? I need the REAL Line Number from the RDR1 table because I need to use it on the data filter of the form.
    2. I hard coded a line to just to see if I can load a form and it appears to load and bind the data to the controls, but how do I save changes made? There are several text fields, combo boxes, and a picture control.

    Hi Coleman,
    1. The pVal returned form a menu event does no provide the LineId, but a pVal from a Item Event does. I suggest you use a DoubleClick or Control + Click on the Line to trigger an event that you can catch and use to launch your form.
    2. Please note that if the Sales Order line is closed you'll not be able to update the values. If it's not, then you need to instantiate a Sales Order document, get the correct document with the GetByKey method and update whatever fields you need.
                    Dim oSalesOrder As SAPbobsCOM.Documents = oCompany.GetBusinessObject(BoObjectTypes.oOrders)
                    If oSalesOrder.GetByKey(docentry) = True Then
                        oSalesOrder.Lines.SetCurrentLine(pVal.Row - 1)
                        oSalesOrder.Lines.UserFields.Fields.Item("U_MyUDF").Value = ""
                        oSalesOrder.Update()
                    End If
    Regards,
    Vítor Vieira

  • Line Order No doesnt match with Invoice line number

    At the line level , the line order no doesnt match with the invocie line number
    ie. say for example in a sales order we have 3 lines
    1. A
    2. B
    3. C
    where as in transaction at AR level the line no is different
    1. B
    2. A
    3. C
    the customer wants in AR also the line no should be same as sales order line nos
    Please help us what is the setup where we define the line level numbering in AR.
    I have checked the line ordering rules but i am not clearly understanding, if anyone can explain with an example how this no generates witht he setup details it would be great

    This can be done in XSL OR in procedure on the DB side. Performance wise better to do in procedure as mentioned by other use. You can choose to go with DB or XSL approach depending on number of orders you are expecting in a single message. If it is going to be 100s or few thousand messages then keeping it in XSL is not a problem. But if you are planning tens or hundreds of thousands of orders in the same request then better do it in stored procedure.
    How do you do in XSL?
    1. Put a for each on every unique order no. You can use xsl:Key or xslt:distinct-values() for this.
    2. Within for each unique value of order no, use position() function to pass line/order no as 1,2,3... etc. As soon as the loop moves to second iteration for the next unique order no, count will automatically start again from 1,2,3... and so on.
    Apart from slightly slower processing time, another drawback from this approach is that the data in the XML you send to DB procedure will be sorted by order numbers. All orders with same number will appear together.
    Another problem with this approach is that this will work only within one request, i.e. if the next request contains an order with same no which was already sent in a previous request, for this order the count will again start from 1. So if you want to keep the sequencing maintained across multiple requests, the easiest way to do is in the DB procedure where you can lookup in the table before inserting a new row and insert with next sequence of that order no.

  • OrderItem- Line number

    Hello,
    i got one Order XML from SAP system which shows the Line number as " 1" for more than 1 order item.
    <orderItem lineNum="1" materialCode="123456" materialQuantity="1" stockPlant="123" storageLocation="1234">
    <lineItemPrice value="123"/>
    <lineItemDiscount value="0.0"/>
    <orderItem lineNum="1" materialCode="98766" materialQuantity="1" stockPlant="987" storageLocation="9687">
    <lineItemPrice value="987"/>
    <lineItemDiscount value="0.0"/>
    from avoce sample data assume first linenum represemts material 123456 and second represents matrial 98766.
    now problem is if i order 123456, i am getting 98766 due to same linenum. how to resolve this issue.
    can we predit this at SAP SD.
    please let me know what are settings /logic applied for LineItem while generating Orders.

    Hi Chun,
    just follow this code.
    private static JCO.Client client;
    private static JCO.Repository repository;
    client =
    JCO.createClient(
    "<client num>",
    "<user name>",
    "<password>",
    "en",
    "<server ip or server name>",
    "<instance number>");
    client.connect();
    repository = new JCO.Repository("REP", client);
    try {
    IFunctionTemplate m_read_container;
    m_read_container =repository.getFunctionTemplate("<RFC Name>");
    JCO.Function function_read_cont = m_read_container.getFunction();
    JCO.ParameterList tables =
    function_read_cont.getTableParameterList();
    //For Tables
    JCO.Table table = tables.getTable("<Your table Name from table parameter>");
    <b>// specified number of empty rows at the end of the table
    table.appendRows(<Enter the number of expected rows>);
    for(int i=0;i<table.getNumRows();i++)
    // Moves the row pointer to the next row
       table.nextRow();
    // public void setValue(<Data Type> value,java.lang.String fieldName)
    //  set the field values . must have a look at the data type of the field to be set.
    // Here can use table.getNumColumns()  .. to find out the number of of columns in the table , and loop through this...
        table.setValue(<use type casted data value>,<fieldName>);
    }</b>
    // Execute the RFC
    client.execute(function_read_cont);
    } catch (Exception e) {
    For function details  just refer these links.
    JCO API
    http://www.huihoo.org/openweb/jco_api/com/sap/mw/jco/JCO.html
    JCO.Table
    http://www.huihoo.org/openweb/jco_api/com/sap/mw/jco/JCO.Table.html
                                            Regards
                                              Kishor Gopinathan

  • How to determine line number on Table control in BDC

    Hi,
    I am uploading changes for CG02 using BDC. I have to change data to specification type which are listed in a table control having some of the fields as IDCAT, IDTYPE, LANG, ORD, IDENT etc.
    For a particular substance number, there can be variable number of idtypes. Since there were 8 Idtypes already created for the substance number I was working with while recording and I created 9th Idtyep(Z_SARADOT#) while recording (Using SHBD), I am getting the code like ...'ESTRI-IDTYPE(09)....ESTRI-IDCAT(09).....'RCGRIIOT-IDENT(09)' which indicate that while recording, the values were added on 9th line of table control.
    Now this line number can vary for other substance number. How can I know
    (1) The last line of table control
    (2) Line number based on Value of field
        Example - here I want to know line number corresponding to IDTYPE Z_SARADOT# if it was created so that I can change the value of field IDENT of the table control.
    The piece of code I got after recording is:
              perform bdc_field       using 'ESTRI-IDTYPE(09)'
                                            'NUM'.
              perform bdc_field       using 'ESTRI-IDCAT(09)'
                                            'Z_SARADOT#'.
              perform bdc_field       using 'RCGRIIOT-IDENT(09)'
                                            '1175'.     
    Please help friends.
    Thanks & Regards,
    Surya

    There are around 800 Substance numbers and for each substance number there are around 10 IDtype. So It would be a costly processing.
    If there no other way doing it?
    I think, I need to follow this way as We can not determine the line number untill BDC is running.

  • They sent me a serial number for a windows version of PS Elements when I ordered a mac version.  The serial number doesn't work, not surprisingly, but they don' t seem to care.  I have tried the chat line and have waited for almost a day with no response.

    They sent me a serial number for a windows version of PS Elements when I ordered a mac version.  The serial number doesn't work, not surprisingly, but they don' t seem to care.  I have tried the chat line and have waited for almost a day with no response.  What should I do?

    Look here
    Order product | Platform, language swap

  • MIGO-sales order number and line item not validated for 501E mvt in MIGO.

    Hi All,
    In MIGO i am trying to post for 501E(specisl stock=order on hand) movement type, here i am entering the material and in the where TAb even if I enter wrong sales order number or wrong sales order line item number. the system allows to post .
    its not validating the material against the sales order number and line item number that is entered to check whether that material really exists in that particular sales order or not.
    is there a way to fix this?
    Thanks
    Mahendra

    hi
    i dont think vvalidation is possibel
    as the system dont know whaich material is assigned to which SO
    as we r takeing the stock without PO
    if u want to validate then system can validate the quantity that is also with use of some user exit
    correct me if i am wrong

  • Same serial number or sequence no for orders of fert n halb

    Hi all,
    we have a make to order production and it has two levels ie final assembly and semi finished . now my client wants to have same serial number or sequence number to be generated for both production orders ie fert and halb. one more thing to mention here is we use schedule agreement for sales orders.so all the orders of fert and halb have same scheduling agreement.
    thanks in advance

    Hi
    Are you talking about the production order number?
    Regards
    Ranga

  • Delivery schedule line number in sales order is not populated in production

    Hi all,
    i am doing make to order scenario with 20 strategy group. In sales order we r defining the different delivery schedule lines.when i run the MRP and getting the plan orders for all the FG material and semifinished material, the sale order number and sale order item number is getting updated in production order . Beside these two , delivery schedule line number is not populated in production order.
    please give your valuable suggestion .
    i would be highly thankful to u
    Will reward points.
    Regards
    Kumaraguru

    Hi Kumar,
    Some changes done in your PRD server.If yes then contact abap consultant regarding the same.
    Because these type of problem comes when you do transport or changes done in the system.
    Regards,
    Anil

  • Delivery schedule line number in sales order is not populated  in productio

    Hi all,
    i am doing make to order scenario with 20 strategy group. In sales order we r defining the different delivery schedule lines.when i run the MRP and getting the plan orders for all the FG material and semifinished material, the sale order number and sale order item number is getting updated in production order . Beside these two , delivery schedule line number is not populated in production order.
    please give your valuable suggestion .
    i would be highly thankful to u
    Regards
    Kumaraguru

    Hi Kumar,
    Some changes done in your PRD server.If yes then contact abap consultant regarding the same.
    Because these type of problem comes when you do transport or changes done in the system.
    Regards,
    Anil

  • Display  Purchase order, PO Item , Order Number ,entry sheet quantity ,entry sheet price ,invoice quantity, invoice price  against each line number

    hello all,
    i have an ALV report requirement like this,
    on the initial screen i have displayed(for a given agreement number like in ME33K )
    in the selection screen i have taken agreement number as EKPO-EBELN.
    purchase document number        item number        short text        target quantity      net price
    5400000019                                  1                      xxx                  1.000                  304300.00
                                                        2                     xxxx                 1.000                  500000.00
    the above fields i have taken from EKPO table.....
    and on double clicking the  item number i have displayed
    line number          service number       short text           quantity    units    gross price   quantity released
    1                           swr10                   xxxx                 2.00          kg          500             2
    2                           swr11                    xxxx                5.00          EA         500             2
    the above fields i have taken from ESLL (esll-extrow, esll-srvpos, esll-ktext1 , esll-menge  etc......)
    this i have done by passing EBELN to ESLH and getting PACKNO and passed this PACKNO to ESLL.
    now my question is i need to display  Purchase order, PO Item , Order Number ,entry sheet quantity ,entry sheet price ,invoice quantity, invoice price
    against each line number above.....
    from which table do i need to take these fields.....
    please guide me....
    thankq....

    Thanks Andra,
    The problem is the multiple invoices is for non goods receipt item so there will be no delivery.At the time of creating a PO the GR is not checked so there will be no delivery .
    Also this setting is for invoices which are comming from Vendors.But if we are genrating the invoices manually it is not blocking those invoices.Also i there is nowhere mentioned in Incomming invoice to set tolerence for incomming invoice.Are you talking about Vendor tolerences?
    Thanks in advance
    Edited by: Metroid01 on May 14, 2009 6:52 PM

  • Table name for order schedule line changes

    Hi Friends,
    There is a background program running periodically. Sometimes line items confirmed dates changed, we want to know a way that what line items for orders are changed. Is there any table, which would give the schedule changes information for the line item or there any other method to find it. Your answered much appreciated. Thank you!
    Regards
    Raji
    Edited by: raji reddy on Jun 5, 2008 4:24 PM

    Hi Raji,
    These are the standard tables where SAP stores change details for all areas of the system. The initial key is the object class and you need to enter this to get a quick access via SE16 - VERKBELEG is the key for sales documents. If you then have, for example, a sales order number you can enter that (but ensure you enter leading zeroes) and a table and/or field name.
    Regards,
    Brian

  • Table where i see actual cost line item for order (KKBC_PKO)

    Dear.
    Using transaction KKBC_PKO i can see the actual cost line item for order.
    In which table I see these data ?
    Thanls

    Hi,
    check COEP (CO actual line items) the objectnumber is OR+the order number.
    Best regards, Christian

Maybe you are looking for