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

Adding fields on selection screen dynamically

Former Member
2,185

Hi all,

Can we add some fields to selection screen dynamically on pushbutton click?

Regards,

Dnyanesh

9 REPLIES 9
Read only

Former Member
0 Likes
1,397

Hi Dnyanesh,

What you can do is to define fields which are initially in invisible mode and dynamically change them to visible on the button click.

at selection-screen output.

if sy-ucomm = <Button Fcode>

loop at screen.

if screen-group1 = <screen group name for all the field>

screen-invisible = 0.

screen-active = 1.

modify screen.

endif.

endloop.

endif.

Regards,

ravi

Read only

0 Likes
1,397

Ravi....this wont serve my purpose.....

Message was edited by: Dnyanesh Tamboli

Read only

Former Member
0 Likes
1,397

I don't think it's possible. Instead you can define your own screen and call them using CALL SUB SCREEN or CALL SCREEN.

rgds,

TM.

Read only

Former Member
0 Likes
1,397

Hi dnyanesh,

1. If the requirement is fixed for the number of fields,

then we can

pre-define the fields.

2. But they will appear only at the click of button.

regards,

amit m.

Read only

0 Likes
1,397

yes the number of fields are fixed .....

there are 4 fields .....

say a b c d.....

initially these 4 fields are displayed .along with a pushbutton

when user clicks the push button the selection screen would look like

a b c d pushbutton

a b c d

again if the user clicks the pushbutton

the screen should look like

a b c d pushbutton

a b c d

a b c d

Read only

vinod_gunaware2
Active Contributor
0 Likes
1,397

just have look below code

REPORT zrsdvsr1

LINE-SIZE 220

LINE-COUNT 65(5).

TYPE-POOLS : slis.

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

      • TABLES

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

TABLES: vbak.

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

      • DATA DECLARATIONS

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

  • Ranges

RANGES: r_posnr FOR vbap-posnr.

DATA: BEGIN OF t_veramt OCCURS 0,

vbeln TYPE vbap-vbeln,

posnr TYPE vbap-posnr,

matnr TYPE vbap-matnr,

netwr TYPE vbap-netwr,

mwsbp TYPE vbap-mwsbp,

END OF t_veramt.

DATA: BEGIN OF t_disamt OCCURS 0,

vbeln TYPE vbap-vbeln,

posnr TYPE vbap-posnr,

matnr TYPE vbap-matnr,

netwr TYPE vbap-netwr,

mwsbp TYPE vbap-mwsbp,

netwr_v TYPE vbap-netwr,

mwsbp_v TYPE vbap-mwsbp,

disc_val TYPE vbap-mwsbp,

END OF t_disamt.

&----


*& ALV FIELDS

&----


DATA : alv_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,

alv_layout TYPE slis_layout_alv.

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

      • SELECTION SCREEN

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

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_ver RADIOBUTTON GROUP g1 USER-COMMAND rad DEFAULT 'X',

p_sab RADIOBUTTON GROUP g1 .

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

SELECT-OPTIONS: s_vbeln FOR vbak-vbeln NO INTERVALS MODIF ID gr1.

PARAMETERS: p_dwfile TYPE rlgrap-filename

DEFAULT 'C:\test1.txt' MODIF ID gr2, "#EC NOTEXT

p_upfile TYPE rlgrap-filename

DEFAULT 'C:\test.txt' MODIF ID gr3. "#EC NOTEXT

SELECTION-SCREEN END OF BLOCK b2.

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

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_upfile.

**************F4 Help For Input File Name****************************

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

field_name = 'C:\'

IMPORTING

file_name = p_upfile.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dwfile.

**************F4 Help For Input File Name****************************

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

field_name = 'C:\'

IMPORTING

file_name = p_dwfile.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF p_sab = 'X'.

IF screen-group1 = 'GR1' OR screen-group1 = 'GR2'.

screen-active = '0'.

screen-invisible = '1'.

ELSE.

screen-active = '1'.

screen-invisible = '0'.

ENDIF.

MODIFY SCREEN.

ELSE.

IF screen-group1 = 'GR3'.

screen-active = '0'.

screen-invisible = '1'.

ELSE.

screen-active = '1'.

screen-invisible = '0'.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

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

      • START-OF-SELECTION

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

START-OF-SELECTION.

  • Check Radio Button

IF p_ver = 'X'.

PERFORM get_details_open_so_vertex.

ELSE.

PERFORM get_details_open_so.

ENDIF.

  • Display the output.

PERFORM diplay_report .

regards

vinod

Read only

Former Member
0 Likes
1,397

Hi,

follow below logic

1) define all the fields and disable fields

which are not required using no-display option

in select-option.

2) On click of button

loop at screen

if screen-name = 'Test'.

screen-active = 1.

endif.

endloop.

Regards

Amole

Read only

Former Member
0 Likes
1,397

Hi again,

1. U can use expand/collapse concept

where the fields will APPEAR

on the click of the button/icon present

on the selection-screen.

2. just copy paste to get a taste of it.

(run and press the button/icon in the middle of selection screen)

--- fields will appear

3.

REPORT abc.

INCLUDE icons.

*----


DATA : iv TYPE i,

in TYPE i.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

PARAMETER : a(10) TYPE c MODIF ID m2.

PARAMETER : b(10) TYPE c MODIF ID m2.

PARAMETER : c(10) TYPE c MODIF ID m2.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.

SELECTION-SCREEN PUSHBUTTON /1(4) p1 USER-COMMAND btn1.

SELECTION-SCREEN:

BEGIN OF LINE,

COMMENT 1(3) text-001 MODIF ID m1,

POSITION 8.

PARAMETERS:date10 LIKE rpctaxin-taxdt MODIF ID m1,

bank10(60) TYPE c MODIF ID m1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN:

BEGIN OF LINE,

COMMENT 1(3) text-001 MODIF ID m1,

POSITION 8.

PARAMETERS:date11 LIKE rpctaxin-taxdt MODIF ID m1,

bank11(60) TYPE c MODIF ID m1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK b2.

*----


INITIALIZATION.

iv = 1.

in = 0.

AT SELECTION-SCREEN OUTPUT.

IF iv = 0.

WRITE icon_collapse AS ICON TO p1(4).

ENDIF.

IF iv = 1.

WRITE icon_expand AS ICON TO p1(4).

ENDIF.

LOOP AT SCREEN.

WRITE : screen-name , screen-group1.

IF screen-group1 = 'M1'.

screen-invisible = iv.

screen-input = in.

*SCREEN-INPUT = V.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

*----


AT SELECTION-SCREEN.

IF iv = 1.

iv = 0.

in = 1.

ELSE.

iv = 1.

in = 0.

ENDIF.

regards,

amit m.

Read only

Former Member
0 Likes
1,397