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

Former Member
0 Likes
1,063

Hi all,

i have a list box on selection screen and when i select one of the record from the list , i have to hide one of the paramter field on the screen.

i used radio button when i ever i click the radio button the at selection-screen output. even has triggered

for radio button i done like this

parameters : p_test radiobutton group gp1 default 'X'

user-command chk,

when i tried this

parameters: test type name as listbox visible length 30 modif id g1

user-command chk . it throws me an error

Thanks

Preeti

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,029

HI,

Here you go the complete code

REPORT ZTESTPRG.

TYPE-POOLS: VRM.

DATA: NAME TYPE VRM_ID,

LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF LIST.

PARAMETERS: PS_PARM AS LISTBOX VISIBLE LENGTH 10 USER-COMMAND R .

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

PARAMETERS : PRE_LAYR(10) TYPE C MODIF ID ABC.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.

PARAMETERS : APPL_LAY(40) TYPE C MODIF ID DEF.

SELECTION-SCREEN END OF BLOCK B2.

initialization.

NAME = 'PS_PARM'.

VALUE-KEY = '1'.

VALUE-TEXT = 'LINE1'.

APPEND VALUE TO LIST. VALUE-KEY = '2'.

VALUE-TEXT = 'LINE2'.

APPEND VALUE TO LIST.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST.

AT SELECTION-SCREEN OUTPUT.

IF PS_PARM = '1'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'DEF' .

SCREEN-ACTIVE = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

IF PS_PARM = '2'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'ABC' .

SCREEN-ACTIVE = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

START-OF-SELECTION.

WRITE: / 'PARAMETER:', PS_PARM.

Thansk

Mahesh

10 REPLIES 10
Read only

Former Member
0 Likes
1,029

Can you post your code? It would be easy to help you.

Read only

former_member192429
Active Participant
0 Likes
1,029

For making a field invisible or inactive you have to write code in At Selection screen Output. But for checking which value is selected in dropdown box use At selection screen (PAI). You have to set some flag when record is selected and when that flag is set use LOOP at screen. Screen-invisible = 1. modify screen. endloop.

-Kriss

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,029

In new releases, the USER-COMMAND extension is supported for parameters that are listboxes. For example, in this program, it works perfectly. Depending on what the user selects from the first listbox, it will activate/deactivate the following to parameters.



REPORT  zrich_0002.


TYPE-POOLS: vrm.

DATA: ivrm_values TYPE vrm_values.
DATA: xvrm_values LIKE LINE OF ivrm_values.
DATA: name TYPE vrm_id.
Types: t_name(20) type c.

PARAMETERS: p_name type t_name AS LISTBOX visible length 20 USER-COMMAND chk.
PARAMETERS: p_1 TYPE c modif id p1.
PARAMETERS: p_2 TYPE c modif id p2.


AT SELECTION-SCREEN OUTPUT.

  name = 'P_NAME'.

  CLEAR xvrm_values. REFRESH ivrm_values.

  xvrm_values-key = 'Name1'.
  xvrm_values-text = 'Name1'..
  APPEND xvrm_values TO ivrm_values.

  xvrm_values-key = 'Name2'.
  xvrm_values-text = 'Name2'..
  APPEND xvrm_values TO ivrm_values.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = name
      values = ivrm_values.

  LOOP AT SCREEN.
    IF screen-group1 = 'P1'
      AND p_name = 'NAME2'.
      screen-active = '0'.
    ENDIF.
    IF screen-group1 = 'P2'
     AND p_name = 'NAME1'.
      screen-active = '0'.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

Regards,

RIch Heilman

Read only

0 Likes
1,029

Hi Rich,

Iam getting the error saying the listbox and user command doesn't go together

Iam 4.6 version

Thanks

Read only

Former Member
0 Likes
1,030

HI,

Here you go the complete code

REPORT ZTESTPRG.

TYPE-POOLS: VRM.

DATA: NAME TYPE VRM_ID,

LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF LIST.

PARAMETERS: PS_PARM AS LISTBOX VISIBLE LENGTH 10 USER-COMMAND R .

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

PARAMETERS : PRE_LAYR(10) TYPE C MODIF ID ABC.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.

PARAMETERS : APPL_LAY(40) TYPE C MODIF ID DEF.

SELECTION-SCREEN END OF BLOCK B2.

initialization.

NAME = 'PS_PARM'.

VALUE-KEY = '1'.

VALUE-TEXT = 'LINE1'.

APPEND VALUE TO LIST. VALUE-KEY = '2'.

VALUE-TEXT = 'LINE2'.

APPEND VALUE TO LIST.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST.

AT SELECTION-SCREEN OUTPUT.

IF PS_PARM = '1'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'DEF' .

SCREEN-ACTIVE = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

IF PS_PARM = '2'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'ABC' .

SCREEN-ACTIVE = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

START-OF-SELECTION.

WRITE: / 'PARAMETER:', PS_PARM.

Thansk

Mahesh

Read only

0 Likes
1,029

Hi Mahesh,

Its giving me an error .Iam on 4.6c

LIST BOX AND USERCOMMANDS DOESN'T SEEM TO GO TOGETHER IN 4.6c

Thanks

Preeti

Read only

0 Likes
1,029

s.

it is woring in ECC but not in 4.6 i just check it out.. have to see some other way.. i will update you if i find some.

Thanks

Mahesh

Read only

0 Likes
1,029

Hi Mahesh,

I have added a radio button and based on that i making the field active and inactive.

when ever i select p_dr radi button i shouldn't see maktx field on selection screen .

parameters : p_d radiobutton group gp2 default 'X' user-command chk,

P_DR RADIOBUTTON GROUP GP2.

matno like mara-matnr modif id g2 ,

maktx like mara-maktx modif id g2.

at selection-screen output.

LOOP AT SCREEN.

IF screen-group1 = 'G2' AND SCREEN-NAME = 'MAKTX'.

IF P_D = 'X'.

screen-active = 0.

modify screen.

ENDIF.

can yoou check this code

ites removing the field to enter the value but not the desc

let me know

Thanks

Read only

0 Likes
1,029

parameters : p_d radiobutton group gp2 default 'X' user-command chk,

P_DR RADIOBUTTON GROUP GP2.

matno like mara-matnr modif id g2 ,

maktx like mara-maktx modif id g2.

at selection-screen output.

LOOP AT SCREEN.

IF SCREEN-NAME = 'MAKTX'.

IF P_D = 'X'.

*screen-active = 0.

screen-invisible = 0.

modify screen.

ENDIF.

endloop.

try this..

-Kriss

Read only

0 Likes
1,029

Hi Guys,

My bad. I Figured it out

Thanks all