Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

How to display table data in message long-text

$
0
0
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 sy-subrc EQ 0.

  ls_text-tdformat = 'AS'.

  LOOP AT lt_mara INTO ls_mara.

    ls_text-tdline = ls_mara-matnr.

    CONDENSE ls_text-tdline.

    APPEND ls_text TO lt_text.

    ls_text-tdformat = '/'.

  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 sy-subrc <> 0.

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

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

  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

Viewing all articles
Browse latest Browse all 943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>