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

Error message disble the Fields in Selection Screen

Former Member
0 Likes
6,907

Hi,

In my Report i am validating some fields as mandatory.

If the field is initial then one Error message should be display in the screen and user has to modify the selection screen.

But after displaying the errro message my selection screen is input disable except the mandatory field.

I want all the fields should be input enable.

Sample code for Error message,

MESSAGE E018 WITH 'Enter Plant'.

Please provide the code for this.

23 REPLIES 23
Read only

Former Member
0 Likes
3,709

Hi Anil,

try this.

Messages 'Enter plant ' type 'I'.

leave list-processing.

Regards,

Vijay

Read only

0 Likes
3,709

Hi vijay,

After displying the Message Screen goes to report output.

its not stop in the Selection Screen.

Read only

0 Likes
3,709

Hello Anil ,

i think you are validating your field in start-of -selection Event ....

if yes than validate it in side the AT SELECTION-SCREEN event .

Thanks and Regards ...

Priyank

Read only

0 Likes
3,709

Hi,

I am doing this validation in AT SELECTION SCREEN ON < Field> only.

But i am not able to stop program in Seclection Sctreen if i used the Messsage type as ' i '.

Read only

0 Likes
3,709

Hi Anil ,

if you want to stop further processing ....either you you Error type message ....

or if you want to you Type I message than ...code like below ..

Data : v_flag type c .

At selection-Screen .

clear : v_flag .

write your code for validating ..with message .

v_flag = '1' .

Stop .

and than it will go to the End-of-selection .

End-of-selection .

if v_flag = '1'.

STOP .

endif .

thanks and Regards ..

Priyank

Read only

0 Likes
3,709

Hi Anil ,

This Code is working Perfectly ..

REPORT ZPRI_TESTLDB.

data: v_flag type c .

PARAMETERS: var1 type sy-datum .

AT SELECTION-SCREEN .

if var1 is INITIAL .

MESSAGE 'Blank' TYPE 'I' .

V_flag = '1' .

Stop .

endif.

write: 'Hello' .

end-of-SELECTION .

if v_flag = '1' .

stop .

endif.

Thanks and Regards ..

Priyank

Read only

0 Likes
3,709

Hi Anil again,

I think you should use AT SELECTION SCREEN OUTPUT

and not AT SELECTION SCREEN ON < Field>

Do your validation under this event.

I am sure this will solve your problem.

Regards,

Vijay

Read only

0 Likes
3,709

Vihjay, did you actually try this : When starting the report, data is initial, so error is issued in PBO => you get a popup on a partially written screen, and the report is stopped, back to menu...

Look at [Messages in dialog processing |http://help.sap.com/abapdocu/en/ABENABAP_MESSAGE_DIALOG.htm], in PBO/ AT SELECTION-SCREEN-OUPUT the message is converted to a Abort message, popup and program termibnated.

Try, change the code i provided, replace AT SELECTION-SCREEN ON BLOCK dum, with AT SELECTION-SCREEN OUTPUT and see.

Regards,

Raymond.

Read only

Former Member
0 Likes
3,709

Hi,

This si simple rather tahn using the message type as 'E' use as "I" mooreover if is the failure from the database fetchung the message type can be 'S'

This will solve your problem

Pooja

Read only

Former Member
0 Likes
3,709

Hi,

Please check if the code is written in the at selection-screen event. If not please try the same. Else provide the code that you have written and under which event.

Regards,

Sachin

Read only

Former Member
0 Likes
3,709

Hey,

u can use Obligatory addition while defining the screen.

e.g. PARAMETERS : P_WERKS TYPE WERKS_D OBLIGATORY .

System will itself validate the entry.

Read only

Former Member
0 Likes
3,709

Hi,

Try using message type 'W' or type 'I' in place of 'E',

because error message disables the input

fields. or,

Take the input fields as obligatory in your

code and dont use any message type with

those fields, the obligatory keyword throws

error message itself and does not disables the input

fields also.

Hope it helps

Regards

Mansi

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
3,709

have use used at selection-screen on.

if so try with

at selection-screen.

Read only

Former Member
0 Likes
3,709

Hi,

Use information message instead of Error message

parameter: p_plant(20) type c.

if p_plant is initial.

MESSAGE 'Enter Plant' type 'I'.

endif.

i

Thanks &regards

Ashu Singh

Read only

former_member585060
Active Contributor
0 Likes
3,709

Hi,

Do as below,

1) Remove the OBLIGATORY option of the field.

2) For mandatory filling do the validation in AT SELECTION-SCREEN ON field for INITIAL

3) Give the message as I type.

Sample code

PARAMETERS : p_matnr TYPE mara-matnr,
             strt_dat ,
             end_dat ,
             emp_id,
             emp_name,
             location,
             usage.

DATA : w_matnr TYPE mara-matnr.

AT SELECTION-SCREEN ON p_matnr.
  IF p_matnr IS INITIAL.                                                    " This makes the field a mandatory
    MESSAGE 'Enter material ' TYPE 'I'.
  ELSE.
    SELECT SINGLE matnr FROM mara INTO w_matnr
          WHERE matnr = p_matnr.
    IF sy-dbcnt = 0.
      MESSAGE 'Not a Valid Material ' TYPE 'I'.

    ENDIF.
  ENDIF.

START-OF-SELECTION.

Regards

Bala Krishna

Edited by: Bala Krishna on Jul 7, 2009 3:53 PM

Read only

0 Likes
3,709

Hi,

Screen goes to Report outout.

My controll should be in Selection screen only........

Read only

0 Likes
3,709

Hi anil again,

Did you try this.

IF sy-dbcnt = 0.

MESSAGE 'Not a Valid Material ' TYPE 'I'.

Leave List-processing.

ENDIF.

Regards,

Vijay

Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,709

Performing checks on SELECTION-SCREEN

- if the check uses only one independent field (e.g.: value exist in a table) use a[ AT SELECTION-SCREEN ON <field>|http://help.sap.com/abapdocu/en/ABAPAT_SELECTION-SCREEN_EVENTS.htm#!ABAP_ALTERNATIVE_2@2@], the field will be editable when error is raised

- if the check uses some fields, group them using [SELECTION-SCREEN BEGIN OF BLOCK <block>/END OF BLOCK <block>|http://help.sap.com/abapdocu/en/ABAPSELECTION-SCREEN_BLOCK.htm] and then [AT SELECTION-SCREEN ON BLOCK <block>|http://help.sap.com/abapdocu/en/ABAPAT_SELECTION-SCREEN_EVENTS.htm#!ABAP_ALTERNATIVE_4@4@], each field of the block will be editable when error is raised

So, if you really want that each and every field be editable when an error is raised, declare every parameter and select-options in a big block, and perform the check in a unique AT SELECTION-SCREEN ON BLOCK xxx.

Use Error message, Warning and Information don't break the flow of the report.

Regards,

Raymond

Read only

0 Likes
3,709

Hi,

I am writing code in the AT SELECTION SCREEN ON <fIELD> only.

But i am not able to see the fields in input enable.

Please provide the solution ASAP.

Read only

0 Likes
3,709

If you use the "big block solution", you will have to manage the CURSOR yourself to indicate the user which field is in an error state.

Regards,

Raymond

Read only

0 Likes
3,709

If you don't manage to find, a little sample.

 REPORT z_test_block.

SELECTION-SCREEN BEGIN OF BLOCK dum. " dummy block
PARAMETER a(10).
PARAMETER b(5).
SELECTION-SCREEN END   OF BLOCK dum.

AT SELECTION-SCREEN ON BLOCK dum.
  IF a IS INITIAL.
    SET CURSOR FIELD 'A'.
    MESSAGE e020(kf) WITH 'A'.
  ENDIF.
  IF b IS INITIAL.
    SET CURSOR FIELD 'B'.
    MESSAGE e020(kf) WITH 'B'.
  ENDIF.

START-OF-SELECTION.
  WRITE: / 'report started'.

Regards,

Raymond

Read only

Former Member
0 Likes
3,709

HI Anil ,

Where you are validating your field (in which Event ) ?

Thanks and Regrds ..

Priyank

Read only

Former Member
0 Likes
3,709

u can display the error message like success

so that i will be displayed in the selection screen itself

and it wont disable the the fields

display e(XXX) like s

it will work for sure

cheers

s.janagar