arunkw
14th August 2002, 14:58
How do I Insert into main table of the session
as i have to keep insert button of the session disable
what i am getting is that my current record of the main table
is updated, where as i want new record to be inserted and not updated.
klesch
14th August 2002, 15:00
db.insert() doesn't work?
jvenderb
16th August 2002, 11:01
Can you give the code of your insert action?
nick_rogers
16th August 2002, 15:51
use the skip.io on the before re-write section to not modify the current record of the main table, then call a function that creates a new record (be sure to declare the maintable in the function)
ie:
Main table is tiitm001
Before.rewrite:
skip.io("")
insert.tiitm001()
Function insert.titim001()
{
table ttiitm001
sql code to insert new rcord
}
lbencic
16th August 2002, 21:26
Try the
execute(add.set)
command. It is the same as choosing the 'insert' button on the form, and calls the standard program sections for that action. The user should be able to insert at that point. Depending on which section, that should work for you. I am only not sure if the supression of this on a form level stops the standard program from executing it if you call it, but I don't think so.
Check the manual for the execute(..) command for which sections.
If all you want is sql to insert into it, you may just be having a problem on the sections/db.retry points/commits. What errors are you getting if you try to execute the sql there?
Good luck
manusatsangi
28th August 2002, 09:47
Hi,
Even I am facing a similar problem. I have a main session and a sub session (both having different tables). Sub session is sort of an extension to the main session.
After I maintain a record in main session and open the sub session to maintain the extension data. I want that if the extension data is not already maintained, the subsession should open in a 'insert record' mode and if the data is found, it should open in update mode.
The problem encountering is that if the first of the above condition is encountered, it does not open in insert mode but shows the last record of the table corresponding to the sub-session.
The code I wrote in the sub-session (Modal Child Dialog) is
****************************
before.program:
select ppmmm999.* from ppmmm999
where ppmmm999._index1 = {imported variables from main session}
selectdo
selectempty
execute(insert)
endselect
******************************
On encountering the statement execute(insert), error encountered is message code ttstps0129 "No authorization for table"
Can you help me solve the problem
Warm Regards
Manu
manusatsangi
28th August 2002, 09:52
Oops.... I got the error message wrong in the last message..
It read "No insert authorization for table"
Regards
Manu
NPRao
28th August 2002, 11:09
Manu,
I guess your user id does not have the table authorizations based on your role data.
You might be a normal user. You might need to talk to your BaaN administrator to give you "insert/delete/modify/read" authorizations on the company/tables.
OmeLuuk
28th August 2002, 11:31
Check out this function:
void ON.MAIN.TABLE( function_name [, ...] )
DESCRIPTION
The function ON.MAIN.TABLE copies the contents of the fields to the record buffer of the main table, saves the record buffer and executes the specified function. After that the saved record buffer is restored and the contents are copied to the fields of the table.
The specified function must be of type void and may have arguments, which can be specified separated by commas.
This function has no special effect in programs of type 4 because no main table is specified.
arunkw
12th September 2002, 18:33
Got it thanks guys
Actually my mistake i did not see what was my start option of the session it was set to find and thats the reason it was not allowin g me to Insert new record
and After i changed it to insert it allowed me to insert new records
thanks anyway
bye:)