Auto Generation

how to generate auto generation number
its urgent
advance thanks
by nathan

Hi this is the code for autogenerating BP code
You can make changes according to ur requirement.
Sub BPAutoGeneration(ByVal CardType As String, ByVal Profit As String)
        Try
            Dim oRs As SAPbobsCOM.Recordset = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            oRs.DoQuery("Select (CASE WHEN max(CAST(substring(CardCode,5,len(CardCode)) as int)) IS NULL THEN '1' ELSE max(CAST(substring(CardCode,5,len(CardCode)) as int))+1 END) from OCRD Where U_PrftCntr='" & Profit & "' and CardType='" & CardType & "'")
            Dim NextNum As String = Trim(oRs.Fields.Item(0).Value)
            Dim Auto As String = ""
            For i As Integer = 7 To NextNum.Length Step -1
                Auto = Auto & "0"
            Next
            Auto = CardType & Profit & Auto & NextNum
            BP_Form.Freeze(True)
            BP_Form.Items.Item("5").Specific.Value = Auto
            BP_Form.Freeze(False)
        Catch ex As Exception
            oApplication.StatusBar.SetText(ex.Message)
        End Try
    End Sub
regards:
Sandy

Similar Messages

  • Item Code Auto Generation Based on User defined Tables

    I need the Item code like
    PRODUCT TYPE-ITEMGROUP-ITEMCODE-SUBITEM-BRAND-COLOR  e.g .FG-01-01-00-001-00.
    I created the following User define Tables and link to Item Master data
    U_PRO             - FOR PRODUCT TYPE
    U_GROUP        - FOR  ITEM GROUP
    U_ITEMCODE    - FOR ITEMCODE
    U_SUBITEM       - FOR SUB ITEM
    U_BRD              - FOR BRAND NAME
    U_COLOR         - FOR COLOR
    i need a formatted search in Item code to fetch the codes from the user defined  table
    i tried with the following
    SELECT T5.[Code]'-'T2.[Code]'-'T3.[Code]'-'T4.[Code]'-'T0.[Code]'-'T1.[Code] FROM [dbo].[@BRD]  T0 , [dbo].[@COLOR]  T1, [dbo].[@GROUP]  T2, [dbo].[@ITEMCODE]  T3, [dbo].[@SUBITEM]  T4, [dbo].[@PRO]  T5 INNER JOIN OITM T6 ON T5.Code = T6.U_PRO WHERE
    T5.[Code] = T6.[$U_PRO] AND 
    T2.[Code] = T6.[$ U_GROUP] AND
    T3.[Code] = T6.[$U_ITEMCODE] AND
    T4.[Code] = T6.[$U_SUBITEM] AND
    T0.[Code]  = T6.[$U_BRD] AND
    T1.[Code]  = T6.[$U_COLOR]
    showing errors. Can any one help me regarding this. I badly need the query for Auto generation of Itemcode

    Hi,
    How can you assign those UDF value without ItemCode in the first place?
    Thanks,
    Gordon

  • 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

  • Auto Generation Cross References

    Hi
    I am working on xml to InDesign automation process form last year, I am looking to auto generate Cross References linking by using xml. Whereas my xml contains following tags for linking.
    <figref pid="p200179129960143001">Table 1</figref>
    <ptr pid="p200179129970131001">Chapter 7</ptr>
    Is there any option or namespace to perform auto generation of Cross References?

    Yes, i only have the container in one vi. In the other VIs are only "Automation references".
    But as soon as my activeX-file changes (new registered to windows), the references become invalid and i have to click on each reference an must select in the popup "select activeX-class".
    Message Edited by OnlyOne on 07-28-2009 09:38 AM

  • How do I stop the auto generation of previews to imported files?

    In a recent post it was suggested that I do not let Aperture automatically generate the previews to all imported files. I think that is a great idea, but how do I stop the auto generation of such files?
    Under Preferences/Previews I have unchecked the New projects automatically generate previews, but after I do the import the processing wheel continues to spin for quite some time (depending on how many files I imported).
    Thanks in advance.
    David

    Take a look here:
    Pretty much the same in Ap2 and Ap3
    [http://photo.rwboyer.com/2009/01/03/aperture-2-quick-tip-managing-previews>
    RB

  • How to stop auto generation of ids for h:dataTable

    I am using <h:dataTable> tag to display more than one error messages.
    My code goes like this
    <h:dataTable id="messagetb" value="#{searchZug.searchZugParam.allMessages}" var="message">
    <h:column>
    <h:outputText style="color:red;" value="#{message}" />
    </h:column>
    </h:dataTable>
    When i run my application, console is displaying a message like
    'WARNING: Component _id79 just got an automatic id, because there was no id assigned yet. If this component was created dynamically (i.e. not by a JSP tag) you should assign it an explicit static id or assign it the id you get from the createUniqueId from the current UIViewRoot component right after creation!'
    I checked in the generated html source. It is generating id for tbody as 'messagetb:tbody_element', this is causing the problem.
    How can i stop this auto generation of ids? if not possible, then how can i explicitly specify the id for tbody?
    Thanks,
    Murthy

    Narasimha.Murthy.d wrote:
    I am using JSF version 1.3There exist no "JSF 1.3". When talking about "JSF" without mentioning the implementation name, we assume it as JSF specification. The JSF specification is only been available as 1.0, 1.1, 1.2 and 2.0. As said before, we´re more interested in the JSF implementation name. Is it Apache MyFaces? Is it Sun RI or Sun Mojarra? And then please tell the version from that.

  • Auto generation of Item Code And Business Partner

    Hello All,
    My client want to create Auto generation of Item Code And Business Partner with some prefix value.
    Thanks
    Deepak

    Hi Dipak Patel,
    i created BP code by BP Group use FMS . you can refer code.
    declare @temp as char(20)
    IF $[OCRD.GroupCode] =100
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =100) and (len(CardCode)=8))
    set @temp='C11'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.GroupCode] = 102
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =102) and (len(CardCode)=8))
    set @temp='C12'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.GroupCode] = 103
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =103) and (len(CardCode)=8))
    set @temp='C13'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.GroupCode] = 104
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =104) and (len(CardCode)=8))
    set @temp='C14'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.GroupCode] = 101
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =101) and (len(CardCode)=8))
    set @temp='V11'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.GroupCode] = 105
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =105) and (len(CardCode)=8))
    set @temp='V12'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.GroupCode] = 106
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =106) and (len(CardCode)=8))
    set @temp='V13'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.GroupCode] = 107
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =107) and (len(CardCode)=8))
    set @temp='V14'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.GroupCode] = 108
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =108) and (len(CardCode)=8))
    set @temp='V15'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.GroupCode] = 109
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =109) and (len(CardCode)=8))
    set @temp='V16'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.GroupCode] = 110
    BEGIN
    set @temp=(select isnull(max(right(CardCode,5)),0) + 1 from OCRD where (GroupCode =110) and (len(CardCode)=8))
    set @temp='V17'+isnull(replicate(0,5-len(@temp)),'')+@temp
    select cast(@temp as char(20))
    END
    thanks
    H2

  • Auto generation of  Item Code

    Hi Experts,
    Is it possible to create auto generation of Item Codes in SAP B1?
    E.g Customer want specific format say ... I000001---- I9999999
    tks,
    SB1

    Dear,
    You posted the same thread twice.
    Check you previous thread for reply :
    Re: Auto generation of  Item Code
    Hope this will help u.
    Thanks,
    Neetu

  • Auto generation of settlement rule for PM orders that are Investment Measur

    Hi all
    Has anyone successfully automatically generated settlement rules on a PM order that is an Investment measure? The settlement receiver would be an asset. User exit IWO10027 doesn't work. Std settings don't work either because a settlement rule is auto generated for the AUC on the order during settlement (Note 195607) because of IM.
    Any ideas?
    Thanks
    CC

    for a PM order as investm,ent measure the system assumes that you wish to create an AuC hence no other settlement rule generation is allowed
    you can try by removing the asset class in the IM profile

  • InstaApps, WhiteField metadata auto generation

    I am wondering if you can solve some of the puzzles I have about InstaApps or you can redirect the questions to anyone you think is more relevant to the application. Basically our team will use WhiteField Framework for our project and we know that InstaApps can help automate the implementation. So here are the questions we have.
    1. Is this application deprecated for UI generation? Is it still in use for Backend API and BOL/Genil Implementation Classes generation?
    2. Does InstaApps call any transactions/function modules/classes which are not in its package and not part of CRM core? Understanding the dependency of InstaApps is important for us to request a transport of this application to a CRM system that does not have it installed, which we are meant to do given that this application is still usable.
    XiaoLong
    Edited by: XiaoLong Chen on May 4, 2011 12:35 AM
    Edited by: XiaoLong Chen on May 4, 2011 12:36 AM

    I am able to fix this issue. After a series of R & D I was able to find that the root cause is %APPDATA%\jdeveloper. Deleting the relevant directory will solve this issue. In fact, I tried to delete the entire jdeveloper directory under %APPDATA% and the jdev 11.1.1.7 form generation issue got resolved. Those who find "referential integrity" issue may follow this approach.
    This solution also applies to this thread
    Auto Generate task Form

  • Gold auto generation

    Hi all,
    Currently i am buliding a Java MPOG War games. This game is a real-time based games. But i am facing difficulty in auto-gold generation part.
    Can someone enlighten me?
    My requirement is to add 500gold for every 30mins stay login in the games....i tried many ways but it seem not able to work.
    Thanx in advance
    Message was edited by:
    royzo

    // My code check if login time has passed every 10 seconds.
    // Use this line for check 30 minutes login time
    //fiveMinTimer.schedule(new SmallTask(System.currentTimeMillis(),CalLong.getIntMin(30)),0,CalLong.getIntSec(10));
    import java.util.*;
    public class ScheduleTest {
    public static void main(String args[]){
         Timer fiveMinTimer = new Timer();
         //fiveMinTimer.schedule(new SmallTask(System.currentTimeMillis(),CalLong.getIntMin(30)),0,CalLong.getIntSec(10));
         // check every 10 seconds
         fiveMinTimer.schedule(new SmallTask(System.currentTimeMillis(),CalLong.getIntSec(30)),0,CalLong.getIntSec(10));
         // check every 10 seconds
    class CalLong{
         public static long getIntMin(int inputMinutes){
              return inputMinutes*60*1000;
         public static long getIntSec(int inputSeconds){
              return inputSeconds*1000;
    class SmallTask extends TimerTask{
         long loginTime;
         long lastCheckTime;
         long bonusInterval;
         boolean shouldGiveMoney = false;
         public void setShouldGiveMoney(boolean input){
              shouldGiveMoney = input;          
         public boolean getShouldGiveMoney(){
              return shouldGiveMoney;
         protected SmallTask(long tempLoginTime, long tempBonusInterval){
              super();
              this.loginTime = tempLoginTime;
              this.lastCheckTime = tempLoginTime;
              this.bonusInterval = tempBonusInterval;
         public void run(){
              long currentTime = System.currentTimeMillis();
              System.out.println("before condition true "+(currentTime-lastCheckTime)+">"+bonusInterval);          
              if ( (currentTime-lastCheckTime) >=bonusInterval){
                   setShouldGiveMoney(true);
                   System.out.println("inside condition true "+(currentTime-lastCheckTime)+">"+bonusInterval);
                   System.out.println(""+bonusInterval/(1000.0d*60.0d)+" min passed");
                   lastCheckTime = currentTime;
                   setShouldGiveMoney(false);
    }

  • 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

  • Auto generation of documents program (mail merge)

    hi everyone
    i wanted to write a program to allow user to create a particular letter just by clicking a button,
    now this file is first store in xml form, when user initiates the document generation the program will get xml element from the database and transform the xml to xsl and then finally to rtf.
    what would be the best parser for this,
    i seen a lot of xml example files and they are all relatively small, i'm wondering is it not a good idea to write an xml file of two or three pages long consisting a relatively small xml element but has great deal of text in it.
    lastly i take that for formatting purposes i still have to convert the xml to xsl then only rtf?
    thanks in advance

    I interpret "best" as "most convenient" since you haven't provided any other useful meaning for the term. In other words, the best parser is the one you already have when you installed Java 1.4.

  • Auto generation of MATNR based on some requirements

    Dear MDM Experts,
    We have got the following scenario in implementing CMDM:
    when ever we create a new material, the user will fill only the global or required fields except the MATNR.
    After the approval process, the material gets generated in MDM.
    But before the material is being syndicated, the MATNR should be automatically assigned to the record based on the following conditions:
    1. if the MTART is "ROH" the MATNR shoould be in the range 2000000000 - 2999999999
    2. if the MTART is "HALB" the MATNR should be in the range 4000000000 - 4999999999 etc.
    I have tried this scenario using the Key generation option in the console which assigns the values at the time of syndication but the key was not getting generated.
    Kindly let me know the process to achieve it.
    or is there any other way that i can do this.
    Thanks and Regards,
    Sravan Velamury.

    Hello Sravan
    Your message isn't clear fo me
    If you used import for new master data you can use automatic key generation ability for inbound port
    The another way:
    You can create special key field in MDM and
    create simple workflow which fire when ADD record.
    That worklflow call assignment which fill key field
    Regards
    Kanstantsin

  • Query to skip special customer numbers while auto generation

    Hi
    I have a customer number maintenance screen refering table STTMS_CUSTOMER_SRNO_BANK, where customer number is auto generated.
    Table:STTMS_CUSTOMER_SRNO_BANK columns are
    CUSTOMER_RUNNING_NO , USED_FLAG
    Present queries are:
    SELECT MIN(customer_running_no)
    INTO l_no
    FROM sttms_customer_srno_bank
    WHERE used_flag = 'N';
    SELECT customer_running_no
    INTO l_running_no
    FROM sttms_customer_srno_bank
    WHERE used_flag = 'N' AND customer_running_no = l_no
    FOR UPDATE NOWAIT;
    Current logic is it takes MIN(customer_running_no) and USED_FLAG is 'N'.
    Now an enhancement is to be added that a new table CSTM_CUST_CATEGORY where a range of numbers is reserved for a special classification of customers.
    Table:CSTM_CUST_CATEGORY
    CUST_CATEGORY START_RANGE END_RANGE
    ROYAL      1     100000
    VIP 150000 200000
    I need to write a query to auto generate customer numbers and the auto generated numbers should not fall in the special customer category like ROYAL,VIP,ie it should not be in the range 1-100000 and 150000-200000.
    Please help me to write this query.
    Thank you
    Mary

    Thanks a lot
    This query works and serves half my requirement.
    Ex..i have customer_running_no from 1300 to 1350 where used flag set to 'N'
    and the start_range and end_range I have given is 1300 to 1500.
    Now this query skips 1300 to 1350.It gives 1351.But my actual requirement is it should give 1501 as the next customer_running number.May I know what modification should i do to this query to get this expected result.

Maybe you are looking for

  • Unit of measure for Standard Value.

    Hi Gurus I have maintained Standard value LABOR in workcenter and maintain deafault value for unit of measure in workcenter Default tab . But that unit of measure is not defaulted in routing when i put some value.

  • Webi reporting

    Hi... We have a webi report which is build from two databases.one is oracle and the other is sybase. So the common objects are merged.As they are merged it gives me all the values from both the databases.But i need to have a column in such way that i

  • How to i insert a key into the keyboard

    Hi, for some reason the "arrow down" key of the wireless keyboard fell out. How do I get it in again? Thank you! Rob

  • Error: 80070057 Apply Prestage Media

    Hi all I am using the task sequence by Frank Rojas (http://tinyurl.com/k2va766 ) to Apply prestage media. For what ever reason, it keeps failing, and sometime works, I have no idea why. The error Failed to run the action: Error in the task sequence.

  • Setting TalbeLogOnInfo not working

    Hi experts I`m tryiing to dynamicly change database connection Informatio. when i use report on the same thatabase where i created report everything is fine but when i change server or databe no changes are made, This is my code forr setting up conne