‎2008 Apr 18 5:41 AM
hi friends.
im formatting one field which is having 12 characters.
aufk-aufnr.
suppose in csv file if i take more than 12 characters it should display message field format is incorrect.
but the length of the field is 12 characters.
it is not displaying message.
im taking in internal table as
begin of input,
aufnr like aufk-aufnr,
end of input.
begin of input,
aufnr(12),
end of input.
i have tested 2 cases but not working.
please give necessary suggestions.
‎2008 Apr 18 5:42 AM
hi,
You just try with some code using the if statement and test sy-subrc ,
then display the message it might work.
Reward if helpful.
Jagadish.
‎2008 Apr 18 5:53 AM
hi,
try using strlen statement
b = strlen( aufnr ).
if b > 12.
give your message
endif.
reward if helpful
prasanth
‎2008 Apr 18 6:03 AM
yeah.
just im doing like that.
im taking order number as 100001019.
im using conversion exit and checking.
like v1= strlen(itab-aufnr).
if v1 ne 12.
message' field format is not correct'.
endif.
for this it is working.
but the problem is i should check taking it as 1111100001019.
then i should get message.
‎2008 Apr 18 6:11 AM
Hi Vijay,
You seem to be checking the length of the Order Number after you are making use of the conversion exit.
Obviously the conversion exit that you are using would return you a number with length 12 and hence the message would not be thrown.
If you want any message to be shown, it should be before converting the number. Check whether the length is greater than 12 before converting the Order number, if it proves to be greater then display the message.
Reward points if this info helps,
Kiran
‎2008 Apr 18 6:16 AM
hI,
I am confused ...becz u have defined aufnr as CHAR 12.....and u r passing 13 digit num...so how come it will display the message...
In ur no given above 13 characters are thr...1111100001019... So when moving to aufnr it will be redued to 12 since u have defined it as 12 character...
Try it define aufnr slightly high...or restrict the user from entering 12 character by putting field restriction of character 12....
Rewards if usefull.
Regards ABAPer 007
‎2008 Apr 18 6:20 AM
Thanks kiran.
But it wouldn't work if order number is 100001019.
for that it will give problem. like this.
data: v(12),
Format checks for fields
loop at itab1.
v = strlen( itab1-aufnr ).
if ( v NE 12).
write : 'Format of fields are not correct' .
endif.
endloop.
‎2008 Apr 18 6:36 AM
Hi Vijay,
here you are talkin about two different cases altogether. these two are to be handled differently.
one is where your order number is correct but it lacks padding zeros, in that case.
if ( strlen(aufnr) lt 12 ).
call the conversion routine.
elseif (strlen(aufnr) gt 12 ).
write 'format of data is wrong'.
endif.
if the order number is right and there are no padding zeros you need not throw any error in any case. no scenario shall ask you to do that.
after conversion routine is performed and then if the resulting number is not available in the master data table then we should give an error saying that such an order number doesn't exist.
Reward points if this info helped,
Kiran
‎2008 Apr 18 7:32 AM
im trying to move order number into another field which is 20 characters.
aufnr1(20).
itab1-aufnr1 = itab1-aufnr
when it is more it should be taken else
the same order number can be passed.
but still im getting problem .