Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple text lines below report selection-screen parameters based on table entries

Tags:

abap

Before executing my report I want to display the folders below the selection screen.
The folder names are stored inside a table.
Since I don't know how many entries the table has beforehand, this needs to be dynamic - not hardcoded.

This is what I've done so far:

DATA: lt_directories TYPE string_table.
DATA: lv_folders_txt TYPE string.

"Report description with test-checkbox
SELECTION-SCREEN BEGIN OF BLOCK b11 WITH FRAME TITLE title.
PARAMETERS: pa_test TYPE c AS CHECKBOX DEFAULT abap_true.
SELECTION-SCREEN COMMENT /1(20) folders.
SELECTION-SCREEN END OF BLOCK b11.

INITIALIZATION.
  lt_directories = VALUE string_table( ( `FOLDER1` ) ( `FOLDER2` ) ( `FOLDER3` ) ( `FOLDER4` ) ).
  title = 'This program imports data from the listed folders'.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT lt_directories ASSIGNING FIELD-SYMBOL(<directory>).
    "TODO: this has to be changed!
    lv_folders_txt = lv_folders_txt && <directory>.
  ENDLOOP.
  folders = lv_folders_txt.

This is how the result looks like: IST-Zustand

And this is an example of how I want it to look like:
SOLL_Zustand

Does someone know an easy way to do this?

like image 339
Cold_Class Avatar asked Feb 20 '26 03:02

Cold_Class


1 Answers

You may create a docking container at the bottom of the screen, and include any "text view" control in it, like the SAP HTML viewer for instance:

Selection screen with docking container at bottom

DATA: lt_directories TYPE string_table.
DATA: lv_folders_txt TYPE string.
DATA: go_docking TYPE REF TO cl_gui_docking_container.
DATA: go_html_viewer TYPE REF TO cl_gui_html_viewer.

"Report description with test-checkbox
SELECTION-SCREEN BEGIN OF BLOCK b11 WITH FRAME TITLE title.
PARAMETERS: pa_test TYPE c AS CHECKBOX DEFAULT abap_true.
SELECTION-SCREEN END OF BLOCK b11.

INITIALIZATION.
  lt_directories = VALUE string_table( ( `FOLDER1` ) ( `FOLDER2` ) ( `FOLDER3` ) ( `FOLDER4` ) ).
  title = 'This program imports data from the listed folders'.

AT SELECTION-SCREEN OUTPUT.
  IF go_docking IS NOT BOUND.
    go_docking = NEW #(
        repid     = sy-repid
        dynnr     = sy-dynnr
        side      = cl_gui_docking_container=>dock_at_bottom
        extension = 180 ). " pixels
    DATA: lv_url   TYPE cndp_url.
    DATA(lv_text) = |<html><body>{ 
            REDUCE #( INIT s = `` FOR dir IN lt_directories NEXT s = |{ s }{ dir }<br>| ) 
            }</body></html>|.
    go_html_viewer = NEW cl_gui_html_viewer( parent = go_docking ).
    data(soli_tab) = cl_bcs_convert=>string_to_soli( lv_text ).
    go_html_viewer->load_data(
        EXPORTING type = 'text' subtype = 'html' size = strlen( lv_text )
        IMPORTING assigned_url = lv_url
        CHANGING  data_table = soli_tab ).
    go_html_viewer->show_url( url = lv_url ).
  ENDIF.
like image 95
Sandra Rossi Avatar answered Feb 26 '26 00:02

Sandra Rossi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!