‎2009 Sep 10 5:42 PM
Hi All,
Sorry in my previous post i forgot to say that due to some other problems which we are facing, we couldn use CONVERSION_EXIT_ALPHA_INPUT
My requirement is i have work area with a field as shown below.
wa_table-registerno. this has some value say 12345678.
Now i have to check if the value is equal to a DB table field say wa_table-bnumber. This field has value 0012345678.
Both fields are having length of 10.
Now problem is the field in table is appending zeros in front, so when i check if they are equal, the condition is failing.
I have to have make my field wa_table-registerno to fill the remaining zeros in front for different cases, (two zeros for this case,but it may vary for next number). if so how to proceed?
Or is there any other way.
My requirement is even if there are zeros in front, the condition should not fail.
How to proceed?
Thanks in advance.
‎2009 Sep 10 5:51 PM
instead of ading zeroes in your field why dont you remove extra zeroes before comparing the field using SHIFT <> DELETING ZEROES command.
‎2009 Sep 10 5:47 PM
Hi
If u not using the conversion exit. Then take a varibale of length 10 with type n.
before comparing the internal table value to DB,pass the internal table value to the variable.
regards,
Raghu
‎2009 Sep 10 5:51 PM
instead of ading zeroes in your field why dont you remove extra zeroes before comparing the field using SHIFT <> DELETING ZEROES command.
‎2009 Sep 10 6:49 PM
if i use shift then how to proceed for each record,
for example in the first time of loop the value is 0012345678
the next time it is 0000123456
the next time 0000000234
so how to proceed.. plz explain
‎2009 Sep 10 7:00 PM
Hi,
try this way...
"if w_mara lenght is 18characters..
data : w_len type int2.
w_mara = '12345'.
w_len = strlen( w_mara). "lenght is 5
w_len = 18 - w_len. "now lenght is 13
do w_len times. "now it will loop 13 times and add 13 zeros to matnr.
concatenate '0' w_mara into w_mar.
enddo.
write : w_mara.
"output is : 000000000000012345.
regards,
Prabhudas
‎2009 Sep 10 5:57 PM
If you cannot use CONVERSION_EXIT_ALPHA_INPUT then try UNPACK command. Check this example.
DATA: FIELD1(2) TYPE P VALUE '10',
C_FIELD2(4) TYPE C.
UNPACK FIELD1 TO FIELD2.
WRITE: / FIELD2.
Regards,
Vikranth