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: 

Display an error message with pop up using an internal table

Former Member
0 Kudos

Hello Gurus!!

I want to know which function module should I use to display an error message using an internal table.

In internal table I have collected (the error no. and error desc) from table created by me in se11 and want to display error in module pool prgm.

But now I want to know which FUNCTION MODULE should I use for displaying an error using internal table contents(error no. and error desc).

Kindly suggest your answers.

Thanks in advance,

Sachin

1 ACCEPTED SOLUTION

Vijay
Active Contributor
0 Kudos

hi...

try this

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

ENDPOS_COL = 30

ENDPOS_ROW = 10

STARTPOS_COL = 1

STARTPOS_ROW = 1

TITLETEXT = text-001

  • IMPORTING

  • CHOISE =

TABLES

VALUETAB = itab

  • EXCEPTIONS

  • BREAK_OFF = 1

n this fm

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'your message'

  • I_SELECTION = 'X'

  • I_ALLOW_NO_SELECTION =

  • I_ZEBRA = ' '

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_CHECKBOX_FIELDNAME =

  • I_LINEMARK_FIELDNAME =

  • I_SCROLL_TO_SEL_LINE = 'X'

I_TABNAME = 'itab'

  • I_STRUCTURE_NAME =

IT_FIELDCAT = i_field

  • IT_EXCLUDING =

  • I_CALLBACK_PROGRAM =

  • I_CALLBACK_USER_COMMAND =

  • IS_PRIVATE =

  • IMPORTING

  • ES_SELFIELD =

  • E_EXIT =

TABLES

T_OUTTAB = itab

  • EXCEPTIONS

  • PROGRAM_ERROR = 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.

POPUP_TO_DISPLAY_TEXT

POPUP_TO_CONFIRM

hope this helps

Thanks& regards

vijay

<b>* reward pts to useful answers.</b>

6 REPLIES 6

Former Member
0 Kudos

Hi Sachin,

As I understand your question right , you can check reports starting with SBAL*

there are a lot of useful Function there

Hope this helps.

Former Member
0 Kudos

Hi,

You can use one of the below function module .....

POPUP_TO_CONFIRM_LOSS_OF_DATA Create a dialog box in which you make a question whether the user wishes to perform a processing step with loss of data.

POPUP_TO_CONFIRM_STEP Create a dialog box in which you make a question whether the user wishes to perform the step.

POPUP_TO_CONFIRM_WITH_MESSAGE Create a dialog box in which you inform the user about a specific decision point during an action.

POPUP_TO_CONFIRM_WITH_VALUE Create a dialog box in which you make a question whether the user wishes to perform a processing step with a particular object.

POPUP_TO_DECIDE Provide user with several choices as radio buttons

POPUP_TO_DECIDE_WITH_MESSAGE Create a dialog box in which you inform the user about a specific decision point via a diagnosis text.

Regards

Sudheer

Vijay
Active Contributor
0 Kudos

hi...

try this

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

ENDPOS_COL = 30

ENDPOS_ROW = 10

STARTPOS_COL = 1

STARTPOS_ROW = 1

TITLETEXT = text-001

  • IMPORTING

  • CHOISE =

TABLES

VALUETAB = itab

  • EXCEPTIONS

  • BREAK_OFF = 1

n this fm

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'your message'

  • I_SELECTION = 'X'

  • I_ALLOW_NO_SELECTION =

  • I_ZEBRA = ' '

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_CHECKBOX_FIELDNAME =

  • I_LINEMARK_FIELDNAME =

  • I_SCROLL_TO_SEL_LINE = 'X'

I_TABNAME = 'itab'

  • I_STRUCTURE_NAME =

IT_FIELDCAT = i_field

  • IT_EXCLUDING =

  • I_CALLBACK_PROGRAM =

  • I_CALLBACK_USER_COMMAND =

  • IS_PRIVATE =

  • IMPORTING

  • ES_SELFIELD =

  • E_EXIT =

TABLES

T_OUTTAB = itab

  • EXCEPTIONS

  • PROGRAM_ERROR = 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.

POPUP_TO_DISPLAY_TEXT

POPUP_TO_CONFIRM

hope this helps

Thanks& regards

vijay

<b>* reward pts to useful answers.</b>

Former Member
0 Kudos

I have implemented the function module 'POPUP_WITH_TABLE_DISPLAY'. But now the problem is to use 'REUSE_ALV_POPUP_TO_SELECT'.

I want to implement this function module in global class method shown below

method ZDISPLAY_ERROR.

data : wa_errlist type ZERR_FB03.

*loop at IT_ERR1 INTO wa_errlist.

*WRITE 😕 wa_errlist-ERR_DESC.

*endloop.

*

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

ENDPOS_COL = 40

ENDPOS_ROW = 10

STARTPOS_COL = 1

STARTPOS_ROW = 1

TITLETEXT = 'Errors displayed'

  • IMPORTING

  • CHOISE =

TABLES

VALUETAB = it_err1.

  • EXCEPTIONS

  • BREAK_OFF = 1

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'Errors ..............'

  • I_SELECTION = 'X'

  • I_ALLOW_NO_SELECTION =

  • I_ZEBRA = ' '

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_CHECKBOX_FIELDNAME =

  • I_LINEMARK_FIELDNAME =

  • I_SCROLL_TO_SEL_LINE = 'X'

I_TABNAME = 'it_err1'

  • I_STRUCTURE_NAME =

*IT_FIELDCAT = it_err1

  • IT_EXCLUDING =

  • I_CALLBACK_PROGRAM =

  • I_CALLBACK_USER_COMMAND =

  • IS_PRIVATE =

  • IMPORTING

  • ES_SELFIELD =

  • E_EXIT =

TABLES

T_OUTTAB = it_err1

  • EXCEPTIONS

  • PROGRAM_ERROR = 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.

endmethod.

The problem is the function module is not getting the field catalog for alv. I have used alv method in the main program.

So how should I access this method to display the errors.

Kindly suggest ur answers.

Thanks

Sachin

0 Kudos

Hi,

Check this sample code, capture all the errors into internal table , then pass internal table data to FM : 'REUSE_ALV_POPUP_TO_SELECT' :

REPORT z_log_display .


TYPE-POOLS: slis.

DATA: gs_private TYPE slis_data_caller_exit,
      gs_selfield TYPE slis_selfield,
      gt_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
      g_exit(1) TYPE c.


DATA : BEGIN OF i_error OCCURS 0,
         errno(3) TYPE n,
         errdesc(25) TYPE c,
       END OF i_error.

START-OF-SELECTION.


  CLEAR : i_error.
  REFRESH : i_error.

  i_error-errno = '001'.
  i_error-errdesc ='First Error'.
  APPEND i_error.

  i_error-errno = '002'.
  i_error-errdesc ='Second Error'.
  APPEND i_error.

  i_error-errno = '003'.
  i_error-errdesc ='Third Error'.
  APPEND i_error.


  PERFORM frm_fieldcat_init  USING gt_fieldcat[].


  CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
       EXPORTING
            i_title       = 'Error Log'
            i_tabname     = 'I_ERROR'
            it_fieldcat   = gt_fieldcat[]
            is_private    = gs_private
       IMPORTING
            es_selfield   = gs_selfield
            e_exit        = g_exit
       TABLES
            t_outtab      = i_error
       EXCEPTIONS
            program_error = 1
            OTHERS        = 2.
  IF sy-subrc <> 0.
    MESSAGE i000(0k) WITH sy-subrc.
  ENDIF.


*---------------------------------------------------------------------*
*       FORM frm_fieldcat_init                                        *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  LT_FIELDCAT                                                   *
*---------------------------------------------------------------------*
FORM frm_fieldcat_init USING lt_fieldcat TYPE slis_t_fieldcat_alv.
  DATA: ls_fieldcat TYPE slis_fieldcat_alv.

  CLEAR lt_fieldcat.
  REFRESH lt_fieldcat.


  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname = 'ERRNO'.
  ls_fieldcat-outputlen = '000003'.
  ls_fieldcat-seltext_l   = 'Error Number'.
  ls_fieldcat-seltext_m   = 'Error Number'.
  ls_fieldcat-seltext_s   = 'Error Number'.
  ls_fieldcat-fix_column = 'X'.
  ls_fieldcat-just      =  'X'.
  ls_fieldcat-tabname   = 'I_ERROR'.
  ls_fieldcat-col_pos = '1'.
  ls_fieldcat-row_pos = '1'.
  APPEND ls_fieldcat TO lt_fieldcat.


  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname = 'ERRDESC'.
  ls_fieldcat-outputlen = '000025'.
  ls_fieldcat-seltext_l   = 'Error Desc.'.
  ls_fieldcat-seltext_m   = 'Error Desc.'.
  ls_fieldcat-seltext_s   = 'Error Desc.'.
  ls_fieldcat-tabname   = 'I_ERROR'.
  ls_fieldcat-col_pos = '2'.
  ls_fieldcat-row_pos = '1'.
  APPEND ls_fieldcat TO lt_fieldcat.

ENDFORM.

Regards

L Appana

Former Member
0 Kudos

I thank Mr. Vijay sharma for their exclusive support for providing the solution.

Finally, I am able to display multiple error messages using this FM ( POPUP_WITH_TABLE_DISPLAY ).

Thanks a lot Gurus for all your support