Assigning sequential number from number range

Hi All,
My Zreport is updating Ztable with sequential number field assigned for each document numbers for each period. Below are the numbers assigned for period 5 in Ztable.
00001000000000000000
00001000000000000001
00001000000000000002
00001100000000000000
00001200000000000000
00001200000000000001
00001200000000000002
00001200000000000003
When I ran for period 6 the sequence number is coming as below.
00001000000000000003
00001000000000000004
00001100000000000001
00001200000000000004
00001200000000000005
00001200000000000006
It should give me the below.
00001000000000000003
00001000000000000004
00001100000000000000
00001200000000000004
00001200000000000005
00001200000000000006
I am fetching the data from Ztable and sorting in descending order. Below is the data in my internal table in debugging.
bukrs belnr           blart   monat   numkr      zsequence
2700 |1700002431 |KA   |05         |03         |00001200000000000003
2700 |5100000804 |RE   |05         |02         |00001100000000000000
2700 |2200000004 |P2   |05          |01         |00001000000000000002
Below is my code.
      loop at t_ztable.
        clear w_zsequence.
        unpack t_table-zsequence to t_ztable-zsequence.
        if (t_ztable-zsequence = '00001200000000000000' or
             t_ztable-zsequence = '00001100000000000000' or
             t_ztable-zsequence = '00001000000000000000' ).
        w_zsequence = t_ztable-zsequence
        else.
          w_zsequence = t_ztable-zsequence + 1.
          unpack w_zsequence to w_zsequence.
        endif.                                              "BK003
*   shift w_zbelnr left deleting leading space.
        loop at t_bkpf
              where bukrs = t_ztable-bukrs
                and groupnumber = t_ztable-numkr.
          move-corresponding t_bkpf to t_ztable_load.
          t_ztable_load-zsequence = w_zsequence.
          t_ztable_load-numkr = t_ztable-numkr.
          append t_ztable_load.
          w_zsequence = w_zsequence + 1.
*         shift w_zsequence left deleting leading space.
          unpack w_zsequence to w_zsequence.
        endloop.
      endloop.
How to acheive this. Please help me.
Thanks,
VBK

Hi Haritha,
Can you show us the table t_bkpf dataon which you are looping?
Regards,
Sudeesh Soni

Similar Messages

  • Billing Document Number saved with Preceding Number from Number range...

    Hi Everybody,
    I am facing with some irregular problem which is as follows :
    For example, Billing Docs created in the month of January was saved with number series like 10161, 10162, 10163 .....and so on....
    But the user has creatd the document in February and it got saved with number like 10121......which is a preceding number and there is only one document like this....
    The number range is Internal Number Range...even though it got saved with preceding number.
    Can anybody plz tell me why this has been happened ?????
    Proper answer will be rewarded....
    Thanks in advance....

    Hi Chaitanya,
    Please check whether someone has changed number status in VN01 and previously 10121 was not used.
    also check whether you are using ztable for number range depending upon plant.
    Regards,

  • Skipping number from assigned number range in PR

    During the creation of Purchase Requisition system is not issuing a sequential number. For instance the number range assigned to document type is '120000000'  system issues number 120000001 to first PR. If we create second PR the number is not 120000002 but its either 120000005 or some other number from the same number range but not next number in the sequence.

    hi,
    For Requisitions generated by the MRP, if the fixed indicator on the
    Requisition is not selected or the release indicator does not have a
    final release, then when MRP is run again the original Requisitions can
    be overwritten with a new one if the requirements change.
    It depends on the settings and the different fixing and planning mode
    indicators used in MD01 or MD03 or MD15, ....
    So what may have happened in your system is the following :
    - The MRP created Requisitions that were consequently not fixed (i.e.
      EBAN-FIXKZ = blank), which is normal.
    - A user changed the Requisitioner (AFNAM) and / or the Purchasing
      Group (EKGRP) in ME52N.
      This did not fix the Requisitions, which is also normal.
      A Requisition becomes fixed in ME52(N) only if at least one of the
      following fields are changed EBAN-MENGE Quantity
                                   EBAN-LFDAT Delivery date
                                   EBAN-FRGDT Release date
    Please also  check BADIs and user exits that changes the requisition.
    Best Regards,
    Arminda Jack

  • How to assign numbers in external number range?

    Dear experts,
    Since NUMBER_GET_NEXT can only be used to assign numbers in internal number range, how to assign numbers in external number range?
    So far, I only know the NUMBER_CHECK function module to deal with external number ranges and it only check a number whether it lies in any external number range or not, but it doesn't update any number range status. What I need is a function module like NUMBER_GET_NEXT that supports external number range.
    Thanks in advance.
    Regards,
    Haris
    Edited by: harissahlan on Oct 19, 2011 5:44 AM

    With external number range, there is no updating of the number range objectt. The only thing you need to know is whether the number you wish to assign is allowed according to the external number range. And also check if there isn't already an object/document with the same number in the database.

  • Assign batch number from sale order to production order automatic

    Dear all, I have a question for all. Please help me in this case
    My scenario is make to order
    I have a sale order, when i create sale order, i have assigned batch number at each line item.
    When i run MRP for sale order (MD50), the system generate a planned order for it and I've converted to production order.
    So when I view production order, I think that batch number what I've assigned to sale order will be assign to production order but that is not happen.
    So, can you help me solve this problem. I think that sap can assign batch number from sale order to production order automatic but i don't know how to configure that
    Thanks all

    Hi,
    To the best of my knowledge, when system is generating planned order / production order from sales order system doesnt copy batch number from sales order.
    In fact , you are following wrong practice for generating batch no.
    Follow procedure like this :
    Create sales order without any batch assigning there. Run MRP with MD50 and then convert planned order to Production Order.
    While creation / releasing of Production order, you have option to generate batch automatically by following way :
    Go to OPKP (Production Scheduling Profile) -> Take your plant & give suitable name to Production scheduling profile-> Batch Management tab -
    > Automatic Batch creation in the order maintain this field as
    1     Automatic batch creation at order creation
    or
    2     Autom. batch creation at order release
    This will generate batch number automatically at the time of creation or release of order.
    Then follow same process i.e. Goods Issue, Confirmation & GR for production order.
    So you will get sales order stock in the form of batch managed.
    Check & revert if any issue in above flow.
    Regards,
    Tejas

  • Missing PRCTR from Number Range Table

    Hi There,
    I need to find out all the the available profit centre which not created yet ie no profit centre  available in CEPC from the number range table NRIV.
    I tried the FM number_get_next but nothing happened.
    Details given below:
    In the NRIV table I have got say following details :
    Object          From Number     To Number    etc     etc
    Y_PC          0000000001     0000000100
    Y_PC          0000000101     0000000150
    Y_PC          0000000160     0000000200
    Profit Centre Created Available in CEPC say
    In the no range 1 to 100
         0000000001
                    0000000002
                    0000000003 (Not created)
         0000000004
                    5 ,6 & 7 missing
         0000000008
    In the no range 101 to 150
         0000000101
                    0000000102
         0000000103
                    0000000104 (Not created)
         0000000105
                    6,7....upto 149...(Not created)
         0000000150
    Similarly in other ranges few nos missing
    My requirement is to read the NRIV table take all  from number and to number into an internal table  and for those nos find the  missing nos from the CEPC table .
    Appreciate your help.
    Regards.
    Sunanda

    Resolved by myself !!
    Cheers.

  • I set up my iPhone through iCloud but assigned the wrong cell number to it so I am getting messages that don't belong to me but rather to my husband as I entered his cell number in there - how do I change that number to stop this from happening??

    I set up my iPhone through iCloud but assigned the wrong cell number to it so I am getting messages that don't belong to me but rather to my husband as I entered his cell number in there - how do I change that number to stop this from happening??

    Also, if you are sharing an Apple ID, you will get his iMessages.

  • Error when determining  a number from object BI_ODS

    Error When determining a number from object BI_ODS and number 01  when flat file source system is assigned to transfer rules of infosource , when activating this error occured .
    plz need solution.

    Hi,
    Number ranges can be maintained through the transaction SNRO. For details check:
    http://help.sap.com/saphelp_nw70/helpdata/EN/2a/fa02e3493111d182b70000e829fbfe/frameset.htm
    Rgds-
    Sonal

  • How to get page number from the PDF using Javascript

    Hi,
    We are having list of Single page PDF. The pdf are named in the order,
    ISBN_Author_01.PDF  (with real page number as i)
    ISBN_Author_02.PDF  (with real page number as ii)
    ISBN_Author_03.PDF  (with real page number as iii)
    ISBN_Author_04.PDF  (with real page number as 1)
    ISBN_Author_05.PDF  (with real page number as 2)
    ISBN_Author_06.PDF  (with real page number as 3)
    ISBN_Author_nn.PDF  (with real page number as 500)
    Here each pdf has a page number and in sequential order.
    The task is to check whether all the pdfs are in sequential order (i.e i, ii, iii, 1, 2, 3). If any page is missing, the script should throw an error report.
    To do this task, I am writing a Javascript to get the real page number from the PDF.
    Can anybody help me how to get the page number from the PDF using Javascript.
    Thanks,
    Gopal

    The "real" page number within a PDF is the count of the physical page starting at 0, zero.
    pageNum numPages
    The number printed on each page is the page label.
    setPageLabels  getPageLabel
    You will have to open each PDF and your script would need to know the page label for that file. I would expect you would need to build a 2 dimensional  array of the file names and the page label for the page within that array.

  • How can I remove the page number from the first page of the document that is the cover page?

    How can I remove the page number from the first page of the document that is the cover page?

    If you open the Pages panel, (Window>Pages) you will see thumbnails of your master pages and your document pages. In new documents, there is usually a master called A-Master and one called None. If you drag the thumbnail of the None master onto the thumbnail of a document page, it will apply that master to that page. Presumably, you have made your page numbers on A-Master, so this will usually do the trick. If you have elements on A-Master that you need on the first page, but just not the page number, you can duplicate A-Master (which, by default will give you B-Master, but you can change the names if you like) and remove the page number on the duplicate and apply that to the document page.
    It might also be worth noting that you can apply master pages in the fly-out of the Pages panel. Go to the fly-out triangle and go down to Apply Master to Pages…, then select a master to apply and the range of pages (1-8 will give you all 8, 1, 3, 5, 7 will be the odds, 1-3, 4, 6-8 if you want continuous ranges and individual pages).

  • In XI mapping, how to get number from a number_range object in SAP R/3

    HI All,
    I have a scenario where I need to read a Number_range object  in SAP R/3 or ABAP XI and retreive the current number.
    I need to use this number during the message mapping.
    (I read about JCO and RFC, but am a little confused about how-to and what is the correct approach)
    Just to let you know, I do not want to pass this number in the original IDOC coming from IDOC, so I need this lookup.
    Scenario:
    In MM, make a call to SAP.
    Get the latest number from SNRO( number-range object)
    Use this number in mapping.
    Any help pointers, greatly appreciated.
    Many thanks
    Shirin

    Shrin,
    Please find the parameters you need to specify while creating UDF
    Imports:javax.xml.transform.stream.StreamResult;com.sap.aii.mapping.lookup.;javax.xml.transform.dom.DOMSource;javax.xml.parsers.DocumentBuilder;java.io.;javax.xml.parsers.;org.w3c.dom.;org.xml.sax.;javax.xml.transform.;
    The Template for RFC Lookup
    String content = "";
    MappingTrace importanttrace;
    importanttrace = container.getTrace() ;
    //Filling the string with our RFC-XML (With Values)
    String m = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:<Function Module name>xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"></ns0:ZFI_GET_RUNID> ";
    RfcAccessor accessor = null;
    ByteArrayOutputStream out = null;
    try
    //1. Determine a channel (Business System, Communication channel)
    Channel channel = LookupService.getChannel("<Business System Name>","Communication channel name");
    //2. Get a RFC accesor for a channel.
    accessor = LookupService.getRfcAccessor(channel);
    //3. Create a xml input stream representing the FM request message.
    InputStream inputstream = new ByteArrayInputStream(m.getBytes());
    //4. Create xml Payload
    XmlPayload payload  =  LookupService.getXmlPayload(inputstream);
    //5. Execute Lookup
    Payload result = accessor.call(payload);
    InputStream in = result.getContent();
    //This are the extra step which i dont know what it mean
    //out = new ByteArrayOutputStream(1024);
    //byte[] buffer = new byte[1024];
    //for (int read = in.read(buffer); read > 0; read = in.read(buffer))
    //out.write(buffer,0,read);
    //content = out.toString();
    try {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(in);
    NodeList list = document.getElementsByTagName( "REsult" );
    Node node = list.item(0);
    if (node  != null)
         node = node.getFirstChild();
         if (node  != null)
              content = node.getNodeValue();
    } catch (Exception e) {
    importanttrace.addWarning("Error while closing accesor" + e.getMessage());
    catch (LookupException e)
    importanttrace.addWarning("Error While lookup" + e.getMessage());
    //This exception is not to be catch at this step as there is no try step before this
    //catch (IOException e)
    //importanttrace.addWarning("Error" + e.getMessage());
    finally
    if(out!=null)
      try{
           out.close();
    } catch (IOException e) {
    importanttrace.addWarning("Error while closing system" + e.getMessage());
    //7. close the accessor in order to free resources
    if (accessor!=null) {
    try{
          accessor.close();
    } catch (Exception e) {
    importanttrace.addWarning("Error while closing accesor" + e.getMessage());
    return content;
    Have mentioned in genric  where u need to specify the communication channel name, business service etc.,
    Moreover there is a field result, which is the output returned from the FM

  • Copying PO Number from SO Number to Billing Document

    Hello,
    My requirement is that I need to copy the PO Number from Sales Order to the Billing document whenever there is a Return Order created. What would be the Copy routine number that I need to modify? Or do I need to create a new Routine and then update the Billing Item with the PO Number from Return Sales Order? Please let me know.
    Thank you,
    Venkata Phani Prasad K

    Hi
    What subroutine VOFM are you using in your copy rules? Copy this VOFM to your own VOFM in your range name, and add a line to copy the PO number from SO to invoice (see Note 327220 - VOFM function and its objects).
    Regards
    Eduardo
    PD: sorry, I wanted to update it and I've replied to myself.
    Edited by: E_Hinojosa on Jan 31, 2012 3:39 PM

  • Current Number in Number Range Interval

    What does the current number in the Number range interval signify?
    Is it the next number to be assigned?
    Thanks
    Suzitha

    Hi,
    The current number in Number range names is the latest number which was already assigned.
    Regards,
    Thilak

  • How to get the Personal Number from Address Number

    Hi,
    I have one requirement which is as follows.
    I have one Customer. I am fetching Address Number(ADRNR) of this customer number from table KNA1.
    I want to find the Personal number linked to this Address number and Customer.
    Is there is any table or FM from where i will get the Personal number of the Customer using Customer number and Address number?
    Kindly Help

    Hi Sachin,
    Check this FM BUP_PARTNER_PERSNUMBER_GET
    " Check KNB1 and the Field name is PERNR, Most of the times this is not maintianed.
    " This refers to the Employees who are assigned as Customers
    " In XD03 go to the Company Code Data there you can find this Value
    " For more info contact your Functional Consultant
    " This is to the Best of my knowledge
    Also Check KNB1 but000 Tables
    Cheerz
    Ram

  • How I put a tracking number from sales until delivery

    Hi all:
    Need your help about tracking and MRP, so, I thinks this is not in exclusive problem, its possible that other need make it.
    I need obtain a tracking number from sales order unti delivery, need be assigned in the BOM header

    Before any else, thanks for you kind attention.
    In order to explain in detail my requerimient I know that is possible allocate the source of the new production order, that was created by MRP Wizard, this new recomendation have an origin from a production order from above level normally here in Mexico the name is Sub assemble maybe is not correct in english, when run the MRP process not exist a cross reference beetween the sales order number source and first production order (Header I express of this way), and the new production orden obtained after run MRP wizard.
    I hope this explanations can help to better.
    Thanks a lot

Maybe you are looking for