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: 

how can i used pai in screen 1000 to change the select-options field?

Former Member
0 Kudos

hi,all.

I want used pai to change the select-options field,but it can't works.

the mainly code is:

REPORT ZTEST99.

TABLES :MARA,MAKT,MARC.

SELECTION-SCREEN BEGIN OF BLOCK B0 WITH FRAME TITLE TITLE0 .

select-options:s_matnr for mara-matnr,

s_werks for marc-werks MODIF ID ID1.

SELECTION-SCREEN END OF BLOCK B0.

parameters:p_flag as checkbox.

at selection-screen OUTPUT.

LOOP AT SCREEN.

IF P_FLAG = 'X' .

IF screen-group1 = 'ID1'.

screen-input = '0'.

ELSE.

screen-input = '1'.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

START-OF-SELECTION.

CALL SCREEN 1000.

************

when i click p_flag,then i want to change s_werks from OBLIGATORY to no OBLIGATORY.

how can i realized?

Thanks for all.

Sun

7 REPLIES 7

Former Member
0 Kudos

Hi ,

I don t think it it possible to set a field as obligatory and then reset it back to non obligatory ,i.e. once a field is set as obligatory it remains obligatory.

So what i would suggest is to do this check in the program, in the AT selection screen event, check if the check box is checked if it is then check if there is a value in the field.

Regards

Arun

Former Member
0 Kudos

check the below code.

REPORT ZTEST99.

TABLES :MARA,MAKT,MARC.

SELECTION-SCREEN BEGIN OF BLOCK B0 WITH FRAME TITLE TITLE0 .

select-options:s_matnr for mara-matnr,

s_werks for marc-werks MODIF ID ID1.

SELECTION-SCREEN END OF BLOCK B0.

parameters:p_flag as checkbox user-command 'cmd'.

at selection-screen .

if p_flag = 'X'.

if s_werks is initial.

message e208(00) with 'enter value in werks'.

endif.

endif.

Former Member
0 Kudos

Hi,

REPORT ZTEST99.

TABLES :MARA,MAKT,MARC.

SELECTION-SCREEN BEGIN OF BLOCK B0 WITH FRAME TITLE TITLE0 .

select-options:s_matnr for mara-matnr,

s_werks for marc-werks MODIF ID ID1.

SELECTION-SCREEN END OF BLOCK B0.

parameters:p_flag as checkbox user-command ucm.

at selection-screen OUTPUT.

LOOP AT SCREEN.

IF P_FLAG = 'X' .

IF screen-group1 = 'ID1'.

screen-input = '0'.

screen-required = '0'.

ELSE.

screen-input = '1'.

screen-required = '1'

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Try this it will work.

Thanks,

Rajinikanth

0 Kudos

Hi, Rajinikanth and all:

Thank for your help,now it can works.but I found it responsed so slowly.

When I click the p_flag first,it does not reflect.until I click the p_flag 4 times,it just works.why it responsed so slowly,is it my sap system problem ?

REPORT ZTEST99.

TABLES :MARA,MAKT,MARC.

SELECTION-SCREEN BEGIN OF BLOCK B0 WITH FRAME TITLE TITLE0 .

select-options:s_matnr for mara-matnr,

s_werks for marc-werks MODIF ID ID1.

SELECTION-SCREEN END OF BLOCK B0.

parameters:p_flag as checkbox.

at selection-screen OUTPUT.

LOOP AT SCREEN.

IF P_FLAG = 'X' .

IF screen-group1 = 'ID1'.

screen-input = '1'.

screen-required = '1'.

ELSE.

screen-input = '1'.

screen-required = '0'.

ENDIF.

ELSE.

screen-input = '1'.

screen-required = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

START-OF-SELECTION.

CALL SCREEN 1000.

0 Kudos

please try to uncheck the checkbox and see if the field becomes non obligatory.

Former Member
0 Kudos

Hi ,

change your code like this.

Change in your code:

SELECTION-SCREEN BEGIN OF SCREEN 100.

SELECT-OPTIONS : s_matnr for mara-matnr,

s_werks for marc-werks MODIF ID ID1.

SELECTION-SCREEN END OF SCREEN 100 .

At selection-screen.

if sy-dynnr = '100'.

IF P_FLAG = 'X' .

LOOP AT SCREEN.

IF screen-group1 = 'ID1'.

screen-required = '0'.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

else.

LOOP AT SCREEN.

IF screen-group1 = 'ID1'.

screen-required = 1.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

my code :

REPORT Z50871_SELECTOPS_DYNAMIC.

PARAMETERS : CH_EBELN AS CHECKBOX,

CH_VBELN AS CHECKBOX.

DATA: V_EBELN TYPE EKKO-EBELN,

V_VBELN TYPE VBAK-VBELN.

SELECTION-SCREEN BEGIN OF SCREEN 100.

SELECT-OPTIONS : EBELN FOR V_EBELN MODIF ID G1,

VBELN FOR V_VBELN MODIF ID G2.

SELECTION-SCREEN END OF SCREEN 100 .

AT SELECTION-SCREEN OUTPUT.

IF SY-DYNNR = 100.

IF CH_EBELN = 'X' AND

CH_VBELN = ''.

LOOP AT SCREEN.

IF SCREEN-GROUP1 EQ 'G1'.

SCREEN-ACTIVE = '1'.

ELSE.

SCREEN-ACTIVE = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF CH_VBELN = 'X' AND

CH_EBELN = '' .

LOOP AT SCREEN.

IF SCREEN-GROUP1 EQ 'G2'.

SCREEN-ACTIVE = '1'.

ELSE.

SCREEN-ACTIVE = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF CH_EBELN = 'X' AND CH_VBELN = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 EQ 'G1'

OR SCREEN-GROUP1 EQ 'G2' .

SCREEN-ACTIVE = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

ENDIF.

AT SELECTION-SCREEN.

IF SY-DYNNR = 1000.

IF CH_EBELN = 'X' OR CH_VBELN = 'X'.

CALL SELECTION-SCREEN 100.

ELSE.

MESSAGE I000(Z50871MSG) WITH 'Please select atleast one checkbox'.

ENDIF.

ENDIF.

regards

Sandeep Reddy

Former Member
0 Kudos

hi,all

Thank you Very much .

The problem has been solved

IF you have not get the points,please contact me

Sun