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

User Exit

Former Member
0 Likes
407

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.

3 REPLIES 3
Read only

Former Member
0 Likes
382

Please someone help with completing this one.

Read only

Former Member
0 Likes
382

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!

Read only

0 Likes
382

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.