Application Development 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: 

pls code!!!

Former Member
0 Kudos

The following is the program that should add two numbers when pushbutton is clicked. how to disable the input fields..pls fill the at selection-screen output part

REPORT ZR6.

SELECTION-SCREEN BEGIN OF BLOCK b1.

PARAMETERS : P1 TYPE I,

P2 TYPE I,

P3 TYPE I.

SELECTION-SCREEN END OF BLOCK b1.

selection-screen: pushbutton /1(6) text-010 user-command cli1.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

ENDLOOP.

AT SELECTION-SCREEN.

CASE SY-UCOMM.

WHEN 'CLI1'.

P3 = P1 + P2.

ENDCASE.

thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

try this

SELECTION-SCREEN BEGIN OF BLOCK b1.

PARAMETERS : p1 TYPE i,

p2 TYPE i,

p3 TYPE i.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN: PUSHBUTTON /1(6) text-010 USER-COMMAND cli1.

AT SELECTION-SCREEN OUTPUT.

<b> LOOP AT SCREEN.

IF p3 IS NOT INITIAL.

IF screen-name = 'P1' or screen-name = 'P2'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.</b>

AT SELECTION-SCREEN.

CASE sy-ucomm.

WHEN 'CLI1'.

p3 = p1 + p2.

ENDCASE.

7 REPLIES 7

Former Member
0 Kudos

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-NAME EQ 'P1' OR SCREEN-NAME EQ 'P2'

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Reward if answered

Former Member
0 Kudos

SELECTION-SCREEN BEGIN OF BLOCK b1.
PARAMETERS : p1 TYPE i DEFAULT '100' MODIF ID r1,
p2 TYPE i DEFAULT '200' MODIF ID r1,
p3 TYPE i.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN: PUSHBUTTON /1(6) text-010 USER-COMMAND cli1.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-group1 = 'R1'.
      screen-input = '0'.
      MODIFY SCREEN.
    ENDIF.

  ENDLOOP.

AT SELECTION-SCREEN.
  CASE sy-ucomm.
    WHEN 'CLI1'.
      p3 = p1 + p2.

  ENDCASE.

Former Member
0 Kudos

hi,

try this

SELECTION-SCREEN BEGIN OF BLOCK b1.

PARAMETERS : p1 TYPE i,

p2 TYPE i,

p3 TYPE i.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN: PUSHBUTTON /1(6) text-010 USER-COMMAND cli1.

AT SELECTION-SCREEN OUTPUT.

<b> LOOP AT SCREEN.

IF p3 IS NOT INITIAL.

IF screen-name = 'P1' or screen-name = 'P2'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.</b>

AT SELECTION-SCREEN.

CASE sy-ucomm.

WHEN 'CLI1'.

p3 = p1 + p2.

ENDCASE.

former_member404244
Active Contributor
0 Kudos

Hi,

Just do like this.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-NAME EQ 'P1' OR SCREEN-NAME EQ 'P2'

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Regards,

Nagaraj

Former Member
0 Kudos

SELECTION-SCREEN BEGIN OF BLOCK b1.

PARAMETERS : P1 TYPE I modif id r1,

P2 TYPE I modif id r1,

P3 TYPE I.

SELECTION-SCREEN END OF BLOCK b1.

selection-screen: pushbutton /1(6) text-010 user-command cli1.

AT SELECTION-SCREEN OUTPUT.

IF NOT P3 IS INITIAL.

LOOP AT SCREEN.

IF screen-group1 = 'R1'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

endif.

AT SELECTION-SCREEN.

CASE SY-UCOMM.

WHEN 'CLI1'.

P3 = P1 + P2.

ENDCASE.

Former Member
0 Kudos

Thanks a lot...I would be greatful if you explain the following line by line..

LOOP AT SCREEN.

IF p3 IS NOT INITIAL.

IF screen-name = 'P1' or screen-name = 'P2'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

0 Kudos

hi,

<b>IF p3 is not initial</b> :- if p3 is not calculated u dont want to disable that two fields so i put that condition that if p3 is calculated than only parameter field should b disable.

<b>IF screen-name = 'P1' or screen-name = 'P2'.</b> :- here ur parameter name is P1 and P2 ...

whenever u create parameter or select-option, by deefault one screen created and parameters or select-options becomes its element and u can check each element name with screen name.......

so here i check screen element name.

<b>screen-input = 0</b> :- it will disable that two parameter as condition matches.

<b>MODIFY SCREEN.</b> :- to get modification which we made...

More precisely ....

Here one screen will create with four element ( P1,P2,P3 and Push button), and u want to check each element

so u need <b>loop at screen---endloop.</b>

hope it is useful