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: 

Function module to display error

Former Member
0 Kudos

Hi,

I want to display a error message popup. and that pop up message should hold a

series of messages not a single message. i.e i should have a internal table where i can fill

all my msgid, msgno record by record. so that it will be displayed.

Thanks,

Vivek

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

do the follwing to display list of messages in pop-up..



"Initialize one time...
* Initialize the messages
  CALL FUNCTION 'MESSAGES_INITIALIZE'
    EXCEPTIONS
      log_not_active       = 1
      wrong_identification = 2
      OTHERS               = 3.

"append all error warning messages to below function module
      PERFORM store_messages USING 'E'
                                   w_pn
                                   w_batch2
                                   w_werks
                                   ' '
                                   w_msgno.

FORM store_messages USING p_msgty
                          p_msgv1
                          p_msgv2
                          p_msgv3
                          p_msgv4
                          p_txtnr.
  IF p_msgty EQ 'E'.
    w_err_fg = 'X'.
  ENDIF.
* Store the messages to be displayed
  CALL FUNCTION 'MESSAGE_STORE'
    EXPORTING
      arbgb                  = 'ZCCH001'
      msgty                  = p_msgty
      msgv1                  = p_msgv1
      msgv2                  = p_msgv2
      msgv3                  = p_msgv3
      msgv4                  = p_msgv4
      txtnr                  = p_txtnr
    EXCEPTIONS
      message_type_not_valid = 1
      not_active             = 2
      OTHERS                 = 3.

ENDFORM.                    " STORE_MESSAGES

"at lsat call the below function module to show the messages ata time..
* Display all the messages together on a pop up
  CALL FUNCTION 'MESSAGES_SHOW'
    EXPORTING
      show_linno         = ' '
    IMPORTING
      e_exit_command     = wa_exit_command
    EXCEPTIONS
      inconsistent_range = 1
      no_messages        = 2
      OTHERS             = 3.

Regards,

Prabhudas

3 REPLIES 3

Former Member
0 Kudos

Hi,

To best suit your requirement, create a custom pop up screen in your program and write the error messages onto it as you need. This will also give you lot of formatting options.

Thanks and regards,

Nilesh.

Former Member
0 Kudos

Hi,

do the follwing to display list of messages in pop-up..



"Initialize one time...
* Initialize the messages
  CALL FUNCTION 'MESSAGES_INITIALIZE'
    EXCEPTIONS
      log_not_active       = 1
      wrong_identification = 2
      OTHERS               = 3.

"append all error warning messages to below function module
      PERFORM store_messages USING 'E'
                                   w_pn
                                   w_batch2
                                   w_werks
                                   ' '
                                   w_msgno.

FORM store_messages USING p_msgty
                          p_msgv1
                          p_msgv2
                          p_msgv3
                          p_msgv4
                          p_txtnr.
  IF p_msgty EQ 'E'.
    w_err_fg = 'X'.
  ENDIF.
* Store the messages to be displayed
  CALL FUNCTION 'MESSAGE_STORE'
    EXPORTING
      arbgb                  = 'ZCCH001'
      msgty                  = p_msgty
      msgv1                  = p_msgv1
      msgv2                  = p_msgv2
      msgv3                  = p_msgv3
      msgv4                  = p_msgv4
      txtnr                  = p_txtnr
    EXCEPTIONS
      message_type_not_valid = 1
      not_active             = 2
      OTHERS                 = 3.

ENDFORM.                    " STORE_MESSAGES

"at lsat call the below function module to show the messages ata time..
* Display all the messages together on a pop up
  CALL FUNCTION 'MESSAGES_SHOW'
    EXPORTING
      show_linno         = ' '
    IMPORTING
      e_exit_command     = wa_exit_command
    EXCEPTIONS
      inconsistent_range = 1
      no_messages        = 2
      OTHERS             = 3.

Regards,

Prabhudas

Former Member
0 Kudos

Hi,

Try this..

  
DATA: LT_MESSAGES TYPE TABLE OF BDCMSGCOLL,
      LS_MESSAGES TYPE BDCMSGCOLL.

        CALL FUNCTION 'FORMAT_MESSAGE'
        EXPORTING
          ID        = LS_MESSAGES-MSGID
          LANG      = '-D'
          NO        = LS_MESSAGES-MSGNR
          V1        = LS_MESSAGES-MSGV1
          V2        = LS_MESSAGES-MSGV2
          V3        = LS_MESSAGES-MSGV3
          V4        = LS_MESSAGES-MSGV4
        IMPORTING
          MSG       = LV_MESSAGE
        EXCEPTIONS
          NOT_FOUND = 1
          OTHERS    = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

Regards

Vishnu Gupta