pundlik_girl
15th August 2017, 13:46
Hi,
I want to basically re-write the logic of session ttaad4231m000 - Delete tables but without actually deleting the tables.
my idea is to start with table ttadv112 - pvrc by package combination
then use the pacc to find the company in ttaad100.
and then check if the table to attached to the company.
the standard program uses - DLL ttdllvrcsearch & baan function ttadv0052
to search which vrc the table actually exists in
and then to check if that VRC is present in the package combination linked to the company.
does anybody have the source code of the tt program script, dll or function?
or
has anyone developed such a functionality?
please let me know ...
thanks
mark_h
15th August 2017, 15:03
Doubt anyone has the source, but you can typically see how to call the routines using bic_info. As for one I wrote something once but we never used it - including some of the relevant code - not sure it will help and have not looked at it in years(looks like it is from 2004:)) The top two routines were in a select statement on ttadv422 and this is on 4c4 - so not how much that might matter.
| Get starting VRC for each table. Using users current package/vrc.
get_current_pvrc()
| Search VRC will return true when the curr fields point to the lastest
| VRC for the table.
rc = 0
while rc = 0 and strip$(curr.tver(1,1)) <> ""
rc = vrc_search_table(ttadv422.cpac,ttadv422.cmod,ttadv422.flno,
tdep,curr.tver,curr.trel,curr.tcus)
if rc = 0 then
get_parent_pvrc()
endif
endwhile
|******************************************************************************
| Used to get the users current VRC. You always want to start in that VRC.
|******************************************************************************
function get_current_pvrc()
{
select ttadv040.*
from ttadv040
where ttadv040.user = :logname$
and ttadv040._compnr = 0
as set with 1 rows
selectdo
endselect
curr.tver(1,1) = ttadv040.vers
curr.trel(1,1) = ttadv040.rele
curr.tcus(1,1) = ttadv040.cust
}
|******************************************************************************
| Used to get the "derived from" VRC for a given VRC.
|******************************************************************************
function get_parent_pvrc()
{
domain ttadv.vers tver
domain ttadv.rele trel
domain ttadv.cust tcus
tver = curr.tver(1,1)
trel = curr.trel(1,1)
tcus = curr.tcus(1,1)
select ttadv111.*
from ttadv111
where ttadv111._index1 = {:ttadv422.cpac,:tver,:trel,:tcus}
and ttadv111._compnr = 0
as set with 1 rows
selectdo
curr.tver(1,1) = ttadv111.vedf
curr.trel(1,1) = ttadv111.redf
curr.tcus(1,1) = ttadv111.cudf
selectempty
curr.tver(1,1) = ""
endselect
}
Ajesh
16th August 2017, 11:03
Well you could use , db.drop.table
db.drop.table()
Syntax:
function long db.drop.table (long table_id [, long flag] [, long comp_nr])
Description
This deletes a specified table. Data and indices associated with the table are also deleted. Reference counters are automatically updated.
Note that this function cannot be used within a transaction; see Transaction handling.
Arguments
long table_id The table ID, as returned by db.bind().
[long flag] If you set this optional argument to DB.IGNORE.ALL.REFS, the data is deleted regardless of whether it is referenced by other tables. WARNING: if you don't need this behaviour, please leave out the argument completetly. Never supply another value than DB.IGNORE.ALL.REFS to this argument.
[long comp_nr] This optional argument specifies a company number for the table. The default company is the company of the user.
Return values
0 Success.
<>0 Error.
Context
This function is implemented in the porting set and can be used in all script types.
But i would suggest consulting the Baan or the system administrator before using this. Dropping a Table is a big decision.