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

Former Member
0 Likes
653

I have a Check box P_CAT8. If this check box is checked, then 2 fields LIFNR and BELNR will me enabled and they are mandatory. But, without giving values in these 2 fields, if I again uncheck the check box, these fields should become disabled again. can anybody tell me how to handle this?

7 REPLIES 7
Read only

Former Member
0 Likes
632

Hi Priyanka ,

You will have to use the event at selection screen output and inside this

loop at screen .

  • YOUR CODE TO ENABLE/DISABLE A FEILD

endloop.

Regadrs

Arun

Read only

Former Member
0 Likes
632

Hi Priyanka,

Refer this link for sample logic:(Vijay's Solution)

Regards,

Ravi

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
632

Check this out.



report zrich_0003.

parameters:  p_cat8 as checkbox user-command chk.
parameters:  p_lifnr type lfa1-lifnr modif id chk.
parameters:  p_belnr type bsak-belnr modif id chk.

at selection-screen output.

  if p_cat8 = space.
    loop at screen.
      if screen-group1 = 'CHK'.
        screen-input = '0'.
        modify screen.
      endif.
    endloop.
  endif.

at selection-screen.


check sy-ucomm <> 'CHK'.

  if p_cat8 = 'X'.
    if p_lifnr is initial.
      message e001(00) with 'Please fill in the LIFNR field'.
    endif.
    if p_belnr is initial.
      message e001(00) with 'Please fill in the BELNR field'.
    endif.
  endif.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
632

Hello,

Check this code:

[code]PARAMETERS: SP_CHECK AS CHECKBOX USER-COMMAND CHECK.
SELECT-OPTIONS: SO_MATNR FOR MARA-MATNR MODIF ID GRP.

AT SELECTION-SCREEN OUTPUT.
  IF SP_CHECK IS INITIAL.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'GRP'.
        SCREEN-INPUT = '0'.
        SCREEN-OUTPUT = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
    CLEAR: SO_MATNR.
    REFRESH: SO_MATNR.
  ENDIF.

AT SELECTION-SCREEN ON SP_CHECK.
  PERFORM MATERIAL_CHECK.

FORM MATERIAL_CHECK.

  IF NOT SP_CHECK IS INITIAL.
    IF SO_MATNR[] IS INITIAL.
      LOOP AT SCREEN.
        IF SCREEN-NAME = 'SO_MATNR-LOW'.
          SCREEN-INPUT = '1'.
          SCREEN-OUTPUT = '0'.
          SCREEN-REQUIRED = '1'.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDIF.
ENDFORM.                    " MATERIAL_CHECK

Read only

Former Member
0 Likes
632

Hi Priyanka,

You need to use the LOOP AT SCREEN logic over here, in the AT SELECTION SCREEN Event,

IF  P_CAT8 = 'X'.
 LOOP AT SCREEN.

 ENDLOOP.
Endif.

See the below links for more inofrmation

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbab6f35c111d1829f0000e829fbfe/content.htm

http://www.sap-img.com/abap/common-used-of-dialog-screen-for-display-change-delete.htm

http://www.erpgenie.com/abap/selection_screens.htm

Regards

Sudheer

Read only

Former Member
0 Likes
632

hi priyanka,

at selection screen output u have to handle this.

selection-screen begin of screen 9000.

PARAMETERS p1 as checkbox modif id MD.

selection-screen end of screen 9000.

call selection-screen 9000.

at selection-screen output.

loop at screen.

if screen-group1 = 'MD'.

screen-invisible = '0'. / to disable u have use screen-invisible = '1'.

modify screen.

endif.

endloop.

Hope this helps u.

Regards...

Arun.

Read only

Former Member
0 Likes
632

in my opinion this scenario is not possible .

cause i have checked the box so now the code has to show that these are the mandatory fields so without entering any fields if i try to process the screen then an error is triggerd saying to fill the screen ,

we cannot bypass once the system throws this error message .

we cannot make them disable .

parameters : p_cat8 as checkbox user-command r  modif id abc.


PARAMETERS: p_lifnr like lfa1-lifnr modif id def.

PARAMETERS: p_belnr like mseg-belnr modif id def.

at selection-screen output.

if p_cat8 ne ' '.
loop at screen.
if screen-group1 = 'DEF'.
screen-input = '1'.
screen-required = '1'.
modify screen.
endif.
endloop.

else.

loop at screen.
if screen-group1 = 'DEF'.
screen-required = '0'.
screen-input = '0'.
modify screen.
endif.
endloop.

endif.

regards,

vijay