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

How can we get next Alphabet in SAP

Hi Gurus ,

I have a requirement where in need alphabet as per the Fiscal Year .

For Example : Current Year : 2008

Alphabet : F

Then for next year 2009 i want it to be G so can anybody help me how can i do that

Thanks in advance

Regards

Shankar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Dec 17, 2008 at 11:40 AM

    if it is based on the English alphabet, than it is quite simple:

    DATA : number TYPE i.
    DATA : letter(1) TYPE c.
    
    START-OF-SELECTION.
    
      IF letter EQ 'Z'.
        letter = 'A'.
      ELSE.
        SEARCH sy-abcde FOR letter.
        number = sy-fdpos + 1.
        letter = sy-abcde+number(1).
      ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 16, 2008 at 10:34 AM

    Hi Shankar,

    In SAP, i dont think you can acheive this dynamically. Only way is to hard code the alphabets. Whats the actual requirement shankar. If we know that, may be we can come up with some work around.

    Best Regards,

    Ram.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ramkumar,

      By hardcoding its possible i know . Right Now i had done the same but later what will happen . I need a permanent solution for it . Is there any function module to convert Character to ASCII and Vice Versa .

      Regards

      Shankar

  • author's profile photo Former Member
    Former Member
    Posted on Dec 17, 2008 at 11:40 AM

    Hi

    You can create a Ztable and maintian the same

    or check the year if the entered date is in same year dont check if it is changed then read the current alphabet from Ztable and insert one entry to the same with new key.

    Check for alphabet Z, When it reaches restart the same with 'A'

    regards

    Shiva

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 17, 2008 at 12:33 PM

    hi shanker,

    I dont know if there is a standard function module for ur requirement

    but we hav developed our own function module.

    u can try it.

    data:v_char type char1.

    data:v_next_char type char1.

    call function 'YMPIFM_GET_NEXT_ALPHABET'

    exporting

    alphabet = v_char

    importing

    next_alphabet = v_next_char.

    Below are the function module parameters and source code.

    1) In Import Parameter

    Parameter Name TypeSpec Associated Type Short Text

    ALPHABET TYPE CHAR1 Single-character flag

    2) In Export Parameter

    Parameter Name Type Spec Associated Type Short Text

    NEXT_ALPHABET TYPE CHAR1 Single-character flag

    3) In source Code

    function ympifm_get_next_alphabet.

    *"----


    *""Local interface:*

    *" IMPORTING

    *" REFERENCE(ALPHABET) TYPE CHAR1

    *" EXPORTING

    *" REFERENCE(NEXT_ALPHABET) TYPE CHAR1

    *"----


    case alphabet.

    when ' '.

    next_alphabet = 'A'.

    when 'A'.

    next_alphabet = 'B'.

    when 'B'.

    next_alphabet = 'C'.

    when 'C'.

    next_alphabet = 'D'.

    when 'D'.

    next_alphabet = 'E'.

    when 'E'.

    next_alphabet = 'F'.

    when 'F'.

    next_alphabet = 'G'.

    when 'G'.

    next_alphabet = 'H'.

    when 'H'.

    next_alphabet = 'I'.

    when 'I'.

    next_alphabet = 'J'.

    when 'J'.

    next_alphabet = 'K'.

    when 'K'.

    next_alphabet = 'L'.

    when 'L'.

    next_alphabet = 'M'.

    when 'M'.

    next_alphabet = 'N'.

    when 'N'.

    next_alphabet = 'O'.

    when 'O'.

    next_alphabet = 'P'.

    when 'P'.

    next_alphabet = 'Q'.

    when 'Q'.

    next_alphabet = 'R'.

    when 'R'.

    next_alphabet = 'S'.

    when 'S'.

    next_alphabet = 'T'.

    when 'T'.

    next_alphabet = 'U'.

    when 'U'.

    next_alphabet = 'V'.

    when 'V'.

    next_alphabet = 'W'.

    when 'W'.

    next_alphabet = 'X'.

    when 'X'.

    next_alphabet = 'Y'.

    when 'Y'.

    next_alphabet = 'Z'.

    endcase.

    endfunction.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 17, 2008 at 12:39 PM

    hi

    to get ASCII value of any letter , u can work like this

    report demtest.

    data : c.

    field-symbols : <n> type x.

    data : rn type i.

    c = 'A'.

    assign c to <n> casting.

    move <n> to rn.

    write rn.

    This will convert 'A' to 65.

    I hope , this can help u .

    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.