‎2007 Mar 09 12:59 PM
Hi,
I have a zcustom table with 5 fields --
f1--Pri Key
f2--Pri Key
f3
f4
f5
We will enter values into first four fields.
The idea is that when we enter data (in SE11) into the table, F5 field will display as disabled and we will enter data to first four flds and then save it. At that instance it should show the value in F5 as the sum of f3 and f4 automatically and will update the value to database.
how we ll achieve it?
‎2007 Mar 09 1:01 PM
‎2007 Mar 09 1:02 PM
Hi!
Do not store calculated fields, it is unneccessary.
If you wanted it, you have to create a small dialog to maintain the Z table, because there is no automated calculations in SE11, nor in SM30.
Regards
Tamá
‎2007 Mar 09 1:29 PM
Hi Sam ,
What you can do is first create function group (for that go to SE37 transaction ,inside that GOTO thre you can find Function Groups ,then create group) after creating function group create your Ztable while creating assign it with Function Groups in technical settings, So that Table maintanence can be done using SM30 ..
Now for inserting data to a table(ztable) you can insert in two ways
1. Using SM30 table maintanence .
2. You can write a dialog Program to insert data here you can do computation also for f5. instead of storing computed value in Ztable try to store in internal table only . in this way you can reduce the load on database also .
Reward points if helpful .
Regards,
Amber
‎2007 Mar 09 2:10 PM
‎2007 Apr 03 7:48 PM
Hi
I doubt if u can do it directly....
The Screen we get in SE11 is an automatically generated one, and hence we cannot make any changes to it. and your requirement can only be fulfilled if u come up with a screen of your own for this purpose........
Hope this guides u
Reward points if usefu;
Regards
‎2007 Mar 09 1:30 PM
‎2007 Apr 03 8:22 PM
I believe you can use events for table maintenance. Transaction <b>SE54</b>
‎2007 Apr 03 8:36 PM
Create a maintenance view for this table and hide the fifth column. Generate the table maintenance for this view and then go to SE54, enter the view, in the menu "Environment-->Events". Click through the pop-up message and you will see a table control. Enter '01' in the first column (Table maintenance dialog event) and enter a routine name (something like FILL_XXXX_FIELD) and save it. Now you will see the editor icon come up in the third column. Click on it and create the routine in the same function group as that of your table maintenance. In the code for the routine, have the code as below.
DATA: l_index LIKE sy-tabix.
DATA: BEGIN OF ls_zmytable.
INCLUDE STRUCTURE zmytable.
DATA: action TYPE c,
mark TYPE c.
DATA: END OF ls_zmytable.
LOOP AT total.
CLEAR: ls_zmytable.
ls_zmytable = total.
CASE <action>.
WHEN neuer_eintrag OR aendern.
*-- New entry or changed entry, update the fifth field
ls_zmytable-field5 = ls_zmytable-field3 + ls_zmytable-field4.
READ TABLE extract WITH KEY <vim_xtotal_key>.
IF sy-subrc EQ 0.
l_index = sy-tabix.
ELSE.
CLEAR l_index.
ENDIF.
*-- make desired changes to the line total
total = ls_zmytable.
MODIFY total.
CHECK l_index GT 0.
extract = total.
MODIFY extract INDEX l_index.
WHEN geloescht.
*-- flagged for deletion
WHEN update_geloescht.
*-- entry first changed and then flagged for deletion
WHEN neuer_geloescht.
*-- entry first newly created, not yet saved, and then flagged for
* deletion
WHEN original.
*-- the same as the database status
ENDCASE.
ENDLOOP.