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

validations on selection screen

Former Member
0 Likes
1,054

Hi,

I have created a selection screen .The screen fields of my screen refer the screen fields of a sap standard selection screen saprck23.In the standard selection screen there is a validation added for a screen field called Period which accepts value from 1 to 14.since i m also making use of the same screen field how can i use the validation which is existing in sap standard screen to my own selection screen

can anyone help me ....points will be rewarded...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
991

Hi,

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.

<b>Rewardpoints</b>

Regards

8 REPLIES 8
Read only

Former Member
0 Likes
991

Hi,

Use the event at selection screen on field .

At selection screen on field p_period.

if p_perid < 1 or p_perid >14.

error message.

endif.

Regards,

Read only

Former Member
0 Likes
991

Hi Hemavathi,

Just copy paste the same code of validation into your program.

Reward points if useful.

Regards,

Atish

Read only

Former Member
0 Likes
992

Hi,

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.

<b>Rewardpoints</b>

Regards

Read only

Former Member
0 Likes
991

hi

i think u can write the same validation code in ur program under

at selection-screen output on field

event

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
991

Hi,

FInd the parameter/Select-options used in the standard program.

Then in main program,check for that.You can find the validation related to that.

Other way is,simply put /h after you entered values.Then check in program, where the cursor is going.From there in program,copy the coding.

Read only

Former Member
0 Likes
991

declare the same naming conversion of the standard and include this <b> saprck23</b>

program, so that you don't want write the validation logic ... it will take care of it ...

becuase saprck23 has the AT SELECTION-SCREEN ON VALUE-REQUEST ...

Girish

Read only

0 Likes
991

hi girish,

as per ur suggestion, actually what i shud declare??

im not able to get wat u said....

can u explain it in detailed manner pls??

Read only

Former Member
0 Likes
991

Hi,

The validation for POSTING PERIOD is done by AT SLECTION_SCREEN in the prog SAPRCK23.

If u wantto use teh same logic, then search for" AT selection-screen " in the program and just copy-pase the logic, taking care of all naming conventions of variables followed by standartd sap program.

Revert back if any issues,

Reward with points if helpful ,

Regards,

Naveen