Skip to Content

How to display table data in message long-text

You want to display table data in the long-text of a message so that the user can decide based on this information. It’s very easy but can be tricky 😉   if you do not know how to use this FM : RKE_POPUP_TEXT_DECIDE_VARTEXT. Here is a demo program for this purpose ℹ

DATA: lt_mara TYPE TABLE OF mara,

      ls_mara TYPE mara,

      ls_text LIKE tline,

      lt_text TYPE TABLE OF tline.

* fetch 10 rows for display

SELECT * FROM mara INTO TABLE lt_mara

         UP TO 10 ROWS  WHERE matnr NE space.

IF sysubrc EQ 0.

  ls_texttdformat = ‘AS’.

  LOOP AT lt_mara INTO ls_mara.

    ls_texttdline = ls_maramatnr.

    CONDENSE ls_texttdline.

    APPEND ls_text TO lt_text.

    ls_texttdformat = ‘/’.

  ENDLOOP.

  CALL FUNCTION ‘RKE_POPUP_TEXT_DECIDE_VARTEXT’

    EXPORTING

*   OPTIONS              = ” “You can add push-buttons also

      object_id            = ‘NA’

      object               = ‘ZTEST000’

     na_shorttext         = ‘X’

     titel                = ‘Example to show table’

* IMPORTING

*   ANSWER               = “User decision can be captured here

   TABLES

*   T_PARAMS             =

     t_texttab            = lt_text

   EXCEPTIONS

     docu_not_found       = 1

     OTHERS               = 2  .

  IF sysubrc <> 0.

    MESSAGE ID symsgid TYPE symsgty NUMBER symsgno

            WITH symsgv1 symsgv2 symsgv3 symsgv4.

  ENDIF.

ELSE.

  MESSAGE i001(00) WITH ‘Nothing to dispaly’. EXIT.

ENDIF.

The table can be passed as a variable in the message short text like : Select material number & and in the long text you have to insert a “Command” with type &TABLES& or simply &T&.
The output is a message with 10 rows from MARA as an additional info.
Table in message.PNG
/
Table in message.PNG
22 Comments
You must be Logged on to comment or reply to a post.