Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Loop Screen using dropdown list

Former Member
0 Likes
917

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.

2 REPLIES 2
Read only

VenkatRamesh_V
Active Contributor
0 Likes
663

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 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.

Read only

Ankit_Maskara
Product and Topic Expert
Product and Topic Expert
0 Likes
663

Hello Afif,

What's your requirement? Can you please elaborate.

Also avoid using obsolete syntax like Occurs, Like etc.

BR.