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

How to make a field editable again after displaying error msg (validation)

Former Member
0 Likes
4,777

Dear All,

In dialog programming, I have written a validation on a text field that it should not be left blank by the user, but after displaying the message the field becomes gray (non-editable). How can I make it editable once again after displaying the error message.

My code is as following:

----


***INCLUDE MZFBPS1_SAVE_DATAF01 .

----


&----


*& Form save_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM save_data .

****************Check For Empty Fields Start

if ZFBPS_GATE_IN-truck_code is INITIAL

or ZFBPS_GATE_IN-truck_no is INITIAL

or ZFBPS_GATE_IN-transporter_code is INITIAL.

MESSAGE e020(zmatlist).

endif.

****************Check For Empty Fields Start

Regards,

Alok.

Dear All,

In dialog programming, I have written a validation on a text field that it should not be left blank by the user, but after displaying the message the field becomes gray (non-editable). How can I make it editable once again after displaying the error message.

My code is as following:

----


***INCLUDE MZFBPS1_SAVE_DATAF01 .

----


&----


*& Form save_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM save_data .

****************Check For Empty Fields Start

if ZFBPS_GATE_IN-truck_code is INITIAL

or ZFBPS_GATE_IN-truck_no is INITIAL

or ZFBPS_GATE_IN-transporter_code is INITIAL.

MESSAGE e020(zmatlist).

endif.

****************Check For Empty Fields Start

Regards,

Alok.

6 REPLIES 6
Read only

dani_mn
Active Contributor
0 Likes
1,589

HI,

you need to through error in the 'FIELD' module in this way field will be available for entry.

*write this in PAI flow logic and create the module in your program.

FIELD: ZFBPS_GATE_IN-truck_code

MODULE process_truckcode ON REQUEST.

*In screen program.

MODULE process_truckcode INPUT.

IF ZFBPS_GATE_IN-truck_code IS INITIAL.

MESSAGE e000(SU) with 'please enter value'.

ENDIF.

ENDMODULE.

Regards,

Read only

anversha_s
Active Contributor
0 Likes
1,589

hi,

u can do it in chanin end chain.

For example if there are 10 fields in the screen and for 5 fields whenever the user enters wrong values u like to give some error message. You can declare that fields in the chain enchain so that only those fields will be input enabled and all other fields will disabled.

CHAIN.
FIELD chk_connobj.
FIELD chk_inst.
FIELD chk_devloc.
FIELD ehaud-haus.
FIELD eanl-anlage.
MODULE modify_screenfields.
ENDCHAIN.
 
*&---------------------------------------------------------------------*
*& Module modify_screenfields INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
 
MODULE modify_screenfields INPUT.
CLEAR okcode.
okcode = sy-ucomm.
CASE okcode.
WHEN 'ENTER' OR 'EXECUTE'.
 
IF chk_connobj IS INITIAL AND chk_inst EQ c_x AND
chk_devloc EQ c_x.      -----------> ur condition
IF ehaud-haus IS INITIAL.
SET CURSOR FIELD 'EHAUD-HAUS'.
MESSAGE e000(zo_spa) WITH text-017. " message obj
ELSE

loop at screen.
if screen-name = 'FIELD_NAME'.
field-name-input = 1. -----------> chnges to non-edit mod
modify screen.
endloop.
ENDIF.
ENDIF.
 
ENDMODULE. 

Rgds

Anver

if hlped pls mark points

Read only

Former Member
0 Likes
1,589

Hi ALok,

Try giving warning message to validate, message w000.

regards,

keerthi

Read only

Clemenss
Active Contributor
0 Likes
1,589

Alok,

if the form is called in the PAI of the screen, the E msg automatically returns to the screen and the field is editable as before.

For validation of three fields, better enclode the parameters within a block

selection screen begin of block truck.

parameters:

p_trkcod type ZFBPS_GATE_IN-truck_code,

p_trknum type ZFBPS_GATE_IN-truck_no,

p_tracod type ZFBPS_GATE_IN-transporter_code.

selection screen end of block truck.

and then use event

AT selection-screen on Block truck.

perform save_data. "Although this name is confusing and the contents must be adapted

If error message is issued, only this block's will be coloured red and open for input.

Regards,

Clemens

Read only

Former Member
0 Likes
1,589

hi alok,

try putting in <b>Chain and Endchain</b>.

Regards,

Priya.

Read only

Former Member
0 Likes
1,589

In the flow logic of ur screen write the below code

Chain.

Field:ZFBPS_GATE_IN-truck_code ,

ZFBPS_GATE_IN-truck_no,

ZFBPS_GATE_IN-transporter_code .

Endchain.

This will make your fields input-enabled even when u throw a error mess.