Application Development 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: 

How to edit table control field values at column level not at row level.

Former Member
0 Kudos
147

How to edit table control field values at column level <u>not at row level</u>.

I know we can do row level validation by

LOOP AT i_tab.

CHAIN.

FIELD wa_tab-c2.

MODULE CHECK_VALUE.

ENDCHAIN.

ENDLOOP.

My requirement is I have two columns c1 and c2 in my table control. Column c1 is fixed label and column c2 (value) will be enter by user. After user value entry, all value will be added and the total of column c2 (value) should be 100, if it is not 100 an error message will be displayed and the user can re-enter column c2 (value) values accordingly. I need to display whole c2 column fields editable.

Any one faced similar kind of requirement and any solution?

<b></b>

5 REPLIES 5

Former Member
0 Kudos
83

Remove the keywords CHAIN and ENDCHAIN.

LOOP AT i_tab.

FIELD wa_tab-c2.

MODULE CHECK_VALUE.

ENDLOOP.

And issue the error message in the Module CHECK_VALUE.

-Kiran

Former Member
0 Kudos
83

Hello KD,

remove the CHAIN and ENDCHAIN

LOOP AT i_tab.

FIELD itab-c2 MODULE CHECK_VALUE.

ENDLOOP.

MODULE CHECK_VALUE.

sum.

if itab-c2 GE 100.

error message.

exit.

endif.

ENDMODULE CHECK_VALUE.

Try like this.

If useful reward points.

Vasanth

0 Kudos
83

Hello Vasanth,

Sorry if my post is not explain in detail. My requirement is not to validate field for 100.

I need to add(sum) all the records in c2 column and compare with 100. If this is not equal to 100, the error message should be thrown and whole table column should be editable.

For example

C1 C2

Aaa 23

Bbb 43

Ccc 12

Sum of C2 => 78 => throw error and allow C2 column fields editable

Former Member
0 Kudos
83

Hai,

LOOP AT g_t_final.

MODULE modifydata_to_table.

ENDLOOP.

MODULE modifydata_to_table INPUT.

MODIFY g_t_final INDEX tbctrl-current_line.

ENDLOOP.

After modifying sum the column c2 inside the module modifydata.

Then check if the sum is equal to 100.

if it is not throw the error message.

Reward if helpful.

Regards,

Umasankar

0 Kudos
83

Hello Uma,

We can throw an error message based on total value. However the table control field can not be editable. any other solution..