10-22-2008 10:37 AM
hi all , i have a field g_aufk-zz_pmf_key it is 7 char
i need to pass it to t_aufk if the last 2 char are numbers
so i wrote
IF g_aufk-zz_pmf_key+5(2) CA '0123456789'.
t_aufk = g_aufk-zz_pmf_key.
ELSE.
WRITE:/'error'.
ENDIF.
but when i see i debugging i can see the value in g_aufk-zz_pmf_key+5(2) is blank .
can anynody suggest me a better way ?
Regards
10-22-2008 10:42 AM
Hello ,
The code you have written should work fine.
The only reason i can see is that the last 2 fields are blank in g_aufk-zz_pmf_key . So it will not give any results. You need to check this.
Rgds,
sandeep
10-22-2008 10:44 AM
hello sandeep the value in g_pmkey+5(2) is blank
but i g_pnkey there is a value .
Can you please help me with ths
10-22-2008 10:48 AM
But you are c hecking g_pmkey+5(2) and not g_pnkey.
Please paste ur code here.
10-22-2008 10:52 AM
Hi Bhanu,
You can use the below logic.
Declare a variable of length 7 say namely ld_var.
ld_var = g_aufk-zz_pmf_key
Use FM CONVERSION_EXIT_ALPHA_INPUT on ld_var.
IF ld_var+5(2) CA '0123456789'.
t_aufk = g_aufk-zz_pmf_key.
ELSE.
WRITE:/'error'.
ENDIF.
10-22-2008 10:48 AM
Hey Bhanu,
According to your logic, even if one of the characters turns out to be a number, data will be passed to t_ausk, which I think is not according to your requirement. for eg: wot if last 2 characters are 'a2' ?
Using your logic, data will be passed.
Why don't you see for each character..
ie,
IF g_aufk-zz_pmf_key+5(1) CA '0123456789' and
g_aufk-zz_pmf_key+6(1) CA '0123456789'.
t_aufk = g_aufk-zz_pmf_key.
ELSE.
WRITE:/'error'.
ENDIF.
cheers,
Vishnu
10-22-2008 10:49 AM
Hello,
It is working fine for me if not you can use this logic.
I tested just now it is working fine.
DATA: y_v_char TYPE char7 VALUE 'ABCDE89'.
DATA: y_v_char1 TYPE char2.
IF y_v_char+5(2) CA 'ABCDE89'.
y_v_char1 = y_v_char+5(2).
ELSE.
WRITE:/'error'.
ENDIF.
10-22-2008 10:53 AM
Check if g_aufk-zz_pmf_key have any value and is not empty.
regards,
Advait
10-22-2008 10:54 AM
hi,
i tried like this. it's getting value... just check it once...
data: zz_pmf_key(7) type c value 'abcde45'.
data: t_aufk(2) type c.
IF zz_pmf_key+5(2) CA '0123456789'.
t_aufk = zz_pmf_key+5(2).
*move zz_pmf_key+5(2) TO t_aufk.
ELSE.
WRITE:/'error'.
ENDIF.
Regards,
Shankar.
10-22-2008 11:08 AM
Hi,
DATA : LEN TYPE I,
IND1 TYPE I,
IND2 TYPE I.
LEN = STRLEN( G_AUFK-ZZ_PMF_KEY ).
IND1 = LEN - 2.
IND2 = LEN - 1.
IF G_AUFK-ZZ_PMF_KEYIND1(1) CA '0123456789' AND G_AUFK-ZZ_PMF_KEYIND2(1) CA '0123456789'.
T_AUFK = G_AUFK-ZZ_PMF_KEY.
ELSE.
WRITE:/'error'.
ENDIF.
10-22-2008 1:36 PM
If you want to check that BOTH characters are numbers, you must code
CO '0123456789'.
and NOT
CA '0123456789'.