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

Selection Screen Create Field OnClick

Former Member
0 Likes
2,287

Hello experts,

I'd like to know how to add a button on selection screen that adds a field into the selection screen on click

Regards

1 ACCEPTED SOLUTION
Read only

Private_Member_7726
Active Contributor
0 Likes
1,465

Hi,

You can't "add" new fields to dynpro dynamically, but you can hide/display fields during ON SELECTION-SCREEN OUTPUT event. Radio-buttons and check-boxes can toggle user command (screen refresh). Google or search on SCN for hide / display fields in selection screen - there should be plenty of examples around.

cheers

Jānis

Hi,

You can't "add" new fields to dynpro dynamically, but you can hide/display fields during ON SELECTION-SCREEN OUTPUT event. Radio-buttons and check-boxes can toggle user command (screen refresh). Google or search on SCN for hide / display fields in selection screen - there should be plenty of examples around.

cheers

Jānis

2 REPLIES 2
Read only

Private_Member_7726
Active Contributor
0 Likes
1,466

Hi,

You can't "add" new fields to dynpro dynamically, but you can hide/display fields during ON SELECTION-SCREEN OUTPUT event. Radio-buttons and check-boxes can toggle user command (screen refresh). Google or search on SCN for hide / display fields in selection screen - there should be plenty of examples around.

cheers

Jānis

Read only

sivaganesh_krishnan
Contributor
0 Likes
1,465

Hi,

have a look at the below program.You can use the AT SELECTION-SCREEN OUTPUT. event to change field dynamically.

TABLES: t030, skat, sscrfields.

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME

                                      TITLE text-001.

* Declaration of sel screen buttons

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON (20) w_button USER-COMMAND BUT1.

SELECTION-SCREEN PUSHBUTTON (25) w_but2 USER-COMMAND BUT2.

SELECTION-SCREEN END OF LINE.

SELECT-OPTIONS: p_konts FOR t030-konts,

                 p_bklas FOR t030-bklas.

PARAMETER: gd_ucomm like sy-ucomm default 'BUT1' no-display.

SELECTION-SCREEN END OF BLOCK block1.

TYPES: BEGIN OF t_t030,

    ktopl TYPE t030-ktopl,

    konts TYPE t030-konts,

    txt20 TYPE skat-txt20,

    bklas TYPE t030-bklas,

    bkbez TYPE t025t-bkbez,

   END OF t_t030.

DATA: it_t030 TYPE STANDARD TABLE OF t_t030 INITIAL SIZE 0,

       wa_t030 TYPE t_t030.

DATA: gd_repsize TYPE i VALUE '83'.

************************************************************************

*INITIALIZATION.

INITIALIZATION.

* Add displayed text string to buttons

w_button = 'GL account selection'.

w_but2 = 'Valuation class selection'.

************************************************************************

*AT SELECTION-SCREEN.

AT SELECTION-SCREEN.

* Check if buttons have been

   if sscrfields-ucomm eq 'BUT1'.

     gd_ucomm = 'BUT1'.

     clear: p_BKLAS.

     refresh: p_BKLAS.

   elseif sscrfields-ucomm eq 'BUT2'.

     clear: p_KONTS.

     refresh: p_KONTS.

     gd_ucomm = 'BUT2'.

   endif.

************************************************************************

*AT SELECTION-SCREEN OUTPUT.

AT SELECTION-SCREEN OUTPUT.

   if gd_ucomm eq 'BUT1'.

     loop at screen.

       if screen-name CS 'P_KONTS'.

         screen-active = 1.

       elseif screen-name CS 'P_BKLAS'.

         screen-active = 0.

       endif.

       modify screen.

     endloop.

   elseif gd_ucomm eq 'BUT2'.

     loop at screen.

      if screen-name CS 'P_KONTS'.

         screen-active = 0.

       elseif screen-name CS 'P_BKLAS'.

         screen-active = 1.

       endif.

       modify screen.

     endloop.

   endif.