2023 Dec 22 9:20 PM
Hello,
I have found a solution (code below) to display directly the select-options complex dialog, via the function module RS_COMPLEX_SELECTION, but is there a more simple way, without using batch input? (if it works well, it would be a very simple solution indeed)
Thank you!
Sandra
Program demonstration: press the button and it displays a popup containing the select-options complex dialog.
REPORT.
TABLES sscrfields.
DATA trkorr2 TYPE trkorr.
SELECT-OPTIONS s_trkorr FOR trkorr2 MODIF ID trk.
SELECTION-SCREEN PUSHBUTTON /1(50) trkorr USER-COMMAND trkorr.
AT SELECTION-SCREEN OUTPUT.
trkorr = 'Display complex selection dialog for TRKORR'.
LOOP AT SCREEN.
IF screen-group1 = 'TRK'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN.
DATA p_sscr TYPE rsscr.
DATA p_report TYPE progname.
DATA p_screen_low TYPE screen.
DATA p_screen_high TYPE screen.
DATA p_sscr_index TYPE syst_tabix.
DATA p_just_display TYPE abap_bool.
DATA p_no_int_chk TYPE abap_bool.
DATA p_free_selections TYPE abap_bool.
DATA l_fld TYPE syfrs_fld_type.
DATA p_convert TYPE rsconvert.
DATA options TYPE sydb0_xoptions.
DATA signs_restriction TYPE abap_bool.
DATA title TYPE syst_title.
CASE sscrfields-ucomm.
WHEN 'TRKORR'.
p_sscr = VALUE #( name = 'S_TRKORR'
numb = '1000000'
kind = 'S'
olength = '20'
type = 'C'
dtyp = 'CHAR'
dbfield = 'TRKORR'
length = '40'
group1 = 'TRK' ).
p_report = sy-repid.
LOOP AT SCREEN.
CASE screen-name.
WHEN 'S_TRKORR-LOW'.
p_screen_low = VALUE #( BASE screen
active = '1'
input = '1'
output = '1'
invisible = '0' ).
WHEN 'S_TRKORR-HIGH'.
p_screen_high = VALUE #( BASE screen
active = '1'
input = '1'
output = '1'
invisible = '0' ).
ENDCASE.
ENDLOOP.
p_sscr_index = 1.
p_just_display = abap_false.
p_no_int_chk = abap_false.
p_free_selections = abap_false.
CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( s_trkorr-low ) )->get_ddic_field(
RECEIVING p_flddescr = DATA(dfies)
EXCEPTIONS not_found = 1
no_ddic_type = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
" TO DO: add code to handle the exceptions
ENDIF.
PERFORM dfies_2_fld IN PROGRAM saplsselservice USING dfies l_fld IF FOUND.
p_convert = l_fld-convert.
options = VALUE #( ).
signs_restriction = VALUE #( ).
title = VALUE #( ).
CALL FUNCTION 'RS_COMPLEX_SELECTION'
EXPORTING p_sscr = p_sscr
p_report = p_report
p_screen_low = p_screen_low
p_screen_high = p_screen_high
p_sscr_index = p_sscr_index
p_just_display = p_just_display
p_no_int_chk = p_no_int_chk
p_free_selections = p_free_selections
p_convert = p_convert
options = options
signs_restriction = signs_restriction
title = title
EXCEPTIONS cancelled = 1
OTHERS = 2.
IF sy-subrc <> 0.
" TO DO: add code to handle the exceptions
ENDIF.
ENDCASE.
2023 Dec 26 12:58 PM
Hello,
I tried your code. I remarked that there is a standard OKCODE behind every push button of value :%+++
You can replace your specific OKCODE "TRKORR" with "%000"
data t000 type t000.
SELECT-OPTIONS s_trkorr FOR trkorr2 MODIF ID trk. "%000
SELECT-OPTIONS s_mandt for t000-mandt . "%001
SELECT-OPTIONS s_trkor2 FOR trkorr2 MODIF ID trk. "%002
SELECTION-SCREEN PUSHBUTTON /1(50) trkorr USER-COMMAND %000. "TRKORR. "<== okcode replacement
If you then push the specific button TRKORR then you will go through a standard call of function RS_COMPLEX_SELECTION
2023 Dec 26 1:30 PM
chaouki.akir Nice. In fact, I missed the important information in my question: I'd like to have the same function as if the SELECT-OPTIONS fields were shown. Currently I hide them (screen-active = '0'). With the below code, I can't type anything in the complex dialog and I don't see the two interval tabs.
DATA trkorr2 TYPE trkorr.
SELECT-OPTIONS s_trkorr FOR trkorr2 MODIF ID trk.
SELECTION-SCREEN PUSHBUTTON /1(50) trkorr USER-COMMAND %000.
AT SELECTION-SCREEN OUTPUT.
trkorr = 'Display complex selection dialog for TRKORR'.
LOOP AT SCREEN.
IF screen-group1 = 'TRK'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.