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: 

Selection screen fields in SAP Query

Former Member
0 Kudos
3,540

HI friends,

I have to make the seletion screen field as mandatory in SAP-Query.

Please let me know the procedure to make field as mandatory or Let me know how to validate the selection-screen field in Query.

Thanks in Advance,

Ravi

1 ACCEPTED SOLUTION

Former Member
0 Kudos
1,479

Hi,

U can write:

select-options : field like type OBLIGATORY

This will make field mandatory.

5 REPLIES 5

Former Member
0 Kudos
1,479

report ztest message-id zmsg.

tables :mara .

select-options:s_matnr for mara-matnr .

data: v_matnr like mara-matnr.

at selection-screen.

select matnr from mara into v_matnr where matnr in s_matnr.

if sy-subrc ne 0.

message e000 with 'enter a valid material number'.

endif.

Former Member
0 Kudos
1,480

Hi,

U can write:

select-options : field like type OBLIGATORY

This will make field mandatory.

Former Member
0 Kudos
1,479

To make a field mandatory in Sap query (SQ01) create a variant and in that variant make the field as required field (set the check box Required field). Use this variant whenever u execute the query.

Regards,

Joy.

0 Kudos
1,479

Go to SQ02

Select your Infoset-->Change

On next Screen.

Select GoTo->Code->Initialization.

Write there code

LOOP AT SCREEN.
  IF screen-name EQ 'SP$00004'.
       screen-required = 1.
       MODIFY SCREEN.
  ENDIF.
ENDLOOP.

jim_donahue
Explorer
0 Kudos
1,205

Thank you, this works, however it removes SELECTION BLOCKS. Which the users do not like.
I'm working on another solution. If you have an enhancement to this process, please share. I will share when the solution is found.