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 code error

Former Member
0 Likes
736

hi all,

i am trying to code selection screen. where in when i click on 1 pushbutton one field should be active and the other one should be invisible.

the code is syntactically correct but when i execute it . it is not working properly .

i am unable to find the error .

so can any one plz take some time and solve it. and plzzz let me know where i was wrong.

this is the code

parameters: mat1 type mara-matnr,

lif1 type lfa1-lifnr.

selection-screen begin of line.

selection-screen pushbutton: (5) lif user-command abc,

10(5) mat user-command dec.

selection-screen end of line.

data: f_1 type i value 1,

s_1 type i.

at selection-screen output.

loop at screen.

case screen-name.

when 'mat1'.

screen-active = f_1.

when 'lif1'.

screen-active = s_1.

endcase.

modify screen.

endloop.

at selection-screen.

if sy-ucomm = 'abc'.

f_1 = 1.

s_1 = 0.

elseif sy-ucomm = 'dec'.

f_1 = 0.

s_1 = 1.

endif.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
698
Hi amar,

  I had modified ur code , chk this , In the quotes u have to give upper case


REPORT YCHATEST LINE-SIZE 350.

PARAMETERS: MAT1 TYPE MARA-MATNR,
LIF1 TYPE LFA1-LIFNR.


SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON: (5) LIF USER-COMMAND ABC,
10(5) MAT USER-COMMAND DEC.
SELECTION-SCREEN END OF LINE.
DATA: F_1 TYPE I VALUE 1,
S_1 TYPE I.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    CASE SCREEN-NAME.
      WHEN 'MAT1'.
        SCREEN-ACTIVE = F_1.
      WHEN 'LIF1'.
        SCREEN-ACTIVE = S_1.
    ENDCASE.
    MODIFY SCREEN.
  ENDLOOP.

AT SELECTION-SCREEN.
  IF SY-UCOMM = 'ABC'.
    F_1 = 1.
    S_1 = 0.
  ELSEIF SY-UCOMM = 'DEC'.
    F_1 = 0.
    S_1 = 1.
  ENDIF.
7 REPLIES 7
Read only

Former Member
0 Likes
698

Check my sample code :


PARAMETERS     : p_file LIKE rlgrap-filename MODIF ID sim.

AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF screen-group1 = 'SIM'.
        screen-active = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.

Moreover I think u should have a problem because "AT SELECTION-SCREEN" statement is executed after the "AT SELECTION-SCREEN OUTPUT"

Erwan

Hope this helps,

Erwan

Read only

Former Member
0 Likes
698

Hi Amar,

I think you can go with screen-input = 0

reward Points if it is help ful to you

Regards,

kiran I

Read only

Former Member
0 Likes
698

try this

first declare

tables : sscrfields.

data: f_1(1) value '1',

s_1(1) value '0'.

there is nothing to be changed in at selection-screen output

now in

at selection-screen.

if sscrfields-ucomm = 'abc'.

f_1 = '1'.

s_1 = '0'.

elseif sscrfields-ucomm = 'dec'.

f_1 = '0'.

s_1 = '1'.

endif.

Read only

Former Member
0 Likes
699
Hi amar,

  I had modified ur code , chk this , In the quotes u have to give upper case


REPORT YCHATEST LINE-SIZE 350.

PARAMETERS: MAT1 TYPE MARA-MATNR,
LIF1 TYPE LFA1-LIFNR.


SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON: (5) LIF USER-COMMAND ABC,
10(5) MAT USER-COMMAND DEC.
SELECTION-SCREEN END OF LINE.
DATA: F_1 TYPE I VALUE 1,
S_1 TYPE I.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    CASE SCREEN-NAME.
      WHEN 'MAT1'.
        SCREEN-ACTIVE = F_1.
      WHEN 'LIF1'.
        SCREEN-ACTIVE = S_1.
    ENDCASE.
    MODIFY SCREEN.
  ENDLOOP.

AT SELECTION-SCREEN.
  IF SY-UCOMM = 'ABC'.
    F_1 = 1.
    S_1 = 0.
  ELSEIF SY-UCOMM = 'DEC'.
    F_1 = 0.
    S_1 = 1.
  ENDIF.
Read only

Former Member
0 Likes
698

at selection-screen.

if sy-ucomm = 'abc'. write capital abc and check it out

f_1 = 1.

s_1 = 0.

elseif sy-ucomm = 'dec'.

f_1 = 0.

s_1 = 1.

endif.

USE CAPITAL LETTERS WITHIN QUOTES.

TO MAKE IT READ ONLY YOU CAN GO WITH SCREEN-INPUT = 1.

Message was edited by:

Manoharsairam Kavuri

Read only

Former Member
0 Likes
698

Hi Amar,

You can try the following codes:

PARAMETERS: mat1 TYPE mara-matnr,

lif1 TYPE lfa1-lifnr.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON: (5) lif USER-COMMAND abc,

10(5) mat USER-COMMAND dec.

SELECTION-SCREEN END OF LINE.

DATA: f_1 TYPE i VALUE 1,

s_1 TYPE i.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-name CS 'MAT1'.

screen-input = f_1.

ELSEIF screen-name CS 'LIF1'.

screen-input = s_1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

AT SELECTION-SCREEN.

IF sy-ucomm = 'ABC'.

f_1 = 1.

s_1 = 0.

ELSEIF sy-ucomm = 'DEC'.

f_1 = 0.

s_1 = 1.

ENDIF.

Regards,

Hendy

Read only

Former Member
0 Likes
698

your cording is ok dear, its working properly

where you want to active fields, its not apper.