‎2007 Jan 30 1:36 PM
I am tryin to create a userexit. when for a particular transaction when user enter serial number I have to make it doesn't exist and is in the specified format ( 1st digit should be 7 5,8 last four digits should be between 0000-9999).For all other transaction I have to make the serial number is present and specify error message if non-existent number is entered. I was able to come up with the following code. Please let me know to how to validate the format of the code....
IF sy-tcode = 'xxxx'.
SELECT SINGLE * FROM equi INTO i_equi
WHERE eqtyp = 'S'
AND matnr = matnr
AND sernr = sernr.
IF sy-subrc EQ 0.
MESSAGE E398(00) WITH 'serial number already exists'.
ELSE.
check validation like sernr+0(1) = first digit
sernr1(2) = sy-datum2(2).
sernr3(2) = sy-datum0(2).
sernr+5(4) = last four digits.
ENDIF.
ELSE.
SELECT SINGLE * FROM equi INTO i_equi
WHERE eqtyp = 'S'
AND matnr = matnr
AND sernr = sernr.
IF sy-subrc NE 0.
MESSAGE E398(00) WITH 'Please enter a valid serial number'.
ENDIF.
ENDIF.
‎2007 Jan 30 2:15 PM
‎2007 Jan 30 2:51 PM
I didnt really get your question - i mean, what do you want help with?
1. What's the transaction code(s) you're using?
2. Have you already identified the user-exit, or is that what you are asking here?
3. Having an error-message in a UE? Please check a few things first - is that the expected/required behaviour? Also, will it work? Just insert a single e-message in the UE, with no other code, and see if your transaction actually errors out, or throws up a runtime error, or simply doesnt do anything!
Plz award points if answers are useful!
‎2007 Jan 30 2:58 PM
I have identified the User Exit....Now I have to code it properly...I want anyone to go through the code...and help in writing correct code.