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 while creating entries

Former Member
0 Likes
936

Hi Experts,

I've created a custom table with table maintenance generator and want to perform validations while creating new records using SM30.

For this I've created one event of type 05.

Now while creating new entries, it performs the validation and shows the error message in the status bar, but in that screen it is not allowing me to modify that data and save again.

How can I do this please suggest.

Code snippet:form validate_input .

data: v_vendor type lifnr,

v_cust type kunnr.

select single lifnr

from lfa1

into v_vendor

where lifnr = zmm_co_cus_ven-vendor_id.

if sy-subrc ne 0.

message 'Vendor does not exist in LFA1.' type 'E'.

endif.

select single kunnr

from kna1

into v_cust

where kunnr = zmm_co_cus_ven-cust_id.

if sy-subrc ne 0.

message 'Customer does not exist in KNA1.' type 'E'.

endif.

endform. " VALIDATE_INPUT

Thanks in advance.

Anirban.

3 REPLIES 3
Read only

Former Member
0 Likes
772

If you establish a foreign key relationship in your table between zmm_co_cus_ven-vendor_id and lfa1-lifnr, the check should be done automatically and you won't need any logic here at all.

Rob

Read only

Former Member
0 Likes
772

Hi,

Put Check table for the 2 custom fields in the custom table.

This would avoid the Event coding also.

Regards,

Kranthi.

Read only

0 Likes
772

Thank you all.

Points given.

Anirban.