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

Slection Screen Validations

Former Member
0 Likes
720

Hi Experts,

Could any one provide me the material for selection screen validations

Ex: In selection Initial screen, I have 2 radio buttons. Based on selecting the radio button, the input selection screen should be displayed below the radio buttons?

like these provide me diff examples and also provide me the materials for these

Thanks,

Sanju

7 REPLIES 7
Read only

p291102
Active Contributor
0 Likes
690

Hi,

For validating a selection screen field, u should consider the header table that is a must.

Eg: My selection screen field is marc-matnr.

U have to see whether the matnr in marc is having any check table if so u have to refer the check table not marc.

So to validate this fiedl.

SELECT-OPTIONS: s_matnr LIEK mara-matnr.

AT SELECTION SCREEN ON s_matnr.

IF NOT s_matnr[] IS INITIAL.

select matnr from mara

into mara-matnr

where matnr = s_matnr.

IF sy-subrc NE 0.

MESSAGE i128.

LEAVE LIST-PROCESSING.

ENDIF.

ENDIF.

Hope this solves ur query.

Thanks,

Shankar

Read only

Former Member
0 Likes
690

Try using at selection-screen output .

loop at screen .

make the screen visible.

endloop.

Check the sap help that is best with examples also.

Check transaction DWDM for selection screen examples or ABApdocu.

Please reward if useful.

Read only

Former Member
0 Likes
690

Hi,

Look at the below links

Regards

Sudheer

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
690

Hi

Using at selection-screen on radio button group. you can acheive ur requiremnt.

For ex:

IF radio button 'X' .

SET CURSOR FIELD field name.

MESSAGE E001 WITH TEXT-M02.

modify screen.

ENDIF.

like this.

Regards,

kumar

Read only

Former Member
0 Likes
690

Hi,

Say if the Two radio buttons are R1 and R2:

You can write:

If r1 = 'X'.

loop at screen.

if <Field name> = f1 or F2 ...

.........................

......................

modify screen.

endloop.

Put your cursor on LOOP press F1, it will take you to correct SAP documentation.

You can Modify the fields which you wants to hide based on the selected Radio button.

Regards,

Anji

endif.

Read only

Former Member
0 Likes
690

Hi Sanjana,

U can use the AT SELECTION-SCREEN event to do the necessary validation and checks..so in your case if a particular is mandatory for rd1 and not for rd2..in that case please take out the obligatory clause from the parameter and do the validation in the above event..basically if rd1 is selected and the particular parameter is blank ..display an error message.

check this sample code.

REPORT ztest.

TABLES: mara,vbak.

PARAMETERS: r_m RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND ABC,

r_s RADIOBUTTON GROUP g1.

parameters: p_matnr like mara-matnr,

p_vbeln like vbak-vbeln.

AT SELECTION-SCREEN OUTPUT.

IF r_m = 'X'.

LOOP AT SCREEN.

IF screen-name = 'P_VBELN'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

IF screen-name = 'P_MATNR'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

AT SELECTION-SCREEN.

<b> IF sy-ucomm = 'ONLI'.</b>

IF r_m = 'X'.

IF P_matnr IS INITIAL.

MESSAGE e000(zz) WITH 'error'.

ENDIF.

ENDIF.

ENDIF.

Regards,

Priyanka.<b></b>

Read only

marius_greeff
Active Participant
0 Likes
690

Working Sample, hope this will help you

TABLES: sscrfields.

DATA: wa_kappl LIKE tnapr-kappl,

w_ucomm LIKE sy-ucomm.

===[SELECTION SCREEN]===

SELECTION-SCREEN BEGIN OF BLOCK bl0 WITH FRAME TITLE text-w02.

PARAMETERS: p_smrtf RADIOBUTTON GROUP gr1 DEFAULT 'X'

USER-COMMAND tusr,

p_scrpt RADIOBUTTON GROUP gr1.

SELECT-OPTIONS: s_kappl FOR wa_kappl MODIF ID mg1.

PARAMETERS: p4(10) TYPE c MODIF ID mg1.

SELECTION-SCREEN END OF BLOCK bl0.

===[AT SELECTION SCREEN]===

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF w_ucomm = 'TUSR'.

IF p_smrtf = 'X'.

CASE screen-group1.

WHEN 'MG1'.

screen-active = '1'.

ENDCASE.

ELSE.

CASE screen-group1.

WHEN 'MG1'.

screen-active = '0'.

ENDCASE.

ENDIF.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

CLEAR w_ucomm.

AT SELECTION-SCREEN.

w_ucomm = sscrfields.