2015 Nov 14 2:23 AM
Hi guys.
Is it possible to loop screen using dropdown list?
I have code like this, but it not work
REPORT ZTEST_10 NO STANDARD PAGE HEADING.
TABLES:zpmatnr.
DATA:a_zpmatnr TYPE zpmatnr OCCURS 0 WITH HEADER LINE.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST.
PARAMETERS: an(20) AS LISTBOX VISIBLE LENGTH 20.
selection-screen begin of line.
selection-screen comment (33) for field wek modif id prt.
parameters: wek type zpmatnr-ihrez modif id prt ."OBLIGATORY.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment (30) for field pro modif id prt.
select-options: pro for zpmatnr-aufnr modif id prt.
selection-screen end of line.
at SELECTION-SCREEN OUTPUT.
name = 'an'.
value-key = 'Save Function'.
value-text = 'Save Function'.
append VALUE to list .
value-key = 'Delete Function'.
value-text = 'Delete Function'.
append VALUE to list .
call FUNCTION 'VRM_SET_VALUES'
exporting
id = name
values = list
EXCEPTIONS
id_illegal_name = 1
others = 2.
loop at screen.
if screen-group1 = 'PRT'.
if an eq 'SAVE FUNCTION'.
screen-active = 1.
else.
screen-active = 0.
endif.
modify screen.
endif.
endloop.
START-OF-SELECTION.
2015 Nov 14 8:17 AM
Hi Afif,
Execute the code.
TYPE-POOLS:VRM.
TABLES:mara,afpo.
TYPES lbox TYPE c LENGTH 10.
DATA:a_zpmatnr TYPE mara OCCURS 0 WITH HEADER LINE.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST,
DYNFIELDS TYPE TABLE OF DYNPREAD WITH HEADER LINE.
PARAMETERS: an type lbox AS LISTBOX VISIBLE LENGTH 20 USER-COMMAND onli.
selection-screen begin of line.
selection-screen comment (33) for field wek modif id prt.
parameters: wek type c modif id prt ."OBLIGATORY mara-ihrez.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment (30) for field pro modif id prt.
select-options: pro for afpo-aufnr modif id prt.
selection-screen end of line.
INITIALIZATION.
name = 'an'.
value-key = 'Save Function'.
value-text = 'Save Function'.
append VALUE to list .
value-key = 'Delete Function'.
value-text = 'Delete Function'.
append VALUE to list .
at SELECTION-SCREEN OUTPUT.
loop at screen.
if screen-group1 = 'PRT'.
if an eq 'SAVE FUNCT'.
screen-active = 1.
else.
screen-active = 0.
endif.
modify screen.
endif.
endloop.
*endif.
call FUNCTION 'VRM_SET_VALUES'
exporting
id = name
values = list
EXCEPTIONS
id_illegal_name = 1
others = 2.
*loop at screen.
* if screen-group1 = 'PRT'.
* if an eq 'SAVE FUNCTION'.
* screen-active = 1.
* else.
* screen-active = 0.
* endif.
* modify screen.
*
* endif.
*endloop.
AT SELECTION-SCREEN ON AN.
REFRESH dynfields[].
DYNFIELDS-FIELDNAME = 'AN'.
DYNFIELDS-FIELDVALUE = AN.
append dynfields.
CLEAR DYNFIELDS.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
tables
dynpfields = dynfields
EXCEPTIONS
others = 8.
Hope it helpful,
Regards,
Venkat.
START-OF-SELECTION.
2015 Nov 15 7:54 AM
Hello Afif,
What's your requirement? Can you please elaborate.
Also avoid using obsolete syntax like Occurs, Like etc.
BR.