简体   繁体   中英

For the I/O fields in a normal ABAP screen, can i get them to behave like a SELECT-OPTIONS?

I'm trying to have the functionality of a normal SELECT-OPTIONS for a field inside one of my regular screens.

I went over all the attributes of that I/O field in the Designer, but i couldn't find anything.

I saw that some functionality of multiple choice is being offered to me, but it's not complete, meaning that inside the prompts i no longer have the ability to use F4 to select my ranges visually.

Is what i'm trying to accomplish even possible?

You could use

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECT-OPTIONS so_foo FOR baz-baz.
SELECTION-SCREEN END OF SCREEN 100.

and then include the generated screen in a subscreen area your program.

You can use a combination of function modules FREE_SELECTIONS_INIT and FREE_SELECTIONS_DIALOG . (You can trigger this off a button that you put on the dynpro). The function modules are a bit complicated, but they have online documentation.

To extend your dynpro to simulate the select-option from a report selection screen, you can show the low and high values from the first row of the selected data.

Here is an example to get you started (The documentation for function module FREE_SELECTIONS_DIALOG in fact contains some sample code):

report  ztest_free_seldiag.

data: lv_selid type RSDYNSEL-SELID.
data: lt_fld type table of RSDSFIELDS.
data: ls_fld type RSDSFIELDS.

ls_fld-tablename = 'T001'.
ls_fld-fieldname = 'BUKRS'.
append ls_fld to lt_fld.

call function 'FREE_SELECTIONS_INIT'
  EXPORTING
    KIND                           = 'F'
  IMPORTING
    SELECTION_ID                   = lv_selid
  TABLES
    FIELDS_TAB                     = lt_fld
 EXCEPTIONS
   FIELDS_INCOMPLETE              = 1
   FIELDS_NO_JOIN                 = 2
   FIELD_NOT_FOUND                = 3
   NO_TABLES                      = 4
   TABLE_NOT_FOUND                = 5
   EXPRESSION_NOT_SUPPORTED       = 6
   INCORRECT_EXPRESSION           = 7
   ILLEGAL_KIND                   = 8
   AREA_NOT_FOUND                 = 9
   INCONSISTENT_AREA              = 10
   KIND_F_NO_FIELDS_LEFT          = 11
   KIND_F_NO_FIELDS               = 12
   TOO_MANY_FIELDS                = 13
   DUP_FIELD                      = 14
   FIELD_NO_TYPE                  = 15
   FIELD_ILL_TYPE                 = 16
   DUP_EVENT_FIELD                = 17
   NODE_NOT_IN_LDB                = 18
   AREA_NO_FIELD                  = 19
   OTHERS                         = 20.
if sy-subrc <> 0.
* Implement suitable error handling here
  exit.
endif.

call function 'FREE_SELECTIONS_DIALOG'
  exporting
    selection_id                  = lv_selid
    TITLE                         = 'Select Company Code'
    AS_WINDOW                     = 'X'
    TREE_VISIBLE                  = ' '
* IMPORTING
*   WHERE_CLAUSES                 =
*   EXPRESSIONS                   =
*   FIELD_RANGES                  =
*   NUMBER_OF_ACTIVE_FIELDS       =
  tables
    fields_tab                    = lt_fld
 EXCEPTIONS
   INTERNAL_ERROR                = 1
   NO_ACTION                     = 2
   SELID_NOT_FOUND               = 3
   ILLEGAL_STATUS                = 4
   OTHERS                        = 5.
if sy-subrc <> 0.
  BREAK-POINT.
  exit.
endif.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM