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

Validations

Former Member
0 Likes
458

I have to add a field(vendor reference) in RFC Table and that should be an optional field and the validations that i have to do is that

The entered value should exist in the table LFA1 and in the field LIFNR (LFA1-LIFNR) or the entered value should me a text with"NO-ALLOC"

Otherwise it should show an error,

Please provide me the code

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
437

Select lifnr from lfa1 into lv_lifnr

where lifnr = entered value.

if sy-subrc <> 0.

get text for entered value in lv_text.

if lv_text ne 'NO-ALLOC'.

error message.

endif.

Lokesh

pls. reward if it helps.

Message was edited by:

Lokesh Aggarwal

2 REPLIES 2
Read only

Former Member
0 Likes
437

hmmm well, theres no code need to achieve this. all you need to do is to assign LFA1 as foreign key table to that field. this will give you on one hand a validation against the values in LFA1, AND a F4 help as well for that field.

Read only

Former Member
0 Likes
438

Select lifnr from lfa1 into lv_lifnr

where lifnr = entered value.

if sy-subrc <> 0.

get text for entered value in lv_text.

if lv_text ne 'NO-ALLOC'.

error message.

endif.

Lokesh

pls. reward if it helps.

Message was edited by:

Lokesh Aggarwal