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

Controlling the pushbuttons

Former Member
0 Likes
814

Hi friends,

I need to display two pushbuttons and two parameters on the selection screen, when I click one push button I have to display one parameter and hide the another parameter,same with the second pushbutton.Please give me some sample code.

sathish.

1 ACCEPTED SOLUTION
Read only

dani_mn
Active Contributor
0 Likes
787

Hi,

check this report it is doing the same.

<b>REPORT zwa_test2.

TABLES : SSCRFIELDS.

DATA: comm(1).

PARAMETERS : P LIKE MARA-MATNR MODIF ID P.
PARAMETERS : P1 LIKE MARC-WERKS MODIF ID p1.

SELECTION-SCREEN : begin of line,
PUSHBUTTON 2(10) PB1 USER-COMMAND A,
PUSHBUTTON 20(10) PB2 USER-COMMAND B,
end of line.

INITIALIZATION.
  LOOP AT SCREEN.
    IF SCREEN-group1 = 'P' OR
       SCREEN-group1 = 'P1'.
      SCREEN-active = '0'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN.

  IF sy-ucomm  = 'A'.
    comm = 'A'.
  elseif sy-ucomm = 'B'.
    comm = 'B'.
  ENDIF.

AT SELECTION-SCREEN output.



  LOOP AT SCREEN.
    IF SCREEN-group1 = 'P'.

      if comm = 'A'.
        SCREEN-active = '1'.
      else.
        SCREEN-active = '0'.
      endif.
      MODIFY SCREEN.

    ENDIF.

    IF SCREEN-group1 = 'P1'.

      if comm = 'B'.
        SCREEN-active = '1'.
      else.
        SCREEN-active = '0'.
      endif.
      MODIFY SCREEN.



    ENDIF.

  ENDLOOP.
  clear: comm.</b>

Regards,

HRA

6 REPLIES 6
Read only

Former Member
0 Likes
787

Hi sathish,

do this in the pai block.

if v_ucomm = 'DISPLAY'.

loop at screen.

if screen-name = 'v_matnr'.

screen-input = 0.

modify screen.

endif.

endloop.

else.

loop at screen.

if screen-name = 'v_werks'.

screen-input = 0.

modify screen.

endif.

endloop.

endif.

reward if helpful

keerthi.

Read only

Former Member
0 Likes
787

hi satish,

case sy-ucomm.

when 1.

loop at screen.

if screen-name = 'field1'.

screen-invisible = '1'.

modify screen.

endif.

endloop.

when 2.

loop at screen.

if screen-name = 'field2'.

screen-invisible = '1'.

modify screen.

endif.

endloop.

endcase.

hope this helps,

do reward if it helps,

priya.

Read only

0 Likes
787

Priya,

I tried with these methods till now. But I havn't got the answer. If you have time please try it once and send me the total code.

Read only

0 Likes
787

TRY THIS:

REPORT znrw_pbut .

SELECTION-SCREEN PUSHBUTTON 15(5) pbut_1 USER-COMMAND pb1.

SELECTION-SCREEN PUSHBUTTON 35(5) pbut_2 USER-COMMAND pb2.

parameters: pbut1a type matnr MODIF ID pb1,

pbut1b type sydatum MODIF ID pb1.

parameters: pbut2a type vbeln MODIF ID pb2.

TABLES: sscrfields.

data l_button like sy-ucomm.

INITIALIZATION.

MOVE 'PB 1' TO pbut_1.

MOVE 'PB 2' TO pbut_2.

l_button = 'PB1'

...

AT SELECTION-SCREEN.

IF sscrfields-ucomm = 'PB1'

OR sscrfields-ucomm = 'PB2'.

l_button = sscrfields-ucomm.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

loop at screen.

IF SCREEN-GROUP1 = 'PB1'

OR SCREEN-GROUP1 = 'PB2'.

IF SCREEN-GROUP1 <> L_BUTTON.

SCREEN-ACTIVE = '0'.

MODIFY SCREEN.

ENDIF.

ENDIF.

Read only

0 Likes
787

TRY LIKE THIS IT MAY WORK...

SELECTION-SCREEN PUSHBUTTON 15(15) KIS1 USER-COMMAND ID1.
SELECTION-SCREEN PUSHBUTTON 35(15) KIS2 USER-COMMAND ID2.

parameters: KISHAN1(15) MODIF ID ID1.


parameters: KISHAN2(15)  MODIF ID ID2.

TABLES: sscrfields.

data l_button like sy-ucomm.

INITIALIZATION.
 KIS1 =  'Pushbutton1'.
 KIS2 =  'Pushbutton2'.
l_button = 'ID1'.


AT SELECTION-SCREEN.
IF sscrfields-ucomm = 'ID1'
OR sscrfields-ucomm = 'ID2'.
l_button = sscrfields-ucomm.
ENDIF.

AT SELECTION-SCREEN OUTPUT.

loop at screen.
IF SCREEN-GROUP1 = 'ID1'.
IF SCREEN-GROUP1 <> L_BUTTON.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.

loop at screen.
IF SCREEN-GROUP1 = 'ID2'.
IF SCREEN-GROUP1 <> L_BUTTON.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.

Read only

dani_mn
Active Contributor
0 Likes
788

Hi,

check this report it is doing the same.

<b>REPORT zwa_test2.

TABLES : SSCRFIELDS.

DATA: comm(1).

PARAMETERS : P LIKE MARA-MATNR MODIF ID P.
PARAMETERS : P1 LIKE MARC-WERKS MODIF ID p1.

SELECTION-SCREEN : begin of line,
PUSHBUTTON 2(10) PB1 USER-COMMAND A,
PUSHBUTTON 20(10) PB2 USER-COMMAND B,
end of line.

INITIALIZATION.
  LOOP AT SCREEN.
    IF SCREEN-group1 = 'P' OR
       SCREEN-group1 = 'P1'.
      SCREEN-active = '0'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN.

  IF sy-ucomm  = 'A'.
    comm = 'A'.
  elseif sy-ucomm = 'B'.
    comm = 'B'.
  ENDIF.

AT SELECTION-SCREEN output.



  LOOP AT SCREEN.
    IF SCREEN-group1 = 'P'.

      if comm = 'A'.
        SCREEN-active = '1'.
      else.
        SCREEN-active = '0'.
      endif.
      MODIFY SCREEN.

    ENDIF.

    IF SCREEN-group1 = 'P1'.

      if comm = 'B'.
        SCREEN-active = '1'.
      else.
        SCREEN-active = '0'.
      endif.
      MODIFY SCREEN.



    ENDIF.

  ENDLOOP.
  clear: comm.</b>

Regards,

HRA