Problem in document number auto generation

Dear All,
       I have created a screen in this screen,i want to generate a auto generate number
      for that i have write a code but when am executing the program in VS2005,the form was loaded in SAPB1 2005,But am not getting the auto generate number in the particular coloumn.
It shows an error like pbject reference not set to an instance of an object
the code is,
    Private Sub DCNumber()
        Try
            oForm = SBO_Application.Forms.Item("FormEditor")
            Dim oRs As SAPbobsCOM.Recordset
            oRs = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            oRs.DoQuery("Select DocNum IS NULL THEN '1' ELSE DocNum+1 from @SCDC")
            Dim Auto As String = oRs.Fields.Item(0).Value
            oForm.Freeze(True)
            oForm.Items.Item("25").Specific.Value = Auto
            oForm.Freeze(False)
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message)
        End Try
    End Sub
I call this function in,
Public Sub New()
        MyBase.New()
        SetApplication()
        ' Load the Tab Order form
        LoadFromXML("SCDC.srf")
        oForm = SBO_Application.Forms.Item("FormEditor")
        oForm.Visible = True
DCNumber()
    End Sub

You could use Aslam's answer but then in one row and use it in a formatted search..
select ISNULL(MAX(DocNum),0) +1 from @SCDC
I think the error is in this line:
Dim oRs As SAPbobsCOM.Recordset
oRs = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Should be:
Dim oRs As SAPbobsCOM.Recordset
oRs = (SAPbobsCOM.Recordset) ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Or in:
Dim Auto As String = oRs.Fields.Item(0).Value
Dim Auto As String = oRs.Fields.Item(0).Value.ToString()
But you can set a breakpoint and debug your code, then it's possible to see where is trown the error..
HTH
Regards Teun
Edited by: Teun Aben on Apr 15, 2009 10:42 PM

Similar Messages

  • Batch number auto generation nedded

    hi all,
                  i have a query that when i make a GRPO of 10 items with different qty, these items are set to batch on every transaction, then it will ask to enter the batch number of all item with the number of their quantity, is there any process to create these batch number automatically, is there any formatted search query for auto generation of batch number.
    even they are making GRPO by taking 100 items, it is very difficult to for them to to enter manually all the batch code.
    is there any provision to do the task by formatted search.
    revert back soon
    its very urgent
    regards
    sandip

    Sandip, 
    I have answered a few posts on this Forum about the different options.  Formatted searches can be considered but you will need to maintain a temp table.
    What is the real usage of the batch numbers in this business case?
    Suda

  • Problem substituting document number into Assignment field

    We have a requirement to substitute document number and fiscal year into Assignment field when posted to a Sp.GL account (Using FB60). Sort key is substituting doc# and fiscal year into Sp.GL Assignment number. I am trying to use a substitution rule, but it's not working probably because the substitution is being called before document number is generated. Any thoughts or input on this is greatly appreciated.
    Thanks
    Edited by: Chandra Nallam on Jan 29, 2009 3:13 AM

    hi!! guys ,
    Can anybody help me on this BB module of Vistex pl.
    I have one very basic Questions and not getitng the right answer.
    Look at this Business scenario
    1) I have created Billback from Agreement and Invoice and I did accrued this BB like this there are various invocies I accrued thro various agreement and BB combination - I dont see any issues in Config here
    2) now we have got Claim request from the Customer (for the same Partners) now how do I validate what is demanded by customer is same or less or more then the accrual happened thro the BB of Invoice??
    So the issue here is mainly reconciliation of what accrued agains invoice need to be validated here in Claim document so I can take decision.
    so Is this Billback module has got a possibility of reconciling in vistex ???
    Let me know If you or any of your friennd can help me to understand this.
    As you rightly said the document provided by Vistex are really Bad and not much helpful. looking at this i dont see this Product has really helped us much.
    regards,
    Himanshu

  • SD Delivery Serial Number auto generation ?????

    Hi All,
    Hope some one is able to provide some points on this!!
    Basis Release 620.
    Client requires that the serial numbers be automatically generated for items copied from a sales order to a delivery note.
    Anyone got a clue as to how this can be accomplished?
    Copy requirements (vofm) for deliveries works on the delivery header level and not the item which is required.
    Data Transfer requirements like wise works at the header level.
    While the user exit "MOVE_FIELDS_TO_LIPS" does not have the required fields available, but does work at the item level.
    Where does SAP save the serial numbers for the actual number of items to be delivered?  EG
    Delivery Item (LIPS) links to Serial Numbers (????).
    Thanks in advance for any advice
    David Cooper

    Hi Sanjay,
    I agree the delivery document number has not been created yet, so it is a little difficult to save the data directly into the database tables.
    However it must be possible to populate some internal tables within the program, which would enable the user to view the serial numbers.
    The process is as follows:
    Using transaction VL01N,
    Enter Shipping Point, Selection date, and order.
    Select line item
    Choose menu item extras-serial number.
    Screen SAPLIPW1-0200 is displayed with a list of the pre-created serial numbers is displayed.
    In the processing prior to the screen display there does not appear to be any user exit to use.
    Your continued help is much appreciated!!

  • Define document number ranges

    Hi ,
    i have problem with document number ranges .we have more company codes and each we specify the same ranges. e.g 19...for KR document for each company but there is a mistake with one of them.
    i customise no 12  year 2010 from number 1900000 but
    it should be no 19  year 2010 from number 190000
    it effects our reports because it doesn't give 19000 for KR documents,i customised no 19  from number 26000 it gives 26000..for KR documents
    may i change the ranges if we had an accounting entry?thanks your advices

    You can change he number range, and it will not generate any posting.
    But also it will not affect any existing entry, (Also take care to keep the current number status of the document number range correct, as no document can have same number.)
    Regards,
    SDNer

  • EBS - Auto posting not working  if text behind the document number

    Hi,
    When the document number is at the end of the payment reference, there is no problem.
        However, when there is text behind the document number, the posting rule doesn't work anymore.
        The autoposting also fails when there is a seperator (like a comma) directly added to the document number.
    -   In the posting rule for invoice numbers (BE51), it is able to find multiple invoice numbers and clear these together.
        We were expecting this posting rule will behave the same, so when a customer mentions more than 1 document number,
        it is able to find them all and clear if they fulfill the criteria (total amount of the documents matches the amount received).
        But because of 1st mentioned problem, system doesn't clear anything because of additional text present.
    I am look help to solve this issue
    Thanks.
    With regards,
    V.K
    Best regards,

    Hi,
    Any input for above issue?
    With regards,
    V.K

  • Billing Number Range problem ( accounting document not generated)

    Hi All,
    I have created some billing types and for them I have assigned some internal number ranges. Now when I create a billing document it is getting saved with the proper number range but no accounting document is getting generated.
    Also when I try to release the invoice I am getting an error which says " *Incorrect doc.no.: 10000009. Select document number between 0090000000 and 0099999999* "
    K I N D L Y     suggest  as U R G E N T.
    Regards,
    Danny.

    Dear,
              Billing Number Range problem ( accounting document not generated) is not an error because when you create billing document then accounting document not generated. Accounting done after posting of that billing document with VFX3 or VF02 T.Code by account department.
               And for second issue you had define number range between 0090000000 and 0099999999 for invoice so thats why it happen.
    Regards,
    Sandip Shaktavat

  • Document Number Range problem

    Dear All,
       Previously Document number range(FBN1) for Invoice was External, then i have changed to Internal number, now the problem is that in Counter it shows 1800000126 but system is showing document number 1800000136. Pls help on this & when i am changing from Internal to External system is showing error as "Lower limit can only be changed during Initial Entry".
    Pls pls help on this.

    Dear ranjith,
    If you want to change number ranges from external to internal no ranges,
    from T-code FBN1 you can for the changes first go to ,<change status button> and make you counter no as 0 and save the intervals,
    and come to change intervals button and change the no ranges according to ur requirement.
    Assign points.
    SU

  • MIRO document Number range buffering problem

    Dear all,
    My MIRO document number is not following the sequence. if my first 5 numbers come in a sequence, then the next 5 numbers are not coming in between. Instead, the next 5 numbers are coming. It might be due to number range buffering problem. How to find the number range object  for  MIRO document number range?
    How to solve this?
    Please suggest.
    I will award full points.
    Thanks & Regards,
    AR

    Hii,
    You can search the Number Range object in T-Code: SNRO
    The Number Range object for Invoice document is RE_BELEG
    Go the Change Mode of the Number Range Object in SNRO, remove the No of Numbers of Buffers (by default it will be 10).
    This will resolve your issue.
    Regards,
    Kumar

  • BAPI_PO_CHANGE document number leading zero problem

    Hi experts,
    The following code clears the "Delivery Complete" flag on a list of Purchase Orders uploaded from a CSV file.
    The PO number is 9 digits long, however, in EKPO table it is stored as 10 digits (prefixed with a zero). The BAPI does not recognise the document number unless it is prefixed with a zero in the CSV file (which adds extra work for the user to create custom format in Excel to add the leading zero).
    What code is required for the BAPI to recognise the 9 digit number without the leading zero?   Perhaps the leading zero could be hard-coded into the program?
    Any advice is much appreciated.  Thanks for your time.
    REPORT  Z_MASS_REMOVE_FDI_DCI_BAPI.
    *Check if file exists
    DATA: rc TYPE sy-ucomm.
    CALL FUNCTION 'WS_QUERY'
           EXPORTING
                query    = 'FE'  "File Exist?
                filename = 'X:\STO.TXT'
           IMPORTING
               return   = rc.
    IF rc EQ 0.
      WRITE: / 'File does not exist'.
    ENDIF.
    TYPES: BEGIN OF ty_tab,
            DOCNO(10),
            ITEM(4),
           END OF ty_tab.
    DATA : it_tab TYPE STANDARD TABLE OF ty_tab,
           wa_tab TYPE ty_tab.
    START-OF-SELECTION.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename = 'X:\STO.TXT'
    *     FILETYPE = 'ASC
          has_field_separator = 'X'
    *     HEADER_LENGTH = 0
    *     READ_BY_LINE = 'X'
    *     IMPORTING
    *     FILELENGTH =
    *     HEADER =
          TABLES
          data_tab = it_tab
          EXCEPTIONS
          file_open_error = 1
          file_read_error = 2
          no_batch = 3
          gui_refuse_filetransfer = 4
          invalid_type = 5
          no_authority = 6
          unknown_error = 7
          bad_data_format = 8
          header_not_allowed = 9
          separator_not_allowed = 10
          header_too_long = 11
          unknown_dp_error = 12
          access_denied = 13
          dp_out_of_memory = 14
          disk_full = 15
          dp_timeout = 16
          OTHERS = 17.
    END-OF-SELECTION.
    LOOP AT it_tab INTO wa_tab.
      WRITE:/ 'DOCUMENT: ',
      wa_tab-DOCNO,
      ' ITEM: ',
      wa_tab-ITEM.
      WRITE: / '-----------------------------------------------------------------------'.
      DATA: s_header TYPE bapimepoheader,
            s_headerx TYPE bapimepoheaderx,
            s_item TYPE bapimepoitem,
            s_itemx TYPE bapimepoitemx,
            i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
            i_extension TYPE bapiparex OCCURS 0 WITH HEADER LINE,
            s_bapimepoheader TYPE bapimepoheader,
            s_bapimepoheaderx TYPE bapimepoheaderx,
            s_bapimepoitem TYPE bapimepoitem occurs 0 with header line,
            s_bapimepoitemX TYPE bapimepoitemX occurs 0 with header line,
            wa_message TYPE c LENGTH 100.
      s_bapimepoheaderx-po_number = wa_tab-DOCNO.
      s_bapimepoheader-po_number = wa_tab-DOCNO.
      s_bapimepoitemx-PO_ITEM = wa_tab-ITEM.
      s_bapimepoitem-PO_ITEM = wa_tab-ITEM.
    *Remove Delivery Complete Indicator (DCI)
      s_bapimepoitemx-NO_MORE_GR = 'X'.
      s_bapimepoitem-NO_MORE_GR = ' '.
      append s_bapimepoitem.
      clear s_bapimepoitem.
      append s_bapimepoitemx.
      clear s_bapimepoitemx.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder = wa_tab-DOCNO
        TABLES
          return        = i_return
          poitem        = s_bapimepoitem
          poitemx      =  s_bapimepoitemx.
    *Message types: S Success, E Error, W Warning, I Info, A Abort
    *Supress all Warning Messages
    DELETE i_return WHERE ( TYPE EQ 'W' ).
    *Commit only if no errors have been returned
      read table i_return with key type = 'E'.
      if sy-subrc ne 0.
        COMMIT WORK AND WAIT.
      endif.
    *Display Return Messages on Screen
      LOOP AT i_return.
        WRITE: /   'RETURN MESSAGE: ',
        'ID: ',
        i_return-id,
        ' TYPE: ',
        i_return-type,
        ' NUMBER: ',
        i_return-number,
        i_return-message.
      ENDLOOP.
      WRITE: / '-----------------------------------------------------------------------'.
      refresh : s_bapimepoitem,s_bapimepoitemx.
    ENDLOOP.

    hi,
    Use the conversion exit to make it as 10 digit char CONVERSION_EXIT_ALPHA_INPUT.

  • EBS - MT940 - Auto Clearing with payment document number

    Hi
    I am getting the MT940 bank statement with the payment document number alongwith company code and year at line 86.  For example:
    900012345678902014?21
    9000 - company code
    1234567890 - Payment document number
    2014 - Year
    ?21 - Not sure
    I created a new search string as below:
    ( |^)#####################( |$)
    At tag, I left only the 10 digits for the document number and removed the other values ie for company code, year etc
    Assigned this search string for the bank account with interpretation algorithm 020 (document number search)and target field is Note to payee.
    But, the system is not able to clear by looking at the payment document. Instead, it is trying to clear with the amount.
    Could you please suggest me on this.
    Thanks and Regards
    Ashok

    Hi Ashok,
    Did you try with entring this BELNR number(1234567890) in FF_5 screen?
    Regards,
    Mohammed

  • Document Number generation

    hi all
    for a user defined form,i created a field as document number,as the forms loads doc number is creating. Once the  form  mode changed to update mode,and now i m pressing  (Ctrl+A ) or menu UID 1282 to change the mode into add mode. but i m not able handle this menu event  by code. more clearly  i m using the following code
    if pval.menuUid="1282" then
    objForm.objmain.objApplication.Forms.getform("formtype",0)
    me.getDocnum()
    end if
    Actually i need to generate the doc number at the time of form mode changed into add mode also
    Edited by: ajith464 on Aug 31, 2010 7:32 AM

    Hi
    Did you go through the B1DE document.
    In that you can find  detailed information about how to create addons using B1De.
    First create required UDT and UDF's for your addon and register it through object registration wizard.For creating form you have 2 option create form manually or using form generator to create form automatically.Form generator will create form in xml format you easy change the extension to srf.Then create addon project in visual studio , choose the connection type second one (sigle side ) . if you created the udt and udf then you can avoid next step. Choose a menu  location for you addon give the required fields such as menu name description and choose menu type string. After the menu is created you have to attach the new form to that menu item for that right click on that menu and select attach form browse the location of your newly created form you can  also add menu events in this step.To add listener again right click on the menu and select add listener you can add onaftermenuclick and onbeforemenuclick( there is  a check box to differentiate these two events). Then press next , in this window you can find that your form name is listed in the left side ,expand it select the item for adding listener.
    for eg take the case of OK button its unique id is 1 we can add various listener to it such as onBeforeItemPress , On AfterItemPress, onBeforeItemClick and afterItemClick etc that up to your requirement. Click next here you can add form events listeners such as formDataAdd , formDataUpdate etc . complete the steps and create the project
    sorry for my english
    I will also send you some samples
    Regards
    Arun

  • Document number problem in add-on form

    hi all,
    i have developed one purchase indent form. system  document number(numbering series) some time not refresh same number assign in another document also. any idea about this issue?
    thanks & regards
    B.narain

    Hi,
    Create UDO or give form.refresh()
    Regards,
    Siva

  • Document Number generation as per the client requirment

    Hi,
    I would like to generate the document no as per our client's document numbering logic. This is not available in standard.
    In additional data tab am collecting information from user (Characteristics values) to generate document number.
    E.G.
    I have 2 characteristics
    1. Part Type:
        Values: A - Type 1
                    B - Type 2
    2. Part Code:
        Values: 01- Part 1
                    02 - Part 2
                    03 - Part 3
    When am creating document am selecting Part Type = A & Part code = 02 so my document number is A-02. ("-" : constant).
    I am planning to use BADI "DOCUMENT_MAIN01" - method "ASSIGN_NUMBER".
    In this method how can i get the characteristics values which filled user on screen ? Is there any Function Module for that ?
    I tried Function Module "CTMS_DDB_CLOSE" but this is not released also this is not working in Easy DMS.
    Is there any other way i can take i/p from user to generate document number ?
    Regards,
    Sunny
    Edited by: Sunny on Sep 25, 2008 9:09 PM

    Hi Sunny,
    An experienced ABAPer can capture the required information from the sub screen(additional data) number (4000) and the subscreen program (SAPLCTMS). This data can be used  in the method of the BADI.
    Regards,
    T T Subudhi

  • Problem in finding Idoc number from Delivery document number(VERY URGENT)

    Hi experts,
    I have a delivery document number.Now i have to find the Idoc number for thet delivery document and extract some necessary data from one of the segment of that Idoc.So I am not able to find a link through tables .
    So I exact query is 'what is the selection method i have to follow to get the idoc number given the delivery document number'.
    Regards,
    Praveen.
    Edited by: Praveen Jada on Mar 14, 2008 12:15 PM

    That's what I meant, do the following query:
    DATA: LT_DOCNUM TYPE TABLE OF EDI_DOCNUM.
    SELECT DOCNUM
      INTO TABLE LT_DOCNUM
      FROM EDID4
      WHERE SEGNAM EQ 'E1EDL20'
      AND SDATA EQ '0001234567%'.
    This will list you all the IDOC numbers in which delivery number 0001234567 appear in the delivery header segment.
    Depending on your process it's probably going to be one entry only.
    Hope that clarifies it,
    Michael

Maybe you are looking for

  • "Payables Open Interface Purge" Program

    Hi Guys, In our production system, it takes 3 minutes to open "Open Interface Invoices" form (AP Manager>Invoices>Entry>Open Interface Invoices). So what should we do so as to avoid this. I was thinking to delete data from two tables (AP_INVOICES_INT

  • Motion 4 crashes every time when I try to use the color wheel, after upgraded to Snow Leopard

    Every time I try to access the color wheel in Motion, it crashes (like changing the bakcground color in edit>project profile, or changing the color of a text element in text>style>face>color). This happened when I upgraded to snow leopard. I have kep

  • Trying to get G4 Quicksliver up and running again

    hey guys I have a Quicksliver 2002 version and it stopped working after a really big storm I think lighting struck the power or something like that. Anyway I have ben slowly buying parts to fix it at first it was the power supply so I got that becaus

  • Reader 5.1 DOES save form data. But where??

    I have used Reader 5.1 for the past couple of years to fill in some forms. It will save the filled-in data when the form is closed despite the fact that's it's apparently not supposed to be able to (and save as, email, etc. all indicate that the data

  • CONFIGURE RETENTION POLICY TO REDUNDANCY 1;

    Hi all, we would like to create one a week a full backup level 0 and every day a level 1 cumulative RMAN backup. We would like to configure RMAN that he only holds one cumulative and the full backup. Does we can use the parameter RETENTION POLICY 1 o