Application Development 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: 

Error Messaging in SM30 at bottom of screen

Former Member
0 Kudos

I have a simple ztable with a One Step Maintenance Screen.

I have some validation code in the TMG of the ZTABLE in EVENT 01 (before save).  Here is a snippet:

          SELECT SINGLE kunn2

           FROM knvp

           INTO l_kunn2

          WHERE parvw = 'AG'

            AND kunn2 = wa_pls-line+3(10).

         IF sy-subrc <> 0.

           CONCATENATE 'Customer ' wa_pls-line+2(10) ' entered is not a sold to!!'

                  INTO l_message SEPARATED BY space.

           MESSAGE l_message TYPE 'I' DISPLAY LIKE 'E'.

           LEAVE SCREEN.

         ENDIF.


The message is fine, and creates a popup style error, at the entry screen to SM30 (it leaves the screen of data entry in SM30).


Whether I have the command  LEAVE SCREEN in there or not (see above).  It basically operates the same.  The user is kicked out of data entry.


What I'd like to do is have my error message shown at the bottom and NOT have the user kicked out the SM30 New Entries screen.


How do I need to adjust my error messaging?  I've looked for awhile on this, and can't find anything suitable


1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try MESSAGE I_message TYPE 'E'.

7 REPLIES 7

Former Member
0 Kudos

Try MESSAGE I_message TYPE 'E'.

0 Kudos

This message was moderated.

0 Kudos

Changing to :

MESSAGE I_message TYPE 'E'.


and using LEAVE SCREEN or not using LEAVE SCREEN results in the same;


the program exits the data entry screen and returns to the main SM30 screen (and shows the error message there).


I'd like to show the message at the bottom of the data entry screen, and remain in the data entry screen (and not update).  I'd like it to act similarly to the error for duplicate entries, or the error for leaving a required field blank.


Thanks

0 Kudos

Hi Jeremy,

Please do validation like below, its one way of validating the entries while maintaining in SM30.

1. Double click on overview screen No , it will take you to the Flow logic of the screen

2. Create module Module validate_input on chain-request. go inside

3. Write the query like below

if wa_pls-line is not initial.

          SELECT SINGLE kunn2

           FROM knvp

           INTO l_kunn2

          WHERE parvw = 'AG'

            AND kunn2 = wa_pls-line+3(10).

         IF sy-subrc <> 0.

          Message "Please write your msg" type 'E'.

         ENDIF.

Endif.

Dont use leave screen syntax.

EVENTS : You are trying to validate when you press the save button that is also correct,ofcourse its proper way of doing the validation,

If you write a query like above method it will check whenever any action performed on the screen while maintaining the entries.

So dont worry about SAVE Event particularly.

I have tried its working fine for me.

Regards,

Sri.

0 Kudos

Hi Jeremy,

What you are trying to achieve may not be possible via EVENT 01 as the control is already passed to the main screen of SM30 when that event code is called.. You have to use event 05 ( Creating new entry ) or you have to modify the generated Module pool program and apply your code directly there. The disadvantage of modifying the code directly will be when you re-generate the TMG again the code will be gone and you have re-write them.

Regds

Former Member
0 Kudos

Thank you for your responses. I tried both methods:

I was able to get the 05 Event to work for my situation, as I observed that the routine is performed for each line that might be entered into the data entry (even if the user enters more than one at a time via cut-and-paste, etc).

It is performed at ENTER or at SAVE.

When I tried the module pool entry method, I am sure I am doing something wrong, but here is what I observed:

Entering code in the SAPLZPAY main module pool:  My new module line is below.  However, in debug, it skips this entire line, and doesn't execute it.

Therefore the logic I have inside doesn't get executed.  I tried moving my new line of code around the module pool, but nothing seemed to make it executable.

PROCESS AFTER INPUT.

   MODULE liste_exit_command AT EXIT-COMMAND.

   MODULE liste_before_loop.

   MODULE  validate_input ON CHAIN-REQUEST.

   LOOP AT extract.

     MODULE liste_init_workarea.

     CHAIN.

       FIELD zpayment-kunnr .

       FIELD zpayment-vtweg .

       FIELD zpayment-zlsch .

       FIELD zpayment-zterm .

       MODULE set_update_flag ON CHAIN-REQUEST.

     ENDCHAIN.

I'm curious about this solution, but the 05 Event is straight-forward, and satisfies my requirement.

Thank you all very much!

Jeremy H.

0 Kudos

Gook luck..

Regards,

Sri