Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

validation

Former Member
0 Likes
535

hi,

My issue is about validation. I am validating one of the field(s_rzzps) in the program . code is as follows:

p_rbukrs like zupi5t-rbukrs obligatory. "Company code

s_rzzps for zupi5t-rzzps_posid obligatory no intervals, "WBS Element

data v_usr00 like PRPS-USR00.

Loop at s_rzzps.

if p_rbukrs >= 1001 and p_rbukrs <= 9999.

case s_rzzps-low(1).

when 'T'.

When 'C'.

Select single usr00 into v_usr00

from PRPS where POSID = s_rzzps-low.

if v_usr00 is initial.

message e013.

endif.

When Others.

message e013.

endcase.

endif.

endloop.

the program is working fine when the company code is given as a numeric value say 1001. but when i am giving it as alphanumeric value say U697 program is going into dump. The value U967 exists in the table. In the dump analysis it is showing the error at the line

if p_rbukrs >= 1001 and p_rbukrs <= 9999.

Unable to interpret "U697" as a number. CONVT_NO_NUMBER---error id.

company code values in my table are

0001,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,......9099,A550,AR01,AT01,AU01,BE01,BR01,C475,CA01,CCMk,CH01,CL01,CN01,CO01,COPY,CZ01,DE01,DE02,DK01,ES01,F208,F210,F621,FI01,FI42,FR01,GB01,HK01,HU01,IE01,IT01,J101,J102,J103,J104,J105,J701,J702,J901,J902,KR01,KZ01,LU01..........ZA01

But the requirement is the validation should be done only for the company codes between 1001 and 9999 which should also include these alphanumeric values. Is there any way to do . please help me out.

company code(bukrs) is character type. will this accept only numeric values it will not accept non numeric values.

The condition which i am giving will compare only numeric values ? how to resolve this plz help me

Thanks and Regards

Ramya.

3 REPLIES 3
Read only

Former Member
0 Likes
489

Hi,,

First check if there is any alpha numeric value thru "Contains Any"

if p_rbukrs CA 'ABCDEFG....Z'.

if p_rbukrs >= A and p_rbukrs <= B (If u still wanna validate then ..)

,,,,,,,,,,,,,

,,,,,,,,,ur logic

if p_rbukrs >= 1001 and p_rbukrs <= 9999.

revet back if any issues,

Regards,

Naveen

Read only

Former Member
0 Likes
489

Hi,

For validation try this ....

at selection-screen on p_rbukrs.

select single * from table

where field eq p_rbukrs.

Regards,

Billa

Read only

Former Member
0 Likes
489

Hi Ramya,

I am a bit confused about the logic which u have written for validation. How can u wite the logic as P_BUKRS >= 1001 when existing values for company code are alphanumeric.

Had all the values been numeric then this logic wud have been working fine...i am wondering how can u compare alphanumric code with a numeric value (1001 to 9999).

Program is throwing dump becoz of mismatch comparison.

As per your logic, I suppose that your requirement is to validate for numeric company codes only not for alphanumeric values.

In order to make it happen, you apply one more check before IF (if p_rbukrs >= 1001 and p_rbukrs <= 9999.) condition to validate if the retrieved company code is a numeric value or not. If it is an alphanumeric dont go indside the validation.

In case if u have to validate for numeric as well as alphanumeric, i believe u have to rewrite the logic for comparing company code..

Thanks.

Ashish