Number range mapping to alphanumeric numbers.

Gurus,
I want some help in writing some logic in ABAP. I have a scenario when a the numbers that are coming via interface are greater then 99. In that case, I have to map according to following scenario:
Ex: If its 100, it should be converted to A1 and so on..
A0-A1--A9-AA--
AZ (100 - 135)
B0-B1--B9-BA--
BZ (136 - 171)
Z0-Z1--Z9-ZA--
ZZ
Thanks.
Regards,
Rajesh.

Hi,
Please check this code...
DATA: v_char2 TYPE char2.
DATA: v_input TYPE char2.
START-OF-SELECTION.
  v_input = '00'.
  DO 200 TIMES.
    PERFORM get_next_number USING v_input
                         CHANGING v_char2.
    v_input = v_char2.
    WRITE: / sy-index, v_char2.
  ENDDO.
*&      Form  get_next_Number
*       text
*      -->F_INPUT    text
*      -->F_OUTPUT   text
FORM get_next_number USING f_input  TYPE char2
                  CHANGING f_output TYPE char2.
  DATA: v_numc2 TYPE numc2.
  DATA: v_1char TYPE char1,
        v_index1 TYPE syfdpos,
        v_index2 TYPE syfdpos,
        v_2char TYPE char1,
        v_numc  TYPE n.
* Check if the input contains only numbers.
  IF f_input CO '1234567890'.
    v_numc2 = f_input.
* if the number is less than 99. then increment and exit
* the subroutine.
    IF v_numc2 < 99.
      v_numc2 = v_numc2 + 1.
      f_output = v_numc2.
      EXIT.
    ENDIF.
  ENDIF.
* If the number = 99 then assign A0 and exit the subroutine.
  IF f_input = '99'.
    f_output = 'A0'.
    EXIT.
  ELSEIF f_input = 'ZZ'.
    f_output = '01'.
    EXIT.
  ENDIF.
* This logic contains if the value contains characters.
* Get the values
  v_1char = f_input(1).
  v_2char = f_input+1(1).
* If the second character contains the value '9' then assign
* A
  IF v_2char CO '012345678990'.
    IF v_2char = '9'.
      f_output(1)   = v_1char.
      f_output+1(1) = 'A'.
      EXIT.
    ELSE.
      f_output(1) = v_1char.
      v_numc = v_2char.
      v_numc = v_numc + 1.
      f_output+1(1) = v_numc.
      EXIT.
    ENDIF.
  ENDIF.
* Get the position
  FIND v_1char IN sy-abcde MATCH OFFSET v_index1.
* Get the second position
  FIND v_2char IN sy-abcde MATCH OFFSET v_index2.
* If the second character is the last character in the
* alphabets then go to the next character.
  IF v_2char = 'Z'.
    v_index1 = v_index1 + 1.
    f_output(1) = sy-abcde+v_index1(1).
    f_output+1(1) = '0'.
    EXIT.
  ENDIF.
* The last option.
  v_index2 = v_index2 + 1.
  f_output(1) = v_1char.
  f_output+1(1) = sy-abcde+v_index2(1).
ENDFORM.                    "get_next_Number
Thanks
Naren

Similar Messages

  • Number range object issueing the  numbers randomly

    Hi All,
      We have created a number range object and used in a program,but it is issuing the values randomly if it  is issues 8 yest ,today is issuing 7 .
    do any any idea on this issue?
    Regards
    Channa

    Hi,
    Please check the number range configuration.
    [Number Range Example:|http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=50004015]
    Shiva

  • Number Range Assignment for personel numbers

    In my all three clients i am getting this strange behaviour that my system is skipping the perners ,even though my number range is internal and i have maintained all necessay entries , i find that my system is skipping perners randomly sometime q is skipped and sometimes even 90+ perners are deleted.
    Please can anyone help me in this regard.?

    First try to segregate your number ranges into three companies then maintain it atleast you identification of different personnels.
    then if your doing batch loading of personnel thru BDC or lsMW the usual problem is with master data so it skip number ranges.
    try to reset number ranges but before that delete your entries to pu00 tcode.
    let see if this works..
    Thanks
    Toti

  • 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.

  • External Alphanumeric Number range for order

    Hi  ,
    My requirement is to create an external number range for one PM order type where
    first 8 places from left can be alphanumeric and next 4 places should be numeric only .
    like EQ12341H0112
    here last numeric characters(in bold)  actually will specify month and year in format MMYY (0112 means jan2012) . So I doesn't want system to accept  last four characters as 1312 or 0012  also (because month should be in range 01 to 12 only)
    How I can achieve the same.What number range i should define for external entry .
    Regards
    PM
    Edited by: PM_SAP87 on Jan 18, 2012 11:41 AM

    Hi,
    You will not be able to achieve this specific logic by just defining a number range. What you can do is define an external number range that is alphanumeric and use exit IWO10017 to format and validate user entry.
    -Paul

  • Suggestion for number ranges 8 digit with alphanumeric externally

    hai gurus,
    can anyone give the suggestion how to set the number ranges  8 digit alphanumeric externally.
    Thanks..

    Hi Lakshman,
    I'm beginner so I haven't defined such thing but isn't your proposal 'numeric'?
    If it was alphanumeric the string should contain 'Z' I think. (e.g. from '0' to 'Z')
    Sorry if I'm mistaken.
    BR
    Csaba

  • Mass Number range buffering issue

    Hi ,
    We are facing issue with the buffering of mass number range allocated to document type of cheque lot. While executing transaction FP25 system is giving error "No free number range is found for document type xx". We have checked the object FKK_BELEG in SNRO there "No Buffering" is defined and also in number ranges its showing enough numbers to be used. Mapping in the system for mass processing is like that :-
    DT     From                  To                     Status
    X2  0XX00000000 - 00XXXXXXXXXXXX - XXXXXXXXX693
    Also while in initial postings system always take alternate numbers for posting.
    Any suggestion to resolve this will be highly appreciated.
    Thanks and Regards
    Kumar

    Hi Ashwani,
    Please refer to the following thread which discusses the same issue-
    FKK_BELEG number range object buffering
    The solution to the buffering issue would be configure the mass number ranges.
    Hope it helps...
    Thanks,
    Amlan

  • Excise invoice number ranges

    Hi
    I want to define number ranges for particular sales document type. Am aware we can do it through Tcode SNRO. But pls guide me step wise what field to  selct from drop down .
    /BEV1/EMLG     Empties Update Sequence Number
    /BEV3/CHAB     Number Range for Settlement Runs
    /BEV3/CHBK     Number Range for Purchase Control Results
    /BEV3/CHBU     Number Range for Posting Document
    /BEV3/CHEG     Number Range for Supplementary Documents
    /BEV3/CHEV     Sequence Number of BTEs Used in Contract Handling
    /BEV3/CHLE     Sequence Number of Amount when Entering External Amount
    /BEV3/CHOB     Number Range for Objects in the Beverage Industry
    /BEV3/CHSO     CH Assortment Number
    /BEV3/CHVA     Number Ranges for Contract Statement
    /BEV3/CHVD     Contract Handling Document Number
    /DSD/FSR     DSD: Run Number of Final Settlement
    /DSD/ME_CO     Number Range Cockpit
    /DSD/ME_CP     Customizing Cockpit
    /DSD/ME_KY     DSD Mobile Key
    /DSD/PR_NR     Number Range for MDSD Promotion Numbers
    Regards
    Suvin

    hi,
    In SNRO , Give object type RV_BELEG. In that you maintan your number range.
    swapnil

  • Excise invoice number range.

    Dear Sirs,
    For a new trading business I have assigned a new number range for commercial invoices but I am unable to create a new number range for Excise Invoices.
    Please suggest how I can create a new Excise number range for this particular business & how I can interlink it with the commercial invoices.
    Looking forward for your kind support.
    best regards,
    Rajdeep

    Hi
    As Ratish alraedy mentioned that Excise Invoice No. Range is maintained on the basis of Series Group, so check your series Group.
    T-Code : SNRO
    Following is the No. Range Objects related to Excise, select the proper no. range object as per your requirement.
    J_1I57FC - 57FC Number Range
    J_1IARE1 - ARE1 Doc No object based on Series Group
    J_1IARE3 - ARE3 Doc No object based on Series Group
    J_1IBOND - Excise Bonding: Bond number object
    J_1ICERT - Withholding Tax Certificates (India)
    J_1ICHLNNO - Internal number range for challans
    J_1ICONPLA - Consolidated PLA serial no. generation
    J_1IDEPINV - Excise Invoice Number for Depot Invoices
    J_1IEXCEXP - Export excise invoice number range
    J_1IEXCINV - Excise invoice number
    J_1IEXCLOC - Local excise invoice numebr range
    J_1IEXCTST - Excise invoice with intervals
    J_1IEXINEX - Excise invoice number for export
    J_1IINTNUM - Internally document number to be generated
    J_1IINTPR2 - Despatch serial number
    J_1ILIC - Excise Bonding: License number object
    J_1IPLA2 - PLA part II number range object
    J_1IRG1 - RG1 Number range object
    J_1IRG1_T - No. Range for RG1 - Excise group / Material
    J_1IRG23A1 - RG23A part 1 no. range object
    J_1IRG23A2 - RG23A part II number range object
    J_1IRG23C1 - RG23C part I number range object
    J_1IRG23C2 - RG23C part II number range object
    J_1IRG23D - Folio Numbers for RG 23D
    Regards
    Amitesh Anand

  • Excise number Range Maintenance

    How to maintain Excise number Range and in which object we have to maintain number range for domestic /export etc

    Hi rohith
    Go to SNRO (or) SNUM and select any of the below objects required by you and select NUMBER RANGE on top. It will ask for "Series Group". Give the respective plant's series group and click "Change intervals".
    Now give some value in the field "No" followed by year and number range and save.
    J_1IARE1         ARE1 Doc No object based on Series Group
    J_1IARE3         ARE3 Doc No object based on Series Group
    J_1IBOND        Excise Bonding: Bond number object
    J_1ICERT         Withholding Tax Certificates (India)
    J_1ICHLNNO     Internal number range for challans
    J_1ICONPLA     Consolidated PLA serial no. generation
    J_1IDEPINV      Excise Invoice Number for Depot Invoices
    J_1IEXCEXP     Export excise invoice number range
    J_1IEXCINV      Excise invoice number
    J_1IEXCLOC     Local excise invoice numebr range
    J_1IEXCTST      Excise invoice with intervals
    J_1IEXINEX       Excise invoice number for export
    J_1IINTNUM      Internally document number to be generated
    J_1IINTPR2       Despatch serial number
    J_1ILIC             Excise Bonding: License number object
    J_1IPLA2          PLA part II number range object
    J_1IRG1           RG1 Number range object
    J_1IRG1_T        No. Range for RG1 - Excise group / Material
    J_1IRG23A1      RG23A part 1 no. range object
    J_1IRG23A2      RG23A part II number range object
    J_1IRG23C1      RG23C part I number range object
    J_1IRG23C2      RG23C part II number range object
    J_1IRG23D        Folio Numbers for RG 23D
    Thanks
    G. Lakshmipathi

  • SAME NUMBER RANGES FOR DOMESTIC AND EXPORT INVOICE

    Dear All,
    We have maintained Two objects separately for Exports and Domastic sales invoices which is inturn giving two different number ranges.
    But our client needs same number to be continued for both.
    For eg: 000001 .  000002 and 000003 is the number range for domastic invoices for Export invoice 00004 should come. now as we have maintained different objects Export invoice is starting from 00001.
    Our client does'nt want to maintain separate number ranges for Exports and Domastic, same number range should be there for both which should follow continues numbers.
    Please suggest me on this at the earliest.
    Regards,
    Jay

    Dear Jay
    Assuming that you are asking about Excise Invoice number ranges, please do maintain Numbers for the Object: J_1IEXCLOC
    When you go into J1IIN, you will need to mark the checkbox: Use Local Number. If at the first time (in the case of Deemed and Regular Exports), you do not see this checkbox, click on the 'Calculator' icon and hit the 'Back' icon. Mark the checkbox and save your Excise Invoice. This number will be a continuation of your Domestic Excise Invoice.
    thanks
    G. Lakshmipathi

  • Dep number range issue (External Assignement)

    Dear All,
    i am getting error wile posting Dep (AFAB) for external number range assignment for Document type AF (Dep Posting in Current Year, but in last year it get posted with internal number range only)
    See the error.
    Create document number range 03 using external number assignment
    Message no. AA759
    Diagnosis
    Processing had to be terminated, since you set up the document number range 03 for the year 2011 with internal number assignment.
    System response
    You should create a document number range with external document numbers for periodic depreciation posting, since the document numbers are not assigned from Financial Accounting, but by the posting program of Asset Accounting.  The external number assignment, therefore, should not be understood as manually entering the document number.  It is only external from the point of view of the Financial Accounting application.
    Procedure
    Change the number range 03 from internal to external number assignment in Asset Accounting Customizing.
    Why system is behaving like this. It should be internal number range as i post the Dep in  other clients and it is working properly with internal number range.
    Kindly Suggest
    Regards,
    Shayam

    Hi
    SAP itself contradicting his own statement.
    When i create external number range assignment in one of the other client system show me the message.
    Create document number range 04 using internal number assignment
    Message no. AA776
    Diagnosis
    Processing terminated because the document number range 04 for year 2011 was set up with external number assignment.
    System Response
    For periodic posting of depreciation, you have to create a document number range with internal number assignment, since the document numbers are assigned from Financial Accounting.
    Procedure
    Change the number assignment for the number range 04 from external to internal in Customizing for Asset Accounting. See SAP Note 890976 for more information.
    Now what to do kindly advice.
    Regards,
    Shayam

  • Reuse Number Range SD after archiving document

    Hi,
    we have archiving documents SD of the past years. Is possible reuse the range of documents considering that the range is almost finished?
    Thanks.
    Charly

    Hi Charly,
    I think the answer to your question is "yes" from a Technical point of view, but "not recommended" from a Business point of view.
    ¿Did you evaluate changing to a new number range within the (unique) 10 digits SD number range instead of "reusing" numbers of already archived documents?
    Best Regards,
    Franck

  • Number Range Missing

    Strange behavior is there in the system concerning the Number range as some Invoice Numbers are missing from the system for example after 111121..it is 111122..and then 111123, 24, 25 is missing then 26 is there and then 27 is missing and then 112228 is there, Buffer Management is not maintained for the SD Object RV_BELEG  and no archiving also
    Any Suggestions where to look into for this.
    Regards,
    N

    Hi
    Goto VOFA for your billing document type and fetch number range assigned to that.
    Goto SE11>Table TVFK>pass your number range fetched in above step as NUMKI and see which else document has assigned to it.
    Pass same number to table TVAK to check whether sales order document has assigned to this number range.

  • Depreciation Number Range

    Hi!
    Experts,
    Can you please tell me the Number Range for Depreciation Post?
    My problem is:
    When I keep Number Range as internal, system not allow me to post the depreciation and give the following error at the time of Test Run:
    Create document number range 60 using external number assignment
    Message no. AA759
    Diagnosis
    Processing had to be terminated, since you set up the document number range 60 for the year 2007 with internal number assignment.
    System response
    You should create a document number range with external document numbers for periodic depreciation posting, since the document numbers are not assigned from Financial Accounting, but by the posting program of Asset Accounting.  The external number assignment, therefore, should not be understood as manually entering the document number.  It is only external from the point of view of the Financial Accounting application.
    Procedure
    Change the number range 60 from internal to external number assignment in Asset Accounting Customizing.
    While
    When I keep the Number Range for Depreciation as external, at that time  Test run of  depreciation  run successfully and also show account document generate, I also check generated  document by double clicking  on document number in the test run and it is correct, it is also run successfully in background, but
    what happen when I am going to check my accounting document of Depreciation and Acc. Depreciation, no balances shows in this a/c., while in AW01N depreciation for the period which I run is shows in green, i.e. posted.
    while depreciation amount shows in to the controlling report like KSB5 & Cost Center Report.
    Rakesh

    Hi!
    Thanks Sreekanth for your reply,
    But I have no problem with Asset Creation No. Range and Asset Posting Number range, but I faced problem at the time of depreciation posting i.e. document type AF.
    Rakesh

Maybe you are looking for

  • Using ssh as an http proxy on Arch [SOLVED]

    I read this article and would like to use a friend's debian box as a www proxy.  I ssh'ed into it using the following command from my Arch box: $ ssh user@ip -D 8000 As I understand it, his box is now acting as a SOCKS-type (pseudo)server.  I configu

  • Read arabic from a file

    Hello everybody, I try to read arabic unicode signs from a file into a String within my program. I create the file using simple windows notepad. The sign Im wrinting look perfectly arabic (although I actually cant read it). Now when I start my progra

  • Has anybody found a fix to Facebook video calling in Mavericks, or am I being a moron over the whole issue?

    I'm having, and have for a while now, since installing Mavericks had a issue with using video calling for Mavericks. Even though the video icon for video calling is availible in safari, Firefox etc the java app will not download and install. I know t

  • PA30 Display Facsimiles Authorization Issue

    Dear All, I am facing one authorization issue in PA30 Transaction. User trying to display the archived documents from PA30 > Extras > Display All Facsimiles, when user trying to execute he is facing the below authorization issue. You have no authoriz

  • Samsung T240 & Screensaver on 10.4.11

    I have connected up a brand new T240 monitor to replace an old large two page Viewsonic CRT monitor, all of which are were running on a resolution of 1900x1200. My Mac is a Power Mac G4 (AGP) at 450MHz with the ATI video card that came with the Mac a