‎2009 Apr 22 10:35 PM
I have a situation where for a given character say 'A', the program should propose the next in the english alphabet. I have used a logic with field symbols of type X , it works in 4.6c but not in ecc6.0 with the unicode checks. Is there a way to get this or a function module that does it..
Thank you
Edited by: Krish M on Apr 22, 2009 11:39 PM
‎2009 Apr 22 11:03 PM
Pretty basic:
REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.
PARAMETERS p_let(1) OBLIGATORY.
DATA: f1(26),
next_let(1),
pos TYPE i.
MOVE sy-abcde TO f1.
IF f1 CA p_let.
pos = sy-fdpos + 1.
IF pos = 26.
pos = 0.
ENDIF.
next_let = f1+pos(1).
WRITE: p_let, next_let.
ENDIF.Rob
‎2009 Apr 22 11:03 PM
Pretty basic:
REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.
PARAMETERS p_let(1) OBLIGATORY.
DATA: f1(26),
next_let(1),
pos TYPE i.
MOVE sy-abcde TO f1.
IF f1 CA p_let.
pos = sy-fdpos + 1.
IF pos = 26.
pos = 0.
ENDIF.
next_let = f1+pos(1).
WRITE: p_let, next_let.
ENDIF.Rob
‎2009 Apr 23 2:18 PM
Using TRANSLATE would seem the simplest. TRANSLATE string USING 'AB'.
parameters: p1 type c.
translate p1 using 'ABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZA'.
matt
‎2009 Apr 22 11:07 PM
Hi,
check this sample program.
DATA: input TYPE char1 VALUE 'A',
output TYPE char1,
index TYPE int4.
FIND FIRST OCCURRENCE OF input IN sy-abcde
MATCH OFFSET index.
CHECK sy-subrc = 0 AND input NE 'Z'.
index = index + 1.
output = sy-abcde+index(1).
WRITE: / output.
Thanks
Naren
‎2009 Apr 23 3:20 AM
Hi Krish,
Try this code.
DATA: ALL_LETTERS(26),
NEXT_LETTER(1),
NEXT_POSITION TYPE I.
MOVE SY-ABCDE TO ALL_LETTERS.
IF ALL_LETTERS CA APLHABET.
NEXT_POSITION = SY-FDPOS + 1.
IF NEXT_POSITION = 26.
NEXT_POSITION = 0.
ENDIF.
NEXT_LETTER = ALL_LETTERS + NEXT_POSITION(1).
WRITE: APLHABET, NEXT_LETTER.
ENDIF.
Thanks & regards,
Dileep .C
‎2009 Apr 23 2:07 PM
Interesting code snippet Dileep. But it looks ... I don't know ... kind of familiar.
Rob
‎2009 Apr 24 1:53 AM
Hi Rob,
Thanks,, I am very much Impressed ROB.
I know what I did, And you caught it.
But this is what mostly happening in the forums.. just to let to know the moderators i did the same in the moderators post..
Sorry for trouble, and as usual I will never repeat..
Thanks & regards,
Dileep .C
‎2009 Apr 24 2:16 PM
OK - bear in mind that cut and paste answers are usually removed and points unassigned.
Rob
‎2009 Apr 24 2:20 PM
>But this is what mostly happening in the forums.. just to let to know the moderators i did the same in the moderators post..
How to beleive you..:-)))
Edited by: Vijay Babu Dudla on Apr 24, 2009 9:20 AM
‎2009 Apr 27 2:24 AM
Hi Vijay,
How to beleive you..:-)))
Its Simple,
When I was replying I have seen many replies just copying the code and pasting the code after a changing case...
And I still remember that I have almost reportred nearly 10-12 threads as abuse explaining this...
And after some day I still seen the same user doing the same again...
I am not sure in which thread I have seen that.
But I am sorry for all the above which is really not necessary,
And Now I got a clear picture & more aware of the forums by looking into the Community Discussions from last few days.
And this thread is already closed... we can close this conversation here...
Thanks a lot again to the moderators.
Thanks & regards,
Dileep .C