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

validation in selection screen

Former Member
0 Likes
1,125

Hi folks

iam desiging a report, in selection screen with 2 diffrent block and 2 radio button, based on radio botton and block selection the out should displyed,

there 2 mandatory fields one in first block, and the other in 2nd block, the moment firts block is filled and the 1st radio button is selected, iam getting the error"please make the entry in all fields"because 2nd mandatory filed is empty.

iam alreday using the event at selection screen and at selection screen on fied, what logic i need to place to do the block level validation.

thanks in advance

regards

p r i y a

12 REPLIES 12
Read only

Former Member
0 Likes
1,076

Use

at selection-screen on block <block name>.

Sreedhar

Read only

Former Member
0 Likes
1,076

Hi Priya,

Try makinng the fields in the 2nd button inactive.I think this should work, had done earlier.

In AT selction-screen event,

call Loop at screen.

Based on screen-name, make the field as inactive.

i.e., screen-active = 0.

If it works, assign points pls..

Thanks,

Raju

Read only

Former Member
0 Likes
1,076

Hi Priya,

1)Remove the mandatory option from the definition.

2)In the event

AT SELECTION SCREEN ON BLOCK

check if the parameter is initial and display a error message.

Regards,

AS.

Read only

Former Member
0 Likes
1,076

Hi,

Consider this program.


REPORT  zzarun_pass.

PARAMETERS : one RADIOBUTTON GROUP ab DEFAULT 'X',
             second RADIOBUTTON GROUP ab.

SELECTION-SCREEN BEGIN OF BLOCK abc WITH FRAME.
PARAMETERS : p_unam1(20) TYPE c,
             p_pass1(20) TYPE c  LOWER CASE .
SELECTION-SCREEN END OF BLOCK abc.



SELECTION-SCREEN BEGIN OF BLOCK efg WITH FRAME.
PARAMETERS : p_unam2(20) TYPE c,
             p_pass2(20) TYPE c  LOWER CASE .
SELECTION-SCREEN END OF BLOCK efg.


AT SELECTION-SCREEN ON BLOCK abc.

  IF one EQ 'X'.

    IF  p_unam1 IS INITIAL.
      MESSAGE 'Enter value for p_unam1' TYPE 'E' DISPLAY LIKE 'S'.
    ENDIF.

  ENDIF.


AT SELECTION-SCREEN ON BLOCK efg.

  IF second EQ 'X'.

    IF   p_unam2 IS INITIAL.
      MESSAGE 'Enter value for p_unam2' TYPE  'E' DISPLAY LIKE 'S'.
    ENDIF.

  ENDIF.

Regards,

AS.

Read only

0 Likes
1,076

Hi all.

thanks for your reply.

iam try to use loop at screen in the vent atselection screen on block, but here field is declared as follows,

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-001 .

SELECT-OPTIONS: C_CTLPC FOR KNKK-CTLPC. RANGES:R_SBGRP FOR KNKK-SBGRP.

PARAMETERS: C_SBGRP LIKE KNKK-SBGRP,

C_DAY TYPE I OBLIGATORY. SELECTION-SCREEN END OF BLOCK 1.

SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE TEXT-002 .

SELECT-OPTIONS: O_CTLPC FOR KNKK-CTLPC.

RANGES: R_SBGRP1 FOR KNKK-SBGRP.

PARAMETERS: O_SBGRP LIKE KNKK-SBGRP.

o_DAY TYPE I OBLIGATORY

SELECTION-SCREEN END OF BLOCK 2.

now if i filled the first block.and trying to execute, but it will ask to fill o_DAY also,

now please tell me how to prevent this?

Read only

0 Likes
1,076

You must not use the OBLIGATORY extension for that field. If you do, it will always give an error when it is not filled.


o_DAY TYPE I OBLIGATORY

Regards,

Rich Heilman

Read only

0 Likes
1,076

Hi rich,

i removed the obligatory extension and now i recodede as follows.

AT SELECTION-SCREEN.

IF CREDIT = 'X' AND C_DAY IS initial.

MESSAGE E002(ZCR).

ENDIF.

IF OVERVIEW = 'X' AND O_CTLPC IS initial.

MESSAGE E003(ZCR).

ENDIF.

IF REVIEW = 'X' AND G_DAY IS initial.

MESSAGE E004(ZCR).

ENDIF.

now its ok but suppose i selected the 2nd radio button and in the 2nd block for the fieldO_CTLPC ,i trying to select multile selection( -> ). in this case also it showing MESSAGE E003(ZCR).

how can prevet this prblm.

regards

priya

Read only

rahulkavuri
Active Contributor
0 Likes
1,076

hi I have faced similar problem because when u make a field obligatory and if we again use at-selection screen event the error message can not be avoided

Define a form statement which checks whether the field is initial..

try this code, based on the radio button clicked the block appears & disappears, hope this helps

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_FILE(25) TYPE C,
             O_FILE(25) TYPE C.

SELECTION-SCREEN END OF BLOCK B1.

*Selection Screen 2

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

PARAMETERS: CAL_TRA RADIOBUTTON GROUP G1 USER-COMMAND FLAG,
            SESSION RADIOBUTTON GROUP G1 DEFAULT 'X'.

SELECTION-SCREEN END OF BLOCK B2.

*Selection Screen 3

SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.

PARAMETERS: MODE DEFAULT 'X' MODIF ID BL1,
            UPDATE DEFAULT 'X' MODIF ID BL1.

SELECTION-SCREEN END OF BLOCK B3.

*Selection Screen 4

SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-003.


PARAMETERS: SES_NAM TYPE APQI-GROUPID MODIF ID BL2,
            KEP_TRAS TYPE C DEFAULT 'X' MODIF ID BL2,
            LOC_DATE TYPE SY-DATUM MODIF ID BL2,
            USER TYPE SY-UNAME DEFAULT SY-UNAME MODIF ID BL2.

SELECTION-SCREEN END OF BLOCK B4.

************************************************************************
*                     At  Selection-Screen Output                      *
************************************************************************

AT SELECTION-SCREEN OUTPUT.


  IF CAL_TRA = 'X'.
    LOOP AT SCREEN.

      IF SCREEN-GROUP1 = 'BL1'.
        SCREEN-ACTIVE = '1'.
      ENDIF.

      IF SCREEN-GROUP1 = 'BL2'.
        SCREEN-ACTIVE = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

  IF SESSION = 'X'.

    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'BL1'.
        SCREEN-ACTIVE = '0'.
      ENDIF.

      IF SCREEN-GROUP1 = 'BL2'.
        SCREEN-ACTIVE = '1'.
      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.
  ENDIF.

Read only

0 Likes
1,076

Hi rahul

thanks for the reply

what is the GROUP here? where i can find the value for the group?

thanks

regards

priya

Read only

0 Likes
1,076

Hi,

Group is mentioned with modif id. you can give your own name for group at :<b> SCREEN-GROUP = 'BL1'</b>

PARAMETERS: MODE DEFAULT 'X' MODIF ID <b>BL1</b>, check above code.

Regards

Appana

Read only

0 Likes
1,076

hi folks,

thanks for u r inputs,now iam using the loop at screen for gropu validation

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-001 .

SELECT-OPTIONS: C_CTLPC FOR KNKK-CTLPC MODIF ID L1.

RANGES:R_SBGRP FOR KNKK-SBGRP.

PARAMETERS:C_SBGR like KNKK-SBGrpMODIFIDBL1

C_DAY TYPE I MODIF ID BL1.

SELECTION-SCREEN END OF BLOCK 1.

SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE TEXT-002 .

SELECT-OPTIONS: O_CTLPC FOR KNKK-CTLPC MODIF ID BL2.

RANGES: R_SBGRP1 FOR KNKK-SBGRP.

PARAMETERS: O_SBGRP LIKE KNKK-SBGRP MODIF ID BL2. SELECTION-SCREEN END OF BLOCK 2.

SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE TEXT-003 .

SELECT-OPTIONS:G_CTLPC FOR KNKK-CTLPC MODIF ID BL3.

RANGES: R_SBGRP2 FOR KNKK-SBGRP.

PARAMETERS:G_SBGRPLIKEKNKK-SBGRP MODIF ID L3 G_DAY TYPE I MODIF ID BL3.

SELECTION-SCREEN END OF BLOCK 3.

SELECTION-SCREEN BEGIN OF BLOCK 4 WITH FRAME TITLE TEXT-016.

PARAMETER: CREDIT RADIOBUTTON GROUP RDA1 .

PARAMETER: OVERVIEW RADIOBUTTON GROUP RDA1 .

PARAMETER: REVIEW RADIOBUTTON GROUP RDA1 .

SELECTION-SCREEN END OF BLOCK 4.

AT SELECTION-SCREEN.

IF Credit = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'BL1'.

SCREEN-ACTIVE = '1'.

ENDIF.

IF SCREEN-GROUP1 = 'BL2'.

SCREEN-ACTIVE = '0'.

ENDIF.

IF SCREEN-GROUP1 = 'BL3'.

SCREEN-ACTIVE = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

if OVERVIEW ='X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'BL1'.

SCREEN-ACTIVE = '0'.

ENDIF.

IF SCREEN-GROUP1 = 'BL2'.

SCREEN-ACTIVE = '1'.

ENDIF.

IF SCREEN-GROUP1 = 'BL3'.

SCREEN-ACTIVE = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

please tell me the above coding is currect? because it not working properly

regards

priya

Read only

0 Likes
1,076

Here's one problem. Shouldn't the ID for the following line be BL1?

SELECT-OPTIONS: C_CTLPC FOR KNKK-CTLPC MODIF ID L1.