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

Field validation in Table control

Former Member
0 Likes
3,784

Hi,

In table control, if a particular condition is not met for a field Iam raising a error message.

But, thw whole table control fielda are grayed out. Iam not able to make changes .

How can I make the field editable in table control even after error message is raised..

Below is my code.

process after input.

loop with control items.

module read_table_control.

endloop.

module user_command_0110.

module read_table_control input.

lines = sy-loopc.

if vbap-netpr lt zcom.

message w013(xxx) with 'Error'.

else.

modify it_control from vbap index items-current_line.

endif.

endmodule.

Pls help me...

Waiting for ur replies.

Thanks,

Shivaa..

6 REPLIES 6
Read only

Former Member
0 Likes
1,306

try to use your error message as below.

message w013(xxx) with 'Error' display like 'I'.

hope it works..

Read only

Former Member
0 Likes
1,306

Inside you loop on the control items, use the command:

FIELD <fieldname> MODULE <field module>.

Read only

Former Member
0 Likes
1,306

Hi Shivaa,

IN PAI;

LOOP AT control items.

CHAIN.

FIELD vbap-netpr

MODULE validate ON REQUEST.

MODULE modify_tbl ON CHAIN-REQUEST.

ENDCHAIN.

ENDLOOP.

And then double click on module validate write below code:

MODULE validate INPUT.

if vbap-netpr lt zcom.

message w013(xxx) with 'Error'.

endif..

ENDMODULE.

And then double click on module modify write below code:

MODULE modify_tbl INPUT.

MODIFY it_control from vbap index items-current_line.

ENDMODULE.

Hope it may help you.

Regards,

Supriya.

Edited by: Supriya Bhatt on Jul 13, 2009 3:22 PM

Read only

Former Member
0 Likes
1,306

Dear Shiva,

Following is the code for your purpose

process after input.

loop with control items.
field netpr module read_table_control.
endloop.
module user_command_0110.

module read_table_control input.
if vbap-netpr lt zcom.
message w013(xxx) with 'Error'.
else.
modify it_control from vbap index items-current_line.
endif.
endmodule.

Regards

Sajid

Edited by: shaik sajid on Jul 13, 2009 2:31 PM

Read only

Former Member
0 Likes
1,306

Hi SHiva Prasad,

see the sample code ..


PROCESS AFTER INPUT.
* Module Screen Exit and Cancel Operation
  MODULE exit_screen_1020 AT EXIT-COMMAND.


* Table control for OUTPUT
  LOOP AT t_zcxref_classes .
    CHAIN.
      FIELD wa_zcxref_classes-atwrt.                   "Add your Field which you are validating
      MODULE read_table_control.                         "Module for Validation
    ENDCHAIN.
  ENDLOOP.

MODULE read_table_control INPUT.

* Modifying Table control values from  screen into Internal table
"reading Current Line 
  w_lines = sy-loopc.
  w_idx = sy-stepl + w_line.

  if vbap-netpr lt zcom.
   message w013(xxx) with 'Error'.
 endif. 

 modify it_control from vbap index items-current_line.

ENDMODULE.                 " read_table_control


Prabhudas

Read only

Former Member
0 Likes
1,306

Hi Prasad ,

use the syntax: field <filedname> module<module_name>.

kindly chk the following link..

http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabbd35c111d1829f0000e829fbfe/frameset.htm

Regards