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: 

Table Control in Module Pool

Former Member
0 Kudos

hi all,

i have a table control having 1 field VALUE.

below table control there is one field TOTAL VALUE.

requirement is when user presses ENTER after entering VALUE in row of table control then SUM of VALUE should be shown in TOTAL VALUE. If user deletes VALUE from any row of table control then TOTAL VALUE will be SUM of remaining rows' VALUE and error message will come with cursor at the blank VALUE.

plz help.

rgds,

Avijit

8 REPLIES 8

Former Member
0 Kudos

In your PBO routine, perform a module that loops thru the table and sums the VALUE fields into your TOTAL VALUE Field.

Be sure to clear the TOTAL VALUE field before you start summing.

Former Member
0 Kudos

hi,

At the PBO of your screen containing the table control ,

you can write a module containg the logic of calculating the total.

for e.g.

Say your field f1 is the field which you want to calculate the total.

say the internal table is itab . the field which will hold the value of total is v_tot.

module do_total.

clear v_tot.

loop at itab.

v_tot = v_tot + itab-f1.

endloop.

endmodule.

Former Member
0 Kudos

Hi Avijit,

According to your requirement, you have to catch the Ok Code for the 'ENTER'. The ok code for the enter is 'ENTE'.

Now once you have the ok code you can now write a module where you can loop at the global internal table of the code. As that is the table which is used to create to form the Table Control you have all the data available.

Loop the global Table.

variable = variable + work_area-value_field.

clear work_area.

endloop.

also here you can put the check that if the field is blank you can display an Error message.

Hope this will help.

Regards,

Samantak Chatterjee.

Rewards points for useful answers.

0 Kudos

hi all,

thnks 4 ur comments. till now d problem isn't resolved.

my requirement is :

modify one separate field (TOTAL) in PAI at the time when validation fails 4 the field of table control (VALUE) and cursor will b at d erroneous VALUE field and one ERROR msg will b shown below.

plz help.

rgds,

Avijit

0 Kudos

Don't issue an error message. Instead issue an information message and set a flag which you will check on all subsequent bits of code to prevent them running - apart from the code that refreshes the total which you will run. Doing this will have the same effect as issuing an error message ie not running any of the subsequent code that shouldn't be run if a validation check has failed but you will still be free to do some of the things that you should do after a validation failure eg moving the cursor to the error field.

0 Kudos

It posted the same thing twice.

Edited by: Christine Evans on Jun 10, 2008 1:04 PM

0 Kudos

hi evans,

the requirement is to show ERROR msg. plz help.

rgds,

Avijit

0 Kudos

Well, if you wish, you can include the word ERROR in your message to emphasise the fact that it is an error while still keeping the message type as information. The purpose of an error message is to prevent any of the subsequent processing from running that shouldn't run if there is an error; and so long as you do this I do not see that it matters much whether your message type is an error or a warning or information.

SAP error message processing is much too restrictive and, so far as user dialog screens are concerned, I gave up using them ages ago. If you insist on keeping the message as an error, then you're just going to have to live with these restrictions.