‎2011 Jan 12 12:57 PM
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.
‎2011 Jan 12 3:07 PM
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
‎2011 Jan 12 10:51 PM
Hi,
Put Check table for the 2 custom fields in the custom table.
This would avoid the Event coding also.
Regards,
Kranthi.
‎2011 Jan 13 10:21 AM