cancel
Showing results for 
Search instead for 
Did you mean: 

How to display error/warning message from within smartforms

Former Member
0 Kudos

Hi,

I have created a smartfrom with a selection screen. I am checking some data in my smartform code. If I do not find the data then instead of coming across the print screen with no values I need to show a message on the selection screen 'No XXX data found'. I do not wan to lose the selection screen input data after displaying the error/warning message. It should come the same way as we show in a report.

I tried the way its done in a report but I get a blank screen with the error message. Please let me know how to get this done from within the smartfrom.

Thanks

Rakesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

The issue is resolved. You can check Runtime Errors in http://help.sap.com/saphelp_470/helpdata/en/4b/83fb5bdf8f11d3969700a0c930660b/content.htm

OR

Follow as instructed below. It worked for me..

1) In the print program while calling the smartform add another Exception as my_error...

CALL FUNCTION gt_fmname

  EXPORTING

    gt_header  = gt_header

    gt_pernr   = gt_pernr

    p_qmnum    = p_qmnum

    p_date     = p_date

    p_aufnr    = gs_pernr-aufnr

    gt_ltext   = gt_ltext

    p_parnr    = gs_pernr-parnr

  EXCEPTIONS

    formatting_error = 1

    internal_error   = 2

    send_error       = 3

    user_canceled    = 4

   my_error         = 5   

    OTHERS              = 6.  

IF sy-subrc <> 0.

  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

2) Within the smartform in the Form Interface in the Exceptions tab, add a new exception as - MY_ERROR

3) Within the Program Lines of the smartform write

IF gv_tot_hrs = '0.0'.

   CALL FUNCTION 'SSF_MESSAGE'

   EXPORTING

     i_msgid       = '00'

     i_msgty       = 'S'

     i_msgno       = '208'

     i_msgv1       = 'No work done'

*   I_MSGV2       =

*   I_MSGV3       =

*   I_MSGV4       =

           .

    user_exception my_error.

Please note that I have taken Message Type as 'S', as I did not want to show any Pop-Up. It will only show the message.. You have your own choice.

Answers (1)

Answers (1)

nagarjun_kalletla
Participant
0 Kudos

Hi Rakesh,

          Read the value from the interface, Validate it in a Validation_window (use program lines and if the value is Initial then display msg .)

Or use Command . declare a variable Flag type c . raise it when fields validated or else your msg .. No data Available....

This might be helpful ......
Regards
Nagarjun