Files
d.velop/Assmann/Assmann_RM.jpl
2024-06-17 16:49:41 +02:00

714 lines
20 KiB
Plaintext

// #####################################################################################
//
// d.link for Microsoft Dynamics Nav 3.0
//
// Raber+Märcker GmbH - 5.3.10
//
// #####################################################################################
global vars h_NavOdbcSource
h_NavOdbcSource = "ERP"
// doc-dat-field numbers
global vars h_DDF_SQUOTENO = 22 // sales quote number
global vars h_DDF_SORDERNO = 2 // sales order numbers
global vars h_DDF_BARCODE = 6
global vars h_DDF_DTTEMP = 47
global vars h_DDF_COMPANY = 0
// document types for folder links
global vars h_DT_SOCONF = "dakb" // order confirmation
global vars h_EditUser = "RM"
global vars h_UpdateAttributes = 1
vars h_ARRAY_MAX = 100
// #####################################################################################
// hook_insert_entry_10_ass
// #####################################################################################
proc hook_insert_entry_05_ass(h_User, h_DocType)
{
if ( h_DocType == "dkoak" )
{
vars ergebnis
ergebnis = api_function( "string_split", dok_dat_feld[ 32 ], "--" )
dok_dat_feld[ 32 ] = api_splitted_string[ 1 ]
zeich_nr = dok_dat_feld[ 32 ]
call xlog( 5, "zeich_nr " ## zeich_nr )
call xlog( 5, "dok_dat_feld_32 " ## dok_dat_feld[ 32 ] )
}
}
proc hook_insert_entry_10_ass(h_User, h_DocType)
{
vars lReturnValue
lReturnValue = InsertEntry10( h_User, h_DocType )
if( lReturnValue != 0 )
{
return lReturnValue
}
// eingefügt von calb/d.OS am 2012.11.08
vars vorhandene_doku_id, vorhandenes_datum, anzahl_treffer, kampagne, v_dok_dat_feld_51
if ( h_DocType == "ddab" )
{
// Feststellen, ob das Dokument bereits im System vorhanden ist
dbms alias vorhandene_doku_id, v_dok_dat_feld_51
dbms sql select doku_id, dok_dat_feld_51 from firmen_spezifisch where dok_dat_feld_2 = :+dok_dat_feld[2] and kue_dokuart = 'ddab'
anzahl_treffer = @dmrowcount
dbms alias
if ( anzahl_treffer == 0 )
{
// Das Dokument existiert noch nicht im System
call xlog( 4, "Das Dokument mit der Nummer :dok_dat_feld[2] existiert noch nicht im System. " )
dbms declare ta_session connection for user 'Master' password 'geheim' datasource 'D3P'
dbms with connection ta_session alias vorhandenes_datum, kampagne
dbms with connection ta_session sql select beleg_dat, kampagne from as_ab_import where auftrags_nr = :+dok_dat_feld[2]
anzahl_treffer = @dmrowcount
dbms with connection ta_session alias
call xlog( 5, "Anzahl Treffer: <:anzahl_treffer> neues Datum: <:vorhandenes_datum> Kampagne: <:kampagne> Auftrags-Nr. <:dok_dat_feld[2]> " )
dok_dat_feld[51] = vorhandenes_datum
dok_dat_feld_60[1] = kampagne
}
else if ( anzahl_treffer > 0 )
{
// Das Dokument existiert schon im System
call xlog( 3, "Das Dokument mit der Nummer :dok_dat_feld[2] existiert bereits im System mit der Doku-ID <:vorhandene_doku_id> und dem Beleg-Datum <:v_dok_dat_feld_51>. " )
dbms declare ta_session connection for user 'Master' password 'geheim' datasource 'D3P'
dbms with connection ta_session alias vorhandenes_datum, kampagne
dbms with connection ta_session sql select beleg_dat, kampagne from as_ab_import where auftrags_nr = :+dok_dat_feld[2] and beleg_dat > v_dok_dat_feld_51
anzahl_treffer = @dmrowcount
dbms with connection ta_session alias
if ( anzahl_treffer > 0 )
{
// Es wurde ein entsprechender Datensatz gefunden
dok_dat_feld[51] = vorhandenes_datum
dok_dat_feld_60[1] = kampagne
call xlog( 5, "Anzahl Treffer: <:anzahl_treffer> neues Datum: <:vorhandenes_datum> Kampagne: <:kampagne> Auftrags-Nr. <:dok_dat_feld[2]> " )
}
else if ( anzahl_treffer == 0 )
{
// Es wurde keiner gefunden
// Dokument wird abgelehnt
call xlog( 2, "1 Es ist ein Fehler aufgetreten: :anzahl_treffer " )
return -202
}
else
{
// Es ist ein Fehler aufgetreten
call xlog( 2, "2 Es ist ein Fehler aufgetreten: :anzahl_treffer " )
return -203
}
}
else
{
// Es ist ein Fehler aufgetreten
call xlog( 2, "3 Es ist ein Fehler aufgetreten: :anzahl_treffer " )
return -201
}
}
// Ende Einfügung calb/d.OS am 2012.11.08
// eingefügt von calb/d.OS am 2013.02.04
// Import von Konstruktionszeichnungen aus IMOS
vars bauteilart, materialart, orientierung, programm, ppsnummer, barcode, anzahl_treffer, info1, info2, info3, info4, anschlag, ergebnis
if ( h_DocType == "dkoak" )
{
// Setzen der zeich_nr und Aufsplitten des Barcodes in insert_entry_05 ausgelagert
// calb/d.velop AG
// dbms declare ta_session connection for user 'ASSMANN\\DB-connect-IMOS-D3' password 'QK+NE}qj=)q=' datasource 'IMOS-DB-Prod'
dbms declare ta_session connection for user 'sa' password 'aPFb4eNyZT57T' datasource 'IMOS-DB'
// orientierung ANSCHLAG
dbms with connection ta_session alias bauteilart, materialart, programm, ppsnummer, barcode, info2, info3, info4, anschlag
dbms with connection ta_session sql select PARTTYPE, MATCAT, PROGRAMM, INFO1, BARCODE, INFO2, INFO3, INFO4, ANSCHLAG from IDBEXT where BARCODE = :+dok_dat_feld[ 32 ]
anzahl_treffer = @dmrowcount
dbms with connection ta_session alias
dbms close connection ta_session
if ( anzahl_treffer == 0 )
{
call xlog( 3, "Konstruktionszeichnungen: Achtung: Keine Treffer gefunden! " )
// return-Statement auskommentiert von calb, 2015.12.10
// weil: es sollen auch manuell Konstruktionszeichnungen importiert werden können, zu denen es keinen DB-Eintrag gibt.
//return -1012
}
else
{
ergebnis = api_function( "string_cut_leading_char", anschlag, " " )
if ( ergebnis >= 0 )
{
anschlag = api_converted_string
}
else
{
call xlog( 2, "Konstruktionszeichnungen: Achtung: Fehler beim Entfernen von Leerzeichen im Attribut 'Anschlag'!" )
return -1001
}
if ( bauteilart == "1" )
{
dok_dat_feld[ 8 ] = "Seiten"
}
if ( bauteilart == "3" )
{
dok_dat_feld[ 8 ] = "Einlegeböden"
}
if ( bauteilart == "4" )
{
dok_dat_feld[ 8 ] = "Oberböden"
}
if ( bauteilart == "5" )
{
dok_dat_feld[ 8 ] = "Unterböden"
}
if ( bauteilart == "6" )
{
dok_dat_feld[ 8 ] = "Rückwände"
}
if ( ( bauteilart == "8" ) || ( bauteilart == "9" ) || ( bauteilart == "10" ) )
{
dok_dat_feld[ 8 ] = "Türen"
}
if ( bauteilart == "13" )
{
dok_dat_feld[ 8 ] = "Konstruktionsböden"
}
if ( bauteilart == "14" )
{
dok_dat_feld[ 8 ] = "Mittelseiten"
}
if ( bauteilart == "23" )
{
dok_dat_feld[ 8 ] = "Blenden"
}
if ( bauteilart == "30" )
{
dok_dat_feld[ 8 ] = "Abdeckplatten"
}
if ( bauteilart == "21" )
{
dok_dat_feld[ 8 ] = "Schubkastenboden"
}
//dok_dat_feld[ 8 ] = bauteilart
if ( materialart != "" )
{
dok_dat_feld[ 6 ] = materialart
}
if ( orientierung != "" )
{
dok_dat_feld[ 5 ] = orientierung
}
if ( programm != "" )
{
dok_dat_feld[ 2 ] = programm
}
if ( ppsnummer != "" )
{
dok_dat_feld[ 7 ] = ppsnummer
}
if ( info2 != "" )
{
dok_dat_feld[ 37 ] = info2
}
if ( info3 != "" )
{
dok_dat_feld[ 38 ] = info3
}
if ( info4 != "" )
{
dok_dat_feld[ 39 ] = info4
}
if ( anschlag != "" )
{
dok_dat_feld[ 40 ] = anschlag
}
//dok_dat_feld[ 3 ] = barcode
}
call xlog(3, "Konstruktionszeichnungen: Fertig mit Einlesen! PPS-Nummer: <:dok_dat_feld[ 7 ]>" )
}
// Ende Einfügung calb/d.OS am 2013.02.04
if ( h_DocType == "dang" )
{
if ( @length( dok_dat_feld[ 1 ] ) == 0 )
{
dok_dat_feld[ 1 ] = "9999999"
}
}
if ( ( h_DocType == "DEBZ" ) || ( h_DocType == "DEBR" ) || ( h_DocType == "DEBG" ) || ( h_DocType == "EKBEL" ) || \
( h_DocType == "CHEBZ" ) || ( h_DocType == "CHEBL" ) || ( h_DocType == "CHEBR" ) || ( h_DocType == "CHEBG" ) || ( h_DocType == "EKBEL" ) || \
( ( h_DocType == "dlkb" ) && ( dok_dat_feld[ 2 ] == "" ) ) || ( ( h_DocType == "chlkb" ) && ( dok_dat_feld[ 2 ] == "" ) ) )
{
// calb / d.OS, 2013.06.14
// Realisierung Einkaufsbelege / Lieferscheine (inkl. Retoure)
if ( dok_dat_feld[ 6 ] != "nicht angegeben" )
{
call xlog( 4, "rufe Einkaufsbelege ... " )
//call xlog( 4, "EK-Belege: Barcode: <:dok_dat_feld[ 6 ]> " )
vars company[5000], doc_type[5000], field_no[5000], index_value[5000], field_name[5000]
vars i, j, k, anzahl
DBMS DECLARE DB_Session CONNECTION FOR USER 'EX_D3' PASSWORD 'NAVEX13' DATASOURCE 'ERP'
//DBMS DECLARE DB_Session CONNECTION FOR USER 'calbers' PASSWORD 'calbers' DATASOURCE 'ca_system'
DBMS WITH CONNECTION DB_Session ALIAS company, doc_type, field_no, index_value, field_name
DBMS WITH CONNECTION DB_Session SQL select Company, ArchiveDocumentType, DocTypeFieldNo, IndexValue, DocTypeFieldName \
from [Assmann_BM_DE$Index Values 4 Scanning Lines] where Barcode = :+dok_dat_feld[ 6 ]
anzahl = @dmrowcount
DBMS WITH CONNECTION DB_Session ALIAS
DBMS CLOSE CONNECTION DB_Session
j = 0
call xlog( 4, "Anzahl Treffer: " ## anzahl )
for i = 1 while i < 100 step 1
{
dok_dat_feld_60[ i ] = ""
}
// Erweiterung Hook durch Martin Lulei, Raber+Märcker, 13.06.2014, 09:28 (&& datei_erw != "txt")
if ( ( doc_type[ 1 ] == "" ) && ( datei_erw != "TXT" ))
{
call api_log_error( "###MALU Dokumentart = :doc_type[1] Dateierweiterung = :datei_erw")
call xlog( 2, "EK-Belege: Barcode: <:dok_dat_feld[ 6 ]> keine / nur leere Zeilen in der DB gefunden. " )
additional_info_text = "Barcode: <:dok_dat_feld[ 6 ]> keine / nur leere Zeilen in der DB gefunden."
return -8000
}
else
{
// Zuweisen der Dokumentart
dok_dat_feld[ 49 ] = doc_type[ 1 ]
call xlog( 4, "EK-Belege: Barcode: <:dok_dat_feld[ 6 ]> Dokumentart: <:doc_type[ 1 ]> " )
for i = 1 while i <= 5000 step 1
{
if ( doc_type[ i ] == "" )
{
k = i - 1
call xlog( 3, "EK-Belege: Barcode: <:dok_dat_feld[ 6 ]> raus hier @ Zeile :k " )
break
}
// Analyse der gelesenen Informationen
// Zuweisen der Attributfelder
if ( field_no[ i ] != 60 )
{
// eindimensionales Feld
dok_dat_feld[ field_no[ i ] ] = index_value[ i ]
//call xlog( 4, "EK-Belege: Barcode: <:dok_dat_feld[ 6 ]> Feld: dok_dat_feld_:field_no[ :i ] == <:index_value[ :i ]>" )
}
else
{
// mehrdimensionales Feld
j = j + 1
dok_dat_feld_60[ j ] = index_value[ i ]
//call xlog( 4, "EK-Belege: Barcode: <:dok_dat_feld[ 6 ]> Feld: dok_dat_feld_60[ :j ] == <:index_value[ :i ]>" )
}
}
// Zuweisen des Mandanten
dok_dat_feld[ 31 ] = company[ 1 ]
//call xlog( 3, "Mandant: <" ## dok_dat_feld[ 31 ] ## ">" )
}
}
}
// Ende Realisierung Einkaufsbelege
call api_log_info( "### hook ### hook_insert_entry_10_ass ## :h_DocType ## start")
if ( h_DocType != gDTS_INVOICE )
{
call getBarcodeData()
}
//call xlog( 4, "Mandant: <" ## dok_dat_feld[ 31 ] ## ">" )
call api_log_info( "### hook ### hook_insert_entry_10_ass ## :h_DocType ## end")
}
proc getBarcodeData()
{
vars h_Hits, h_Error, h_ErrMsg
if (dok_dat_feld[h_DDF_BARCODE]!="")
{
call prepareDbConnection()
vars h_Company, h_DocType
DBMS WITH CONNECTION :h_NavOdbcSource ALIAS h_Company, h_DocType
DBMS WITH CONNECTION :h_NavOdbcSource \
SQL SELECT Company, ArchiveDocumentType \
FROM [Assmann_BM_DE$Index Values 4 Scanning Header] WHERE Barcode=:+dok_dat_feld[h_DDF_BARCODE]
h_Hits = @dmrowcount
h_Error = @dmengerrcode
h_ErrMsg = @dmengerrmsg
dok_dat_feld[h_DDF_DTTEMP] = h_DocType
dok_dat_feld[h_DDF_COMPANY] = h_Company
call api_log_info( "### barcode search: hits: :h_Hits ### DB error: :h_Error")
DBMS WITH CONNECTION :h_NavOdbcSource ALIAS
if (h_Hits>0)
{
vars h_FieldNo, h_Index, h_Value
DBMS WITH CONNECTION :h_NavOdbcSource ALIAS h_FieldNo, h_Index, h_Value
DBMS WITH CONNECTION :h_NavOdbcSource \
SQL SELECT DocTypeFieldNo, NoOfMultipleField, IndexValue \
FROM [Assmann_BM_DE$Index Values 4 Scanning Lines] WHERE Barcode=:+dok_dat_feld[h_DDF_BARCODE]
h_Error = @dmengerrcode
vars h_i = 0
while (@dmretcode!=DM_NO_MORE_ROWS && h_Error==0 && h_ErrMsg=="")
{
h_i = h_i + 1
if (h_FieldNo>=60 && h_FieldNo<=69)
{
if (h_Index<=h_ARRAY_MAX)
{
(dok_dat_feld_:h_FieldNo)[h_Index] = h_Value
}
}
else
{
dok_dat_feld[h_FieldNo] = h_Value
}
DBMS WITH CONNECTION :h_NavOdbcSource CONTINUE
h_Error = @dmengerrcode
}
call api_log_info( "### barcode values: hits: :h_i ## DB error: :h_Error ## Navision")
DBMS WITH CONNECTION :h_NavOdbcSource ALIAS
vars h_ScanCount, h_ScanCountTemp
DBMS WITH CONNECTION :h_NavOdbcSource ALIAS h_ScanCountTemp
DBMS WITH CONNECTION :h_NavOdbcSource \
SQL SELECT ScanCount FROM [Assmann_BM_DE$Index Values 4 Scanning Header] WHERE Barcode=:+dok_dat_feld[h_DDF_BARCODE]
h_ScanCount = h_ScanCountTemp
// Datum ermitteln
//call api_function ("get_current_datetime", "%0d.%0m.%4y")
//call api_function ("get_current_datetime", "%0m-%0d-%4y")
// Change date format to YYYYMMDD ---
// call api_function ("get_current_datetime", "%4y%0m%0d")
call api_function ("get_current_datetime", "%0m.%0d.%4y")
// Change date format to YYYYMMDD +++
vars h_Datum = api_single_info
call api_log_info( "### h_Datum: :h_Datum")
DBMS WITH CONNECTION :h_NavOdbcSource ALIAS
h_ScanCount = h_ScanCount + 1
DBMS WITH CONNECTION :h_NavOdbcSource \
SQL UPDATE [Assmann_BM_DE$Index Values 4 Scanning Header] SET ScanCount=:h_ScanCount, LastScan=:+h_Datum WHERE Barcode=:+dok_dat_feld[h_DDF_BARCODE]
DBMS WITH CONNECTION :h_NavOdbcSource COMMIT
h_Error = @dmengerrcode
call api_log_info( "### barcode scan counter incremented: barcode: :dok_dat_feld[h_DDF_BARCODE], counter: :h_ScanCount, LastScan: :h_Datum ### DB error: :h_Error ## Navision")
}
return h_Hits
}
}
// #####################################################################################
// hook_insert_exit_30_d3Nav
// #####################################################################################
proc hook_insert_exit_30_d3Nav (h_DocId, h_FileDestination, h_CountmportOk, h_User, h_DocType)
{
call api_log_info( "### hook ### hook_insert_exit_30_d3Nav ## :h_DocType :h_DocId ## start")
call InsertExit30(h_DocId, h_FileDestination, h_CountmportOk, h_User, h_DocType)
call updateAttributes(h_DocType, h_DocId)
if(h_DocType == "AKRVG")
{
call linkDeliveryNotes(h_DocId)
}
call api_log_info( "### hook ### hook_insert_exit_30_d3Nav ## :h_DocType ## end")
}
// #####################################################################################
// hook_upd_attrib_exit_20_d3Nav
// #####################################################################################
proc hook_upd_attrib_exit_20_d3Nav (h_DocId, h_ErrNo, h_User, h_DocType)
{
call api_log_info("### Hook ## hook_upd_attrib_exit_20_d3Nav ## :h_DocType :h_DocId ## start")
call UpdateAttribExit20 (h_DocId, h_ErrNo, h_User, h_DocType)
call updateAttributes(h_DocType, h_DocId)
if (dok_dat_feld[h_DDF_BARCODE]!="")
{
vars h_Error
call prepareDbConnection()
DBMS WITH CONNECTION :h_NavOdbcSource \
SQL UPDATE [Assmann_BM_DE$Index Values 4 Scanning Header] SET ArchivDocID=:+h_DocId WHERE Barcode=:+dok_dat_feld[h_DDF_BARCODE]
DBMS WITH CONNECTION :h_NavOdbcSource COMMIT
h_Error = @dmengerrcode
call api_log_info( "### barcode: set doc id: :h_DocId ### DB error: :h_Error ## Navision")
}
call api_log_info( "### hook ### hook_insert_exit_30_d3Nav ## :h_DocType ## end")
if(h_DocType == "AKRVG")
{
//Prüfe auf Änderungen der Lieferscheinnummern
vars x
vars hasChanged = "false"
for x=1 while x<=CUR_60ER_FIELD_NR step 1
{
if(old_dok_dat_feld_63[x] != dok_dat_feld_63[x])
{
hasChanged = "true"
}
}
if( hasChanged == "true" )
{
call linkDeliveryNotes(h_DocId)
}
else
{
call api_log_info("no changes relevant for linking")
}
}
}
proc linkDeliveryNotes(h_DocId)
{
call api_log_info( "start linkDeliveryNotes")
//Lösen der Verbindungen
vars h_ReturnValue
h_ReturnValue = api_function("link_get_children", h_DocId, "")
vars client = dok_dat_feld[31]
vars clientNo = dok_dat_feld[81]
vars supplierNoArray[CUR_60ER_FIELD_NR]
vars j
for j=1 while j<=CUR_60ER_FIELD_NR step 1
{
supplierNoArray[j] = dok_dat_feld_63[j]
}
if (h_ReturnValue == 0)
{
vars h_Count
vars h_tmpDocId
vars h_creator
vars tmpChildren = api_single_info
for h_Count = 1 while h_Count <= tmpChildren step 1
{
h_tmpDocId = api_links[h_Count]
h_creator = api_link_creators[h_Count]
if(h_tmpDocId != "" && h_creator != "m")
{
vars h_tmpDoktype
h_ReturnValue = api_function ("document_type_get_short", "", h_tmpDocId)
if (h_ReturnValue == 0)
{
h_tmpDoktype = api_single_info
if(h_tmpDoktype == "DEBL")
{
h_ReturnValue = api_function ("link_delete", h_DocId, h_tmpDocId, "decsapi")
if(h_ReturnValue == 0)
{
call api_log_info("Verknüpfung entfernt parent :h_DocId child :h_tmpDocId")
}
else
{
call api_log_error("Fehlernummer :h_ReturnValue")
}
}
}
else
{
call api_log_error("Fehlernummer :h_ReturnValue wurde zurückgeliefert!")
}
}
}
}
else
{
call api_log_error("Fehlernummer :h_ReturnValue wurde zurückgeliefert!")
}
//Erstellen der Verbindungen
vars i
for i=1 while i<=CUR_60ER_FIELD_NR step 1
{
if(supplierNoArray[i] != "")
{
call api_clear_document_context()
api_doc_type_short = "DEBL"
api_doc_field[31] = client
api_doc_field[81] = clientNo
api_doc_field[20] = supplierNoArray[i]
if(api_doc_field[31] != "" && api_doc_field[81] != "" && api_doc_field[20] != "")
{
h_ReturnValue = api_function ("document_find_ids", "decsapi")
if (h_ReturnValue == 0)
{
vars y = api_single_info
for y = 1 while y <= api_single_info step 1
{
vars tmpChildLinkDocId = api_doc_ids[y]
call api_log_info("doc_id :y: :api_doc_ids[y]")
h_ReturnValue = api_function ("link_documents", "", tmpChildLinkDocId, "", 0,1)
if (h_ReturnValue == 0)
{
call api_log_info("Verknüpfung erstellt zwischen parent :h_DocId und child :tmpChildLinkDocId")
}
else
{
call api_log_error("Fehlernummer :h_ReturnValue wurde zurückgeliefert!")
}
}
}
else
{
call api_log_error("Fehlernummer :h_ReturnValue wurde zurückgeliefert!")
}
}
}
}
call api_log_info( "end linkDeliveryNotes")
}
proc updateAttributes(h_DocType, h_DocId)
{
if (h_DocType==h_DT_SOCONF)
{
// update quote attribute to relink document
call updateForeignAttribute (h_DocId, h_DocType, h_DDF_SQUOTENO, h_DDF_SORDERNO)
}
}
proc updateForeignAttribute (h_DocId, h_SourceDocType, h_MatchField, h_CopyField)
{
vars h_Count, h_MatchValue, h_CopyValue, h_Hits, h_Error
h_MatchValue = dok_dat_feld[h_MatchField]
h_CopyValue = dok_dat_feld[h_CopyField]
if (h_MatchValue!="" && h_CopyValue!="" && h_UpdateAttributes==1)
{
h_UpdateAttributes = 0 // avoid recursion
vars h_UpdateDocIds[100]
DBMS ALIAS h_UpdateDocIds
DBMS SQL SELECT doku_id FROM firmen_spezifisch \
WHERE dok_dat_feld_:h_MatchField=:+h_MatchValue and kue_dokuart<>:+h_SourceDocType
DBMS ALIAS
h_Hits = @dmrowcount
h_Error = @dmengerrcode
for h_Count = 1 while h_UpdateDocIds[h_Count]!="" step 1
{
call api_log_info("### update foreign attribute ## :h_UpdateDocIds[h_Count] ## match: field :h_MatchField -> :h_MatchValue # copy: field :h_CopyField -> :h_CopyValue ###")
call api_function("attribute_update_single", h_CopyField, h_CopyValue, 1, h_UpdateDocIds[h_Count], h_EditUser)
}
h_UpdateAttributes = 1
}
}
// #####################################################################################
// helper functions
// #####################################################################################
proc prepareDbConnection()
{
if(!dm_is_connection(h_NavOdbcSource))
{
vars h_Error
DBMS DECLARE :h_NavOdbcSource CONNECTION FOR \
USER 'EX_D3' PASSWORD 'NAVEX13' DATASOURCE ':h_NavOdbcSource'
h_Error = @dmengerrcode
if (h_Error==0)
{
call api_log_info( "### Connect: ODBC source: :h_NavOdbcSource")
}
else
{
call api_log_error( "### Database connection failed. ODBC source: 'ERP'. Error: :h_Error")
}
}
}