Autogenerate Business Partner Code

Hi,
Has anyone customized the B1 BP Master Data form to enable the system to automatically generate a BP code while in ADD mode?  Our client, understandably, does not want to have to refer to a separate list in order to find the next sequential BP number when adding a new BP.  It would also be very cool if customer codes could be preceded by a "C", vendor codes by a "V" and leads by an "L".
Any information is appreciated.
Thanks,
Ted

This is the formatted search I'm using. I quite like it
DECLARE @MAXC as varchar(5)
SET @MAXC=(SELECT MAX( RIGHT(T2.CardCode,5)) FROM OCRD T2 WHERE T2.CardType='C')
DECLARE @MAXS as varchar(5)
SET @MAXS=(SELECT MAX( RIGHT(T2.CardCode,5)) FROM OCRD T2 WHERE T2.CardType='S')
SET @MAXS=(SELECT @MAXS+1)
SET @MAXC=(SELECT @MAXC+1)
SELECT CASE
     WHEN $[OCRD.CardType]='C' THEN (SELECT DISTINCT CASE
          WHEN LEN(@MAXC)=5 THEN (SELECT 'C'  + @MAXC)
          WHEN LEN(@MAXC)=4 THEN (SELECT 'C' + '0' + @MAXC)
          WHEN LEN(@MAXC)=3 THEN (SELECT 'C' + '00' + @MAXC)
          WHEN LEN(@MAXC)=2 THEN (SELECT 'C' + '000' + @MAXC)
          WHEN LEN(@MAXC)=1 THEN (SELECT 'C' + '0000' + @MAXC)
          END FROM OCRD )
     WHEN $[OCRD.CardType]='S' THEN (SELECT DISTINCT CASE
          WHEN LEN(@MAXS)=5 THEN (SELECT 'S'  + @MAXS)
          WHEN LEN(@MAXS)=4 THEN (SELECT 'S' + '0' + @MAXS)
          WHEN LEN(@MAXS)=3 THEN (SELECT 'S' + '00' + @MAXS)
          WHEN LEN(@MAXS)=2 THEN (SELECT 'S' + '000' + @MAXS)
          WHEN LEN(@MAXS)=1 THEN (SELECT 'S' + '0000' + @MAXS)
          END FROM OCRD )
END

Similar Messages

  • Business Partner Code when using *

    Hi all,
    In Business Partner code when the user want's to see all Business Partner and makes "*" appears the BP code, BP Name and Foreign Name.
    All user see this information except one that doesn't see the Foreign Name.
    Why?

    Hi Ad,
    Thank you for your reply.
    "Foreign Name" is already select in the Form Setting.
    You say that "This is a setting per user" but i dont think so. In Form Setting of the "List of Business Partners" i add "Account Balance" to one user and ALL users see the same information.
    Best regards,
    Augusto Silva

  • Regarding Autogeneration of Business Partner Code.

    Dear All,
             I have a unique requirement. My client wants autogeneration of Business Partner Code in the Business Partner Master.
             Please guide me in regard to this.
    Regards
    Hitesh Parsawala

    We normally have customer code generated as 'C00001' then 'C00002' etc and Supplier or vendors as 'S00001' and 'S00002' etc. This requires the FMS on the BP Code to be a little more complicated but not over the top.
    DECLARE @MAXC as integer
    SET @MAXC=isnull((SELECT CAST(MAX(RIGHT(OCRD.CardCode,5))+1 AS INTEGER)
    FROM OCRD
    WHERE OCRD.CardType<>'S' AND Len(OCRD.CardCode)=6 AND OCRD.CardCode like 'C%'),1)
    DECLARE @MAXS as integer
    SET @MAXS=isnull((SELECT CAST(MAX(RIGHT(OCRD.CardCode,5))+1 AS INTEGER)
    FROM OCRD
    WHERE OCRD.CardType='S' AND Len(OCRD.CardCode)=6 AND OCRD.CardCode like 'S%'),1)
    --This will give you the next number then
    SELECT CASE
         WHEN $[OCRD.CardType]='C' THEN (SELECT DISTINCT CASE
         WHEN LEN(@MAXC)=5 THEN (SELECT 'C'  + CAST(@MAXC AS varchar) )
         WHEN LEN(@MAXC)=4 THEN (SELECT 'C' + '0' + CAST(@MAXC AS varchar))
         WHEN LEN(@MAXC)=3 THEN (SELECT 'C' + '00' + CAST(@MAXC AS varchar))
         WHEN LEN(@MAXC)=2 THEN (SELECT 'C' + '000' + CAST(@MAXC AS varchar))
         WHEN LEN(@MAXC)=1 THEN (SELECT 'C' + '0000' + CAST(@MAXC AS varchar))
        END FROM OCRD )
    WHEN $[OCRD.CardType]='L' THEN (SELECT DISTINCT CASE
         WHEN LEN(@MAXC)=5 THEN (SELECT 'C'  + CAST(@MAXC AS varchar) )
         WHEN LEN(@MAXC)=4 THEN (SELECT 'C' + '0' + CAST(@MAXC AS varchar))
         WHEN LEN(@MAXC)=3 THEN (SELECT 'C' + '00' + CAST(@MAXC AS varchar))
         WHEN LEN(@MAXC)=2 THEN (SELECT 'C' + '000' + CAST(@MAXC AS varchar))
         WHEN LEN(@MAXC)=1 THEN (SELECT 'C' + '0000' + CAST(@MAXC AS varchar))
        END FROM OCRD )
    WHEN $[OCRD.CardType]='S' THEN (SELECT DISTINCT CASE
         WHEN LEN(@MAXC)=5 THEN (SELECT 'S'  + CAST(@MAXS AS varchar) )
         WHEN LEN(@MAXC)=4 THEN (SELECT 'S' + '0' + CAST(@MAXS AS varchar))
         WHEN LEN(@MAXC)=3 THEN (SELECT 'S' + '00' + CAST(@MAXS AS varchar))
         WHEN LEN(@MAXC)=2 THEN (SELECT 'S' + '000' + CAST(@MAXS AS varchar))
         WHEN LEN(@MAXC)=1 THEN (SELECT 'S' + '0000' + CAST(@MAXS AS varchar))
        END FROM OCRD)
    END
    Try Shift-F2 on the BP code with this FMS

  • Change business partner code

    Hi All,
       I have a prospect who wants to have the business partner code of 20 characters, as you may know 15 is the current. Do you know what is the best way to workaround this? He doesn't like the idea of using user defined fields.
    thanks to all
    Hector

    Hi Hector,
    You cannot change the length of the Business Partner Code (CardCode) field built into SBO. You need to use another field if that one is not good enough. You have various options and the best is probably to use a user-defined field. You can also use any other field on the BP Master Data which they don't use internally (like Foreign Name for example).
    Hope it helps,
    Adele

  • Wrong Suggest of Businer partner code

    I have a  problem in sales order with approval procedure and inactive business partner:
    When im trying to enter an inactive  business partner code in the document, suggest me  this code and let me create the draft to be authorized. How i can disable this option of suggest.
    Im working in SBO 8.8 pl15

    Hi Fernando,
    an inactive BP shouldn't be in the Choose-from- List  unless you are creating a payment document or the document has a posting date outside the inactive period as set in the BP master data (see 1411244 - Master Data Inactive/ Active Enhancements).
    The behaviour you describe cannot be reproduced in 8.81 pl004 or 5, so the bug has been fixed already.
    All the best,
    Kerstin

  • No Matching records found 'Business Partner'

    Hi All
    At a clients site 2 users enter a business partner code to get and got this error:
    *No matching records found 'Business Partner' (OCRD) (ODBC-2028) Message 131-183 *
    However when another user entered the BP code the details came up.
    They have closed Business One twice and tried to enter the BP code again...and they still getting that error.
    Thanks
    Jerusha

    As they are in Find mode, only possibility I see is that on the client where the error appears, there must be some value in other field also, which is not available in combination to BP Code.
    For example if in Group Cash & Carry is their and sua001 belong to some other group then such error can be appear, even if sua001 is available in BP Master.
    Hope above resolve your issue.
    BR
    Samir Gandhi

  • Code generation for business partner

    Hi, all
    In our scenario we need to assign a unique code to business partner record as soon as it is approved by data manager (in MDM workdlow). This assignment should be automatic. Next incremental number would suffice, but AutoID field can't be used for this purpose since it automatically assigns numbers even to new, still not approved records.
    Some kind of this pseudocode in assignment would be great:
    CODE = MAX(CODE)+1
    Where MAX(FIELD) is a function returning maximal value in FIELD field in current table.
    But I couldn't find such function in data manager standard functions list.
    Can anyone suggest a solution?
    Vadim

    hi thanks for your valuable replies...
    i changed the codes...pls check its right or wrong
    declare @temp as char(20)
    IF $[OCRD.GroupCode] = 104  and $[OCRD.cardtype] = 'c'
    BEGIN
    set @temp=(select isnull(max(right(cardCode,7)),0) + 1 from Ocrd where (groupcode= 104) and (len(cardCode)=7))
    set @temp='TRA'isnull(replicate(0,7-len(@temp)),'')@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.cardtype] = 'C'
    BEGIN
    set @temp=(select isnull(max(right(cardCode,7)),0) + 1 from Ocrd where   (len(cardCode)=7))
    set @temp='C'isnull(replicate(0,7-len(@temp)),'')@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.cardtype] = 'S'
    BEGIN
    set @temp=(select isnull(max(right(cardCode,7)),0) + 1 from Ocrd where   (len(cardCode)=7))
    set @temp='S'isnull(replicate(0,7-len(@temp)),'')@temp
    select cast(@temp as char(20))
    END
    Thanks & Regards
    B.Lakshmi Narayanan

  • Creating Business Partner Through Code

    Hi Everyone
    I just wanted to know if any of you knew a way to create a business partner through code.
    If there is a way or a sample that anyone can provide that would greatly
    apreciated.
    What would mandatory fields be? I know CardCode would be one mandatory field but what else would be essential?

    Hi Sebastiano,
    If you only need to read the BP data from the 'source' company then you shouldn't need to log in to it. The RecordSet object should be capable of sending a SQL query that references the other database.
    For example:
    string sSQL = "select * from " + sSourceDatabase +"..OCRD where CardCode = '" + sMyBPCode +"'"
    where sSourceDatabase is the Database ID for the source company and sMyBPCode is the BP you wish to copy.
    Using this you should only need to log in to the company where the BP needs to be created. So the whole process should be something like this:
    1) Connect to second company
    2) Run the query to collect the BP data from the first company
    3) Create an instance of the BP object and use the recordset object to assign the properties
    4) Add the BP
    Hope this makes sense
    Owen
    P.S. The other option is to use XML. See this post:
    Copy items between databases

  • How to Create Business Partner with  fix number in t-code :BP

    Dear SIr,
    Normally I will set number range for auto  to create Business Partner. In case , If we would like to crea How to Create Business Partner with  fix number in t-code :BP , howe to do?
    Please kindly advise.
    THnak you and best regards,
    Vimol

    Dear Shobhit,
    How to put the thread as you mentioned.
    Best regards,

  • Company Code info in Business Partner Master Data

    Dear all,
    We are creating customer in CRM (5.0) system, which are flows down to back End ECC (6.0) system.
    now the requirement is company code and reconciliation details need to be maintained while creating customer master data, this info is a prerequisite to create sales orders in ECC and subsequent processes.
    We don't know how to maintain finance data in CRM Business Partner Master data.
    Please educate me how to maintain the required data, and what config need to done to solve our purpose.
    your suggestions will be highly appreciated.
    Thank you,
    Raghu ram.

    HI
    To my knowledge you cant maintain company code data in CRM, you can maintain general and sales area data from here and extend the company code data only in r/3.
    Regards,
    Karunakar.

  • How to get Business Partner Number from Position Code

    Please help me in determining the Business Partner assigned to a particular position in the Organizational Structure.
    Short code of the position is available in table HRP1000 field SHORT.
    Thanks in advance

    Dear Saurabh
    You can determine business partner assigned to organization by using PDP.
    When you assign partner to organization, in relationship tab of partner we notice relationship of "is employee responsible".
    we can use this relation to determine patner assigned to org
    Step 1: Define partner function
    Step 2: Define Access Sequence..Here use "BP relationship" and specify the partner function that you are going to determine from organization.
    Step 3: Define PDP
    Step 4: Goto business partner relationship and select maintained sales org and your partner function.
    Your pdp will be able to determine partner assigned to organization.

  • How to get business partner number of a Company code

    How to get Company code business partner number..
    Any FM or table name which can help us to get comapny code business partner number
    Actually we want to find the default address number of the company code.
    please suggest a way to find partner number of company code or directly to get default address number of the company code

    Hello LS Kumar,
    Try to use below Code may help:
    DATA ls_object              TYPE hrhctobjc.
    DATA ls_company             TYPE bbps_es_unit_id.
    DATA ls_company_bupa        TYPE hrobjbupas.
    ls_object-otype = is_org_unit_id-otype.   
    ls_object-objid = is_org_unit_id-objid.   
      CALL FUNCTION 'HR_OBJECTBUPA_GETBUPA'
        EXPORTING
          is_object               = ls_object
        IMPORTING
          es_hrobjbupa            = ls_company_bupa
        EXCEPTIONS
          object_type_not_allowed = 1
          OTHERS                  = 2.
      IF sy-subrc NE 0.
        RAISE EXCEPTION TYPE cx_bbp_es_not_found.
    endif.
    Which determines the company code of the user belongs to:
    CALL FUNCTION 'BBP_OM_DETERMINE_COMPANY'
          EXPORTING
            i_user_id = lv_user
          IMPORTING
            et_compc  =lt_compc
          EXCEPTIONS
            OTHERS    = 1.
    Regards,
    Sankarbabu

  • Business partner auto code generation

    hi how to create business partner auto code generation. its based on customer group for example we have more customer group..dealer, distributor,subcontractor...
    here dealer and distributor group starting cardcode is - C000001,C000002,C000003..... etc
    when i was choose subcontractor its starts SUB00001,SUB00002...... etc
    vendor is maintain same starting letter in all groups V000001,V000002
    Thanks in advance
    Thanks & Regards
    B.Lakshmi Narayanan

    hi thanks for your valuable replies...
    i changed the codes...pls check its right or wrong
    declare @temp as char(20)
    IF $[OCRD.GroupCode] = 104  and $[OCRD.cardtype] = 'c'
    BEGIN
    set @temp=(select isnull(max(right(cardCode,7)),0) + 1 from Ocrd where (groupcode= 104) and (len(cardCode)=7))
    set @temp='TRA'isnull(replicate(0,7-len(@temp)),'')@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.cardtype] = 'C'
    BEGIN
    set @temp=(select isnull(max(right(cardCode,7)),0) + 1 from Ocrd where   (len(cardCode)=7))
    set @temp='C'isnull(replicate(0,7-len(@temp)),'')@temp
    select cast(@temp as char(20))
    END
    ELSE IF $[OCRD.cardtype] = 'S'
    BEGIN
    set @temp=(select isnull(max(right(cardCode,7)),0) + 1 from Ocrd where   (len(cardCode)=7))
    set @temp='S'isnull(replicate(0,7-len(@temp)),'')@temp
    select cast(@temp as char(20))
    END
    Thanks & Regards
    B.Lakshmi Narayanan

  • Business Partner replication from ECC to CRM based on Company code

    Hi:
    I got this requirement where we need to transfer customers from ECC --> CRM. Customers specific to a company code.
    Trying to maintain Filters for  CUSTOMER_main--> KNB1- BUKRS to filter customers by a certain company code.  I get this error " Table not maintained in smoftables."
    Checked table " SMOFFILFLD" to see there are no entries for KNB1.
    While I could check with my superiors on restricting transfer of customers based on Sales area data, as KNVV and KNVP data is maintained.
    I would like to know if I can proceed with adding new table KNB1 to this table. If this is not recommended kindly suggest one.

    The list of standard FM you can find in sap note: Note 875420 - Business partner transfer to SAP GTS: Exchange Infrast. (XI).
    BR,
    Dzmitry

  • Post Code : Want to determine the list of Business Partner !!!

    Hi all
       I have given Post Code of BP.
       I want to determine the <b>list of Business Partner</b> present in the specified <b>Post Code Location</b>.
      Is their any direct way around to determine the list of
    Business Partner ?  or Please let me know the possible ways to determine the BPs with the given Post Code !!!!
    Many Thanks
    Jack

    Hi Jack,
    Have a look at BAPI_BUPA_SEARCH function module.
    Enter the Post Code in the ADDRESSDATA structure and it will return list of Business Partners for the same.
    Also ,have a look at BUPA_PARTNER_CONTACT_SEARCH function module.
    <b>Reward points if it helps.</b>
    Message was edited by: Amit Mishra

Maybe you are looking for