Skip to Content
author's profile photo Former Member
Former Member

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 07, 2011 at 03:32 AM

    hello Deepak,

    Chk this link for your solution

    auto-generation-of-item-code

    i would like to guide that how can any one search hir/Him query in SAP form portal

    http://forums.sdn.sap.com/search.jspa?threadID=&q=autonumbering+item&objID=f264&dateRange=lastyear&numResults=30&rankBy=10001

    just fill question keyword and search particular function area ..

    Thanks

    Manvendra

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 07, 2011 at 04:21 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.