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: 

Dialog programming

Former Member
0 Kudos
105

how to make disable some of the fields in the screen. For ex : When u click NEW it Should allow u to enter the new datas ............When u click on EDIT it should allow u to edit only some fields.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
79

Hi,

Inorder to disable some fields in Selection-screen .

parameters: p_char modif id 'XYZ' .

at selection-screen output .

Loop at screen .

if screen-group1 = "XYZ' .

if sy-ucomm = 'NEW' .

screen-active = 1 .

elseif sy-ucomm = 'EDIT' .

screen-active = 0 .

endif.

endif .

endloop.

8 REPLIES 8

Former Member
0 Kudos
79

Hi,

You can loop at the table SCREEN and set the parameter for the screen elemetnt.

Hope this solves your purpose.

Award points if it helps.

-Gaurang

Former Member
0 Kudos
79

hi lakshaman,

hope this one is useful for u, u have to modify the thing in PBI.

check the below code.its useful yaar.&----


*& Report ZGOPI_SCREEN1 *

*& *

&----


*& *

*& *

&----


REPORT ZGOPI_SCREEN1.

TABLES ZPURCHASE.

TABLES SCREEN.

*TABLES SSCRFIELDS.

DATA : ITAB TYPE TABLE OF ZPURCHASE WITH HEADER LINE.

DATA: T1(10),

T2(10),

T3(10),

T4(10),

FLAG.

CALL SCREEN '0002'.

  • LEAVE LIST-PROCESSING.

&----


*& Module NEW INPUT

&----


  • text

----


MODULE NEW INPUT.

IF SY-UCOMM = 'NEW'.

FLAG = '1'.

ENDIF.

IF SY-UCOMM = 'SAVE'.

FLAG = '2'.

ZPURCHASE-ITEMNO = T1.

ZPURCHASE-MATNAME = T2.

ZPURCHASE-MATGROUP = T3.

ZPURCHASE-PLANT = T4.

INSERT ZPURCHASE.

IF SY-SUBRC <> 0.

MESSAGE I000(01).

ENDIF.

ENDIF.

IF SY-UCOMM = 'UPDATE'.

ZPURCHASE-ITEMNO = T1.

ZPURCHASE-MATNAME = T2.

ZPURCHASE-MATGROUP = T3.

ZPURCHASE-PLANT = T4.

MODIFY ZPURCHASE.

ENDIF.

IF SY-UCOMM = 'CANCEL'.

FLAG = '3'.

ENDIF.

IF SY-UCOMM = 'SEARCH'.

FLAG = '4'.

  • READ ZPURCHASE INTO ITAB WHERE ITEMNO = T1.

  • T2 = ITAB-MATNAME.

*

  • T3 = ITAB-MATGROUP.

*

  • T4 = ITAB-PLANT.

ENDIF.

IF SY-UCOMM = 'EXIT'.

*LEAVE SCREEN.

  • LEAVE TO LIST-PROCESSING.

  • SELECT * FROM ZPURCHASE INTO TABLE ITAB.

  • LOOP AT ITAB.

  • WRITE:/ ITAB-ITEMNO.

  • ENDLOOP.

*

LEAVE PROGRAM.

ENDIF.

ENDMODULE. " NEW INPUT,

&----


*& Module OUTPUT OUTPUT

&----


  • text

----


MODULE OUTPUT OUTPUT.

*IF SY-UCOMM = 'NEW'.

*LOOP AT SCREEN.

  • IF SCREEN-NAME = 'B1'.

  • SCREEN-ACTIVE = 0.

  • MODIFY SCREEN.

  • ENDIF.

*

  • IF SCREEN-NAME = 'B3'.

  • SCREEN-ACTIVE = 0.

  • MODIFY SCREEN.

  • ENDIF.

  • ENDLOOP.

*ENDIF.

IF FLAG = '1'.

LOOP AT SCREEN.

IF SCREEN-NAME = 'B1'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ENDIF.

IF SCREEN-NAME = 'B3'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

IF FLAG = '2'.

LOOP AT SCREEN.

IF SCREEN-NAME = 'B2'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

IF FLAG = '3'.

CLEAR: T1,T2,T3,T4.

  • T1 = SPACE.

  • T2 = SPACE.

  • T3 = SPACE.

  • T4 = SPACE.

  • LOOP AT SCREEN.

  • IF SCREEN-NAME = 'T1' OR SCREEN-NAME = 'T2'.

  • SCREEN = SPACE.

  • MODIFY SCREEN.

  • ENDIF.

  • ENDLOOP.

ENDIF.

IF FLAG = '4'.

SELECT * FROM ZPURCHASE INTO ITAB WHERE ITEMNO = T1.

*READ ZPURCHASE WITH KEY ITEMNO = T1.

*

T2 = ITAB-MATNAME.

T3 = ITAB-MATGROUP.

T4 = ITAB-PLANT.

*

ENDSELECT.

ENDIF.

ENDMODULE. " OUTPUT OUTPUT

reward points if its useful

Former Member
0 Kudos
79

Hi Lakshman.,

according to my knowledge this can be done thorugh at selection output.

If sy-ucomm = 'xxxx'.

loop at screen.

if screen-group1 = 'xxx'.

screen-input = 0.

modify screen.

endif.

endif.

Hope this helps you. Reply for queries, shall post the updates.

Regards.

Kumar

Former Member
0 Kudos
79

Hi,

in the okcode of that button write like this.

loop at screen.

ifscreen-name = 'field'.

screen-invisible = '1'.(this is for fully making invisible)

modify screen

endloop.

loop at screen.

ifscreen-name = 'field'.

screen-input = '0'.(this is for making screen grayed out)

modify screen

endloop.

rgds,

bharat.

Former Member
0 Kudos
80

Hi,

Inorder to disable some fields in Selection-screen .

parameters: p_char modif id 'XYZ' .

at selection-screen output .

Loop at screen .

if screen-group1 = "XYZ' .

if sy-ucomm = 'NEW' .

screen-active = 1 .

elseif sy-ucomm = 'EDIT' .

screen-active = 0 .

endif.

endif .

endloop.

Former Member
0 Kudos
79

hi lakshman,

write code as

loop at screen.

case screen-name [for making a screen fields as a mandatory one]

when ' ' [ give the screen field name i.e. textbox name, button name ...]

screen-required =1.

modify screen.

when ' ' [ give the screen field name i.e. textbox name, button name ...]

[for disbaling a screen field]

screen-input = 0.

modify screen.

.

.

.

.

end case.

case for selecting only one alternative from group of alterantives.

if u wanna perform group of actions the use if........endif as

loop at screen.

if screen-name = ' '

screen-required =1.

modify screen.

endif.

if screen-name = ' '

screen-input= o.

modify screen.

endif.

endloop.

if helpful reward some points.

with regards,

suresh babu aluri.

Former Member
0 Kudos
79

Hi Narsimhan,

<b><b>

Just copy and paste this code...........</b>.Analyse this code after execution.. and let

you know lot many new things.....</b>

data:

w_flag TYPE i.

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

PARAMETERS : RT1 RADIOBUTTON GROUP A USER-COMMAND US1.

PARAMETERS:p_prue LIKE qamb-prueflos. " OBLIGATORY MATCHCODE OBJECT

.

PARAMETERS : RT2 RADIOBUTTON GROUP A .

PARAMETERS:p_MBLNR LIKE qamb-prueflos. " OBLIGATORY .

PARAMETERS:p_end LIKE qals-paendterm .

parameters:p_stat type c. " obligatory.

SELECTION-SCREEN:END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF w_flag = 1 AND SCREEN-NAME = 'P_MBLNR'.

SCREEN-INPUT = 0.

ELSEIF w_flag = 2 AND SCREEN-NAME = 'P_PRUE'.

SCREEN-INPUT = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

AT SELECTION-SCREEN.

if rt1 = 'X'.

w_flag = 1.

else.

w_flag = 2.

endif.

IF sy-ucomm = 'ONLI'. " when you press F8......

if p_prue IS INITIAL OR

p_MBLNR IS INITIAL OR

p_stat IS INITIAL.

message 'Fill entries' TYPE 'E'.

endif.

ENDIF.

<b>

Reward all helpful answers</b>

Regards,

V.Raghavender.

Former Member
0 Kudos
79

answered