Database table problem
hi expert,
I have one expert routine with insert command in it. While DTP are running I change the status request to green, but after that I run again and the system can not insert record to database table. I wait for along time and system can perform insert command again to this database table. But again if I change the status to green when DTP request have not finished, the system can not perform insert command. Is the database table is lock or what? and How can I perform insert command immediately after stopping process.
Hi bwaugh06
You may use a text edit control instead od table control and store the content in a field of type STRING: No space wasted if no data is there but you have unlimited length.
Regards,
Clemens
Similar Messages
-
Problem with mapping the Entity beans onto database tables
Hi,
I got a problem with mapping the Entity beans onto database tables. Here are what I did:
First Step:
asant capture-schema
Second Step:
capture-schema -driver com.pointbase.jdbc.jdbcUniversalDriver -dburl jdbc:pointbase:server://localhost/sun-appserv-samples -username pbPublic -password pbpublic -table APPLICANT -table APPLICANTSKILL -table CUSTOMER -table LOCATION -table job -table JOBSKILL -table SKILL -out build/agency.dbschema
The first step was fine. But, in the second step, I got the error message as follow:
using dburl:jdbc:pointbase:server://localhost/sun-appserv-samples
using username:pbPublic
using password:pbpublic
using driver:com.pointbase.jdbc.jdbcUniversalDriver
using schemaname:null
using output file:build/agency.dbschema
JDO71100: Failed to find a class. Verify that the class is available on your CLASSPATH
java.lang.ClassNotFoundException: com.pointbase.jdbc.jdbcUniversalDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at com.sun.forte4j.modules.dbmodel.jdbcimpl.ConnectionProvider.<init>(Co
nnectionProvider.java:38)
at com.sun.jdo.api.persistence.mapping.ejb.CaptureSchema.main(CaptureSch
ema.java:130)
at com.sun.jdo.spi.persistence.support.ejb.util.CaptureSchemaWrapper.mai
n(CaptureSchemaWrapper.java:29)
Thanks for your help!You need to add the pbclient.jar or some similar name like that, in the CalssPath.
-
Problem while updating a database table
Hi experts,
I've used the FM 'HR_INFOTYPE_OPERATION' to update the database table. In that i used the MOD operation to update the Infotype PA0315. But it return an error message like "Infotype does not exist". What could be the reason for this error?.
regards,
Shanthi.Hi,
Here is my code for updation.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = P0315-pernr
IMPORTING
RETURN = wf_returne.
Update Mode
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0315'
NUMBER = P0315-PERNR
SUBTYPE = P0315-SUBTY
OBJECTID = P0315-OBJPS
LOCKINDICATOR = P0315-SPRPS
VALIDITYEND = P0315-ENDDA
VALIDITYBEGIN = P0315-BEGDA
RECORDNUMBER = P0315-SEQNR
RECORD = P0315
OPERATION = 'MOD'
TCLAS = 'A'
DIALOG_MODE = '0'
IMPORTING
RETURN = wf_return.
Dequeue
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = P0315-PERNR. -
SQL Loader problem while loading records from txt file to database table.
I am getting following error while loading records from flat txt file into database table with the help of 'sqlldr' command. I have executed catldr.sql from RDBMS folder but it is still showing same error. I am setting DIRECT = TRUE while issuing sqlldr command. If I try with DIRECT = FALSE then it works fine. Database is Oracle 8i.
SQL*Loader-951: Error calling once/load initialization
ORA-24329: invalid character set identifier
F1 Please.Hello,
Direct path load, can only be used with SQL*Loader and Database have the same version.
Care to tell the database version and sql*loader version you are using.
-Sri -
Labview database problem: Create a database table from user defined fields
I am trying to create a new table in an access database opened by an ODBC connection from information entered a table stored in the database, but every time I try to create the table, the Labview Database connectivity toolkit VI for creating a table throws a cryptic error
"Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Microsoft Access Driver] Syntax error in field definition. in NI_Database_API.lvlib:Conn Execute.vi->NI_Database_API.lvlibB Tools Create Table.vi->DatabaseCreateHeaders.vi"
I think this is becuase I am trying to re-create the database column variable type, but I am not sure what I am doing wrong. Everything seems to be fine as the data types go, and everything works as long as I use a constant to create the database columns. I even tried putting all of the information into the format labview defined, changed that to a variant, and redefined it as the labview database column type.
I have attached a simplified VI and a picture of what I am trying to
do, but I would appreciate any help I can get. Hopefully I won't have
pulled out all of my hair by the time some one replies!
Solved!
Go to Solution.
Attachments:
DatabaseUserDefinedTable.vi 14 KB
UserDefinedColumns.JPG 48 KBHi everyone. I am new to the database tool kit using labview. I am using labview 9.0f2 on Windows Xp. I am required to create a database (task is to create a table and to insert values into the table using Microsoft access 2007). I am trying to learn using the Create Database table.vi found with the software. I understand that need to create an access file and also had a mdl file which is name after it.(I had created them). Looking at the example given, I would like to add a few more variables, to be exact 6 more variables(therefore i would have 6 colum in my access file rite?). From the "connection information" the help information shows that it contain an 1D array of DB tools colum. ctl and also a cluster of 4 elements. the link to the access file, LabVIEW.udl shows that it restrict the colum in the access file.eg it has only stringcol,intcol,doublecol. I need to add more colum but cant add just like tt.
qn1: How to i add insert more varibles into the database so that it will apprears in access.
qn2: I cant drag and insert the "connection information" just to have more input. how do i do it?
qn3: where can i edit the info so that i can add more cluster into the access? when i drag out the input turn greyish. -
Database Table cannot be found when Verify Database
Post Author: brentlaw
CA Forum: Other
I have been using CRW 7 for many years. I recently upgraded to XI (I have current version). I can open existing reports and create new reports fine. The problem is when I Verify Database I get an error message "The Database table <tablename here> cannot be found. Remove this table from the report".
This happens to all existing and new created reports. The data fills correctly when previewing. The problem only occurs when Verifying Database.
I thought it might be an ODBC driver problem so I upgraded my driver to v 3.525.1117. At least I think I upgraded it I did not check the version before I installed SQL 2005 SP2. After installing SP2 it seemed to be fine but a week later the problem came back. Mysterious eh?
I am trying to launch a report from VB6 using RDC and rpt file. I get logged in correctly but at .viewreport I get a generic error message. I am assuming the problem is related the the issue I raise in this forum post.Post Author: brentlaw
CA Forum: Other
I fixed the problem. In CR XI Developer Designer window I opened up Database-SetDataSourceLocation. I noticed that in "Properties" the last item "Use DSN Default Properties": was set to True. I changed this value to False. Now this problem is solved.
I am Not using Windows Authentication I am using SQLServer authentication. In my code I was passing SQLServer Authentication credentials.
I opened up all of my CR 7 reports in CR XI and changed this setting on both the Main and the Subreort property in the SetDataSourceLocation dialog box and now all my reports work. I am a happy camper.
I don't know if this is a CR 7 conversion to CR XI only situation or not. Hope this information helps someone else. -
Hello experts, Need your Help...
I am trying to update database table using Update command. And I am doing COMMIT WORK AND WAIT. after the successful update.
But my code sometimes does not work and the table is not updated.
Sometimes the code works and sometimes not.. for the same data.
Can anybody think of any possible reason?
Thanks in advance,
--KumailHello Guys,
Here is the code, here we have all the keys... as it updates correctly sometimes. But doesnt update sometimes... for same data...... I have added COMMITT and WAIT statements to solve this problem.... but no luck....
UPDATE zfxx_bsr_data
SET zfxxstatus_glr = zfxx_bsr_data-zfxxstatus_glr
zfxxstatus_issue = zfxx_bsr_data-zfxxstatus_issue
zfxxerdat_glr = sy-datum
zfxxuser_glr = sy-uname
zfxxremark_glr = zfxx_bsr_data-zfxxremark_glr
zfxxertime_glr = sy-uzeit
doc_ind = w_doc_ind
zfxx_attach_acc = w_zfxx_att_acc
WHERE bukrs EQ t001-bukrs
AND saknr EQ zfxx_bsr_data-saknr
AND zfxxperiod EQ zfxx_bsr_data-zfxxperiod
AND zfxxfield EQ c_ba
AND zfxxfieldval EQ tgsb-gsber.
IF sy-subrc EQ 0.
WAIT UP TO 3 SECONDS.
COMMIT WORK.
WAIT UP TO 3 SECONDS.
ENDIF. -
Can't drop database table objects on a EJB Diagram.
JDeveloper 10.1.3 EA.
When I drop a database table object on a EJB Diagram the error below occurs. Also dropping components from the Component Palette doesn't work. A wizard opens, but after completing that, nothing is on the EJB Diagram.
However, after dropping a table and a restart of JDeveloper, there is an empty 'tablename EJB' on the EJB Diagram, but a click with the mouse on it generates the same error as the drop did.
Simular errors occur with JDeveloper 10.1.2, so writing this I realize that this might be a database version problem. I'm using 9i! I'll try 10g and see what happens.
Message
BME-99003: An error occurred, so processing could not continue.
Cause
The application has tried to de-reference an invalid pointer. This exception should have been dealt with programmatically. The current activity may fail and the system may have been left in an unstable state. The following is a stack trace.
java.lang.NullPointerException
at oracle.jdevimpl.xml.DescriptorNode.getWhitespaceHandler(DescriptorNode.java:349)
at oracle.jdevimpl.xml.DescriptorNodeDomIO.load(DescriptorNodeDomIO.java:164)
at oracle.jdeveloper.xml.BindingIO.load(BindingIO.java:43)
at oracle.jdevimpl.xml.DescriptorNode.getNewDescriptorImpl(DescriptorNode.java:506)
at oracle.jdevimpl.xml.DescriptorNode.getDescriptor(DescriptorNode.java:140)
at oracle.jdeveloper.xml.oc4j.ejb.OrionEjbJarNode.getOrionEjbJar(OrionEjbJarNode.java:145)
at oracle.jdeveloper.ejb.BaseEjbModuleContainer.getOrionEjbJar(BaseEjbModuleContainer.java:476)
at oracle.jdeveloper.ejb.modeler.diagram.dropHandler.TableDropEJB21Handler.isAvailable(Unknown Source)
at oracle.bm.diagrammer.ui.DropChooserPanel.populateOptions(Unknown Source)
at oracle.bm.diagrammer.ui.DropChooserPanel.createComponents(Unknown Source)
at oracle.bm.diagrammer.ui.DropChooserPanel.<init>(Unknown Source)
at oracle.bm.diagrammer.dropHandler.AbstractChooserDropHandler.createPanel(Unknown Source)
at oracle.bm.diagrammer.dropHandler.AbstractChooserDropHandler.processObjects(Unknown Source)
at oracle.bm.addinUtil.IDEAppContext$4.performAction(Unknown Source)
at oracle.bm.diagrammer.LockMonitor.performLockedAction(Unknown Source)
at oracle.bm.diagrammer.BaseDiagram.performDiagramLockedAction(Unknown Source)
at oracle.bm.addinUtil.IDEAppContext.dropNavigatorNodeLater(Unknown Source)
at oracle.bm.addinUtil.IDEAppContext$5.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Action
If further errors occur, you should restart the application.
Also, report the problem on the JDeveloper forum on otn.oracle.com, or contact Oracle support, giving the information from this message.
________________________________________________________________________________Hi lisa, you've said that the problem does not occur in the 10.1.3 build but I have almost the same problem with the BME-99003 error message.
I used the same workaround "changing the regional settings from BE to US" and the BME-99003 problem disappears :-)
Here is the error message that I receive while I add a table into the EJBDiagram. I'm using
windows XP SP2
ADF Business Components 10.1.3.34.12
Java Platform 1.5.0_04
Oracle IDE 10.1.3.34.12
Struts Modeler Version 10.1.3.34.12
UML Modelers Version 10.1.3.34.12
Versioning Support 10.1.3.34.12
Abdelkrim BOUJRAF
Message
BME-99003: An error occurred, so processing could not continue.
Cause
The application has tried to de-reference an invalid pointer. This exception should have been dealt with programmatically. The current activity may fail and the system may have been left in an unstable state. The following is a stack trace.
java.lang.NullPointerException
at oracle.jdevimpl.xml.DescriptorNode.getWhitespaceHandler(DescriptorNode.java:349)
at oracle.jdevimpl.xml.DescriptorNodeDomIO.load(DescriptorNodeDomIO.java:164)
at oracle.jdeveloper.xml.BindingIO.load(BindingIO.java:43)
at oracle.jdevimpl.xml.DescriptorNode.getNewDescriptorImpl(DescriptorNode.java:506)
at oracle.jdevimpl.xml.DescriptorNode.getDescriptor(DescriptorNode.java:140)
at oracle.jdeveloper.xml.oc4j.ejb.OrionEjbJarNode.getOrionEjbJar(OrionEjbJarNode.java:145)
at oracle.jdeveloper.xml.oc4j.ejb.OrionEjbJarHelper.findOrionEjbJar(OrionEjbJarHelper.java:82)
at oracle.jdeveloper.xml.oc4j.ejb.OrionEjbJarHelper.findOrCreateOrionEjbJar(OrionEjbJarHelper.java:73)
at oracle.jdeveloper.ejb.modeler.diagram.dropHandler.TableDropEJBCommonHandler.processTableNodes(Unknown Source)
at oracle.jdeveloper.ejb.modeler.diagram.dropHandler.TableDropEJB21Handler.processTableNodes(Unknown Source)
at oracle.bm.typemodel.dropHandler.TableDropSubHandler.processDBObjectNodes(Unknown Source)
at oracle.bm.typemodel.dropHandler.DBObjectDropSubHandler.processObjects(Unknown Source)
at oracle.bm.diagrammer.dropHandler.AbstractChooserDropHandler.processObjectsImpl(Unknown Source)
at oracle.bm.diagrammer.dropHandler.AbstractChooserDropHandler.processObjects(Unknown Source)
at oracle.bm.addinUtil.IDEAppContext$4.performAction(Unknown Source)
at oracle.bm.diagrammer.LockMonitor.performLockedAction(Unknown Source)
at oracle.bm.diagrammer.BaseDiagram.performDiagramLockedAction(Unknown Source)
at oracle.bm.addinUtil.IDEAppContext.dropNavigatorNodeLater(Unknown Source)
at oracle.bm.addinUtil.IDEAppContext$5.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Action
If further errors occur, you should restart the application.
Also, report the problem on the JDeveloper forum on otn.oracle.com, or contact Oracle support, giving the information from this message. -
Database table 'e' is not accessible
Hi all,
like many others in the web I'm having problems deploying CMP Beans on BEA. I'm using Weblogic 8.1 and
get the following error message:
"[EJB:011076]Unable to deploy the EJB 'B' because the database table 'b' is not accessible. Please ensure that this table exists and is accessible."
After a lot of research I understand the problem now. Weblogic is checking the cmp-fields at deployment time using something like "SELECT xx1, xx2, xxx3 FROM ttt1 WHERE 1 = 0". Some databases have no problem with such a select. My Solid database unfortunately does a full table scan on it. Having only some rows in the table b there is no problem at all, but I have more than 500.000 entries. :-(
My question: Is there a workaround? Can I somewhere specify the SQL - command for checking mapped cmp-fields? Or can I disable the check somehow?
I think it is a very annoying problem, many users out there have.
Thanx in advance
RobertRobert Jung wrote:
Hi all,
like many others in the web I'm having problems deploying CMP Beans on BEA. I'm using Weblogic 8.1 and
get the following error message:
"[EJB:011076]Unable to deploy the EJB 'B' because the database table 'b' is not accessible.Please ensure that this table exists and is accessible."
>
After a lot of research I understand the problem now. Weblogic is checking the cmp-fieldsat deployment time using something like "SELECT xx1, xx2, xxx3 FROM ttt1 WHERE 1 = 0".
Some databases have no problem with such a select. My Solid database unfortunately does
a full table scan on it. Having only some rows in the table b there is no problem at all,
but I have more than 500.000 entries. :-(
>
My question: Is there a workaround? Can I somewhere specify the SQL - command for checkingmapped cmp-fields? Or can I disable the check somehow?
I think it is a very annoying problem, many users out there have.Hi. All commercial quality DBMSes I know, are smart enough to evaluate constant search
criteria, and not to access all the rows if it's a-priori known that no rows will
qualify. I would ask 'Solid' for a fix.
However, you can generate our EJBs with the option of retaining the generated
JDBC code, which you could alter and recompile for your use. You might be able to
substitute some DatabaseMetaData call to getTableColumns() to get the same info...
Joe
Thanx in advance
Robert -
No data in Portal Database tables for Activity Report
Hi experts,
I've developed an Activity Report application in SAP Portal 7.0, which went live but the report shows no data.
We are pulling data from 2 portal database tables: WCR_WEBCONTENTSTAT and WCR_USERPAGEUSAGE
In non production environment there is data in the report but there is no data in the production environment.
The Activity Report service is already activated/started and set to true.
What could have caused this? And what should we check now?
What other configurations/setup should be done?
Regards,
GregHi Greg,
Those are the aggregated tables. If they are not filled with data although the Portal Activity Report is activated, you should check whether the aggregation finished successfully.
In the older SPs there were some problems that were fixed in later SPs of 7.0.
In order to have the latest version of Portal Activity report, you can check SAP note 1084379 - Portal Activity Report - Latest Version (SDA file).
You can compare the SP via the MANIFAST file, as it contains the version and SP number.
In order to troubleshoot problems in Activity Report, you can follow SAP note: 1690023 - Portal Activity Report - Component-specific Note
Some basic checks that you can do:
Run query on the raw data tables to check since when there is data in those tables:
select min(timestamphour) from SAP<SystemID>DB.WCR_WEBCNODESTAT;
If there is too much data from long time ago, then you should delete the old data, and leave only the new data (there is anyways retention time for the data to be kept).
If there is no data, then it means that the Portal Activity Report does not collect data, and not really activated (usually this is not the case).
The aggregation runs every top of the hour, so you can check in the default traces for an error during that time.
In most of the cases something went wrong while aggregating the data.
As a result the aggregation is not finished, so the transaction is not being committed, and the aggregated tables stay empty.
If there is a DuplicateKeyException in the trace, you can follow SAP note 1054145 - Duplicate Key Exception.
If you have any more questions, please don't hesitate to ask.
I hope this information helps,
Thanks & regards,
Michal Zilcha-Lang -
"Economizing" in a list of maps with identical keys (like a database table)
Hi there!:
I've been checking this forum for information about something like what I state in the title of this message, but haven't found such a specific case. I'm commenting my doubt below.
I'm working with a list of maps whose keys are exactly the same in all them (they're of type String). Indeed it could be considered an extrapolation of a database table: The list contains maps which act as rows, and every map contains keys and values which represent column names and values.
However, this means to repeat the same key values on every map and this spends memory. Right, maybe it's not such a big spent, but since the list can contains thousands of maps, I think that it would be better to choose a more "economical" way to achieve the same result.
I had thought about building a class which stored everything as a list of lists and, internally, it mapped that String keys with the corresponding Integer indexes of every list. But then I realized that maybe I was re-inventing the wheel, because it's very probable that someone has already made that. Maybe is there a class on the Core API which allows that?
Thank you very much for your help.Well, after re-reading the Java tutorial which is located in the Sun website I've came to a conclusion which I should have before, when I thought about using StringBuffers as keys of the maps instead of Strings.
I'm so used to build Strings using literals instead of the "new String ()" constructor (just as everyone) that I had forgotten that, as it happens with any kind of object but not the primary data types, Strings are not passed to the methods by value, but by reference. The fact of them being immutable made me think that they were passed by value.
Apart of that, my problem also was that using literals I was creating different String objects every time, despite the fact that they were equal about their content (making 400 different keys called "name" for example)
In other words, I was doing something like this:
// It makes a list of maps which will contain maps of boy's personal data (as if they were "rows" in a table).
List <Map <String, Object>> listData = new ArrayList <Map <String, Object>> (listBoy.size ());
// It loops over a list of Boy objects, obtained using EJB.
for (Boy boy : listBoy) {
// It makes a new map containing only the information which I'm interested on from the Boy object.
Map <String, Object> map = new HashMap <String, Object> (2);
map.put ("name", boy.getName ());
map.put ("surname", boy.getSurname ());
// It adds the map to the list of data.
listData.add (map);
}Well, the "problem" here (being too demanding, but I'm :P ) is that I was adding all the time new Strings objects as keys in every map. The key "name" in the first map was different from "name" in the second one and so on.
I guess that my knowledge got messed at certain point and thought that it was impossible to use exactly the same String object in different maps (the reference, not the same value!). Thus, my idea of using StringBuffers instead.
But thinking about it carefully, Why not to do this?:
List <Map <String, Object>> listData = new ArrayList <Map <String, Object>> (listBoy.size ());
// It makes the necessary String keys previously, instead of using literals on every loop later.
String name = "name";
String surname = "surname";
for (Boy boy : listBoy) {
// It uses references (pointers) to the same String keys, instead of new ones every time.
Map <String, Object> map = new HashMap <String, Object> (2);
map.put (name, boy.getName ());
map.put (surname, boy.getSurname ());
listData.add (map);
}Unfortunately, the "hasCode" method on String is overloaded and instead of returning the typical hash code based on the single ID of the object in memory, it returns one based on its content. That way I can't make sure that the "name" key in one map refers to the same object in memory than another one. I know, I know. The common sense and the Java documentation confirm that, but had loved having an empiric way to demonstrate it.
I guess that using "javap" and disassembling the generated bytecode is the only way to make sure that it's that way.
I believe that it's solved now :) (if no one tells me the contrary). I still am mad at myself for thinking that Strings were passed by value. Thinking about it now it had no sense!
dannyyates: It's curious because re-reading every answer I think that you maybe were pointing to this solution already. But the sentence "you put the +same+ string" was a little ambiguous for me and thought that you meant putting the same String as "putting the same text" (which I already was doing), not the same object reference (in other words, using a common variable). I wish we could have continued discussing that in depth. Thanks a lot for your help anyway :) . -
How to get string value from database table using Visual Studio 2005?
Hi,
Im developing plugin in illustrator cs3 using visual studio 2005. I need to get the values eneterd in database. Im able to get the integer values. But while getting string values it is returning empty value.
Im using the below code to get the values from database table
bool Table::Get(char* FieldName,int& FieldValue)
try
_variant_t vtValue;
vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
FieldValue=vtValue.intVal;
CATCHERRGET
sprintf(m_ErrStr,"Success");
return 1;
Im using the below code to get the values.
AIErr getProjects()
char buf[5000];
int i;
std::string catName;
::CoInitialize(NULL);
Database db;
Table tbl;
errno_t err;
err = fopen(&file,"c:\\DBResult.txt","w");
fprintf(file, "Before Connection Established\n");
//MessageBox(NULL,CnnStr,"Connection String",0);
if(!db.Open(g->username,g->password,CnnStr))
db.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
fprintf(file, "After Connection Established\n");
if(!db.Execute("select ProjectID,ProjectName from projectsample",tbl))
db.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
int ProjectID;
int UserID;
int ProjectTitle;
char ProjectName[ProjectNameSize];
if(!tbl.ISEOF())
tbl.MoveFirst();
ProjectArrCnt=0;
for(i=0;i<128;i++)
buf[i]='\0';
int j=0;
while(!tbl.ISEOF())
if(tbl.Get("ProjectID",ProjectID))
fprintf(file,"Project ID: %d ",ProjectID);
ProjectInfo[ProjectArrCnt].ProjectID = ProjectID;
sprintf(buf,"%d",ProjectID);
//MessageBox(NULL, buf,"f ID", 0);
j++;
else
tbl.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
break;
//if(tbl.Get("ProjectTitle",ProjectName))
if(tbl.Get("ProjectName",ProjectName))
MessageBox(NULL,"Inside","",0);
fprintf(file,"ProjectTitle: %s\n",ProjectName);
//catName=CategoryName;
ProjectInfo[ProjectArrCnt].ProjectName=ProjectName;
//sprintf(buf,"%s",ProjectName);
MessageBox(NULL,(LPCSTR)ProjectName,"",0);
else
tbl.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
break;
ProjectArrCnt++;
//MessageBox(NULL, "While", "WIN API Test",0);
tbl.MoveNext();
//MessageBox(NULL, ProjectInfo[i].ProjectName.c_str(),"f Name", 0);
::CoUninitialize();
//sprintf(buf,"%s",file);
//MessageBox(NULL,buf,"File",0);
fprintf(file, "Connection closed\n");
fclose(file);
for(i=0;i<ProjectArrCnt;i++)
sprintf(buf,"%i",ProjectInfo[i].ProjectID);
//MessageBox(NULL,buf,"Proj ID",0);
//MessageBox(NULL,ProjectInfo[i].ProjectName.c_str(),"Project Name",0);
return 0;
In the above code im geeting project D which is an integer value. But not able to get the project name.
Please some one guide me.As I said in the other thread, this really isn't the place to ask questions about a database API unrelated to the Illustrator SDK. You're far more like to find people familliar with your problem on a forum that is dedicated to answering those kinds of questions instead.
-
How to fetch the customer debit balances form the KNC1 database table
Hi Experts,
I am creating a ABAP report which would dispaly the customer credit balances for the currenct fiscal year.
I am fetching the values form KNC1 database table.....But in this table values are stored year wise.
But I want to display for the current fiscal year that means if teh user selects the 07/2011 as the month on the sleection screen then the debit balances from 072010 to 062011 should be dispalyed.
Could anyone please help me out to fetch this the debit balaces form KNC1 database table in the above format.
Or is there any other way to solve this problem?
Awating your urgent reply.
Many Thanks,
Komal.Hi Komal,
First, you have to compute the initial period and the final period.
Next, you must read table KNC1 for the years comprised between these two periods.
Last, you must read the fields of table KNC1. For that, you should compose dynamically the name of the field, and then ASSIGN it to a FIELD-SYMBOL.
Now, just add up the values!
Please try the following code:
FIELD-SYMBOLS: <fs>.
DATA: t_knc1 TYPE TABLE OF knc1 WITH HEADER LINE.
DATA: d_debits LIKE knc1-um01s.
PARAMETERS: p_kunnr LIKE knc1-kunnr,
p_bukrs LIKE knc1-bukrs,
p_spmon TYPE spmon.
DATA: l_fieldname(20) TYPE c.
DATA: l_date LIKE sy-datum,
l_date_from LIKE sy-datum,
l_date_to LIKE sy-datum.
DATA: l_period(2) TYPE n.
DATA: l_num_times TYPE i.
START-OF-SELECTION.
"Compute the initial and final periods
CONCATENATE p_spmon '01' INTO l_date.
CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'
EXPORTING
months = '-1'
olddate = l_date
IMPORTING
newdate = l_date_to.
CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'
EXPORTING
months = '-12'
olddate = l_date
IMPORTING
newdate = l_date_from.
"Read table KNC1
SELECT *
INTO CORRESPONDING FIELDS OF TABLE t_knc1
FROM knc1
WHERE kunnr = p_kunnr
AND bukrs = p_bukrs
AND gjahr BETWEEN l_date_from(4) AND l_date_to(4).
"this will yield at most 2 records, one for present year, and another one for the previous year.
"but if you select i.e. period '01.2012', initial_date = '01.01.2011' and final_date = '31.12.2011'
" --> thus only one year --> one record
CLEAR: d_debits.
LOOP AT t_knc1.
" If there's no year change
IF l_date_from(4) = l_date_to(4).
DO 16 TIMES.
l_period = sy-index.
CONCATENATE 'UM' "compute dynamically the field name
l_period
'S'
INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE t_knc1 TO <fs>. "assign
ADD <fs> TO d_debits. "and add up
ENDDO.
ELSE.
" If there IS a year change
IF t_knc1-gjahr = l_date_from+0(4).
l_num_times = 16 - l_date_from+4(2) + 1. "you must loop 16 - initial_period + 1 times for the first year
DO l_num_times TIMES.
l_period = sy-index + l_date_from+4(2) - 1.
CONCATENATE 'UM' "compute dynamically the field name
l_period
'S'
INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE t_knc1 TO <fs>. "assign
ADD <fs> TO d_debits. "and add up
ENDDO.
ELSE.
l_num_times = l_date_to+4(2). "you must loop final_period times for the second year
DO l_num_times TIMES.
l_period = sy-index.
CONCATENATE 'UM' "compute dynamically the field name
l_period
'S'
INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE t_knc1 TO <fs>. "assign
ADD <fs> TO d_debits. "and add up
ENDDO.
ENDIF.
ENDIF.
ENDLOOP.
You'll have the result on variable 'd_debits'.
I hope this helps. Kind regards,
Alvaro -
How to change a field of type CHAR of a database table to DATS
Dear ABAP experts,
I have a database table: ZLT_aztnew with fields M1, M2, K1, K2, A1, A2, P1, P2, S2, D1, D2, STD, BES. All these fields are of type 'Character'. except D2 which is of type DATS. The field D1 is date and is in format DD.MM.YYYY.
I want to convert this field D1 to type DATS so that I can use a date range through 'selection option' to select other data of other fields (M1, M2, K1, K2, A1, A2, P1, P2, S2, D1, STD, BES.) related to field D1 from the database table Zlt_aztnew.
How should I introduce this change (CONVERSION OF D1 CHAR to DATS in the .AZT file upload code itself.
Problem: If I define D1 as Type DATS in database table ZLT_AZTNEW then the UPLOAD fails.
The AZT file upload code is:
Data it_string type stringtab.
Data lv_string type string.
DATA: itab TYPE STANDARD TABLE OF zlt_aztnew.
DATA: wa_tab TYPE zlt_aztnew.
DATA: file_str1 type string.
Data: it_tab TYPE STANDARD TABLE OF file_table,
lw_file LIKE LINE OF it_tab,
gd_subrc TYPE i.
SELECTION-SCREEN begin of block blk with frame title text-100.
SELECTION-SCREEN SKIP 2.
parameters : p_file like rlgrap-filename .
SELECTION-SCREEN end of block blk.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select only Text File'
default_filename = '.azt'
multiselection = 'X'
CHANGING
file_table = it_tab
rc = gd_subrc.
READ TABLE it_tab INTO lw_file INDEX 1.
p_file = lw_file-FILENAME.
Start-of-Selection.
file_str1 = P_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_str1
* filename = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\test.azt'
tables
data_tab = it_string
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_string INTO lv_string.
clear wa_tab.
SPLIT lv_string AT ';' INTO wa_tab-M2 wa_tab-k2 wa_tab-A2 wa_tab-P2 wa_tab-S2 wa_tab-D1 wa_tab-STD wa_tab-BES.
Append wa_tab to itab.
Write: sy-uline(120),
/ sy-vline,
2 wa_tab-M2,
11 sy-vline,
13 wa_tab-k2,
25 sy-vline,
27 wa_tab-A2,
32 sy-vline,
34 wa_tab-P2,
39 sy-vline,
41 wa_tab-S2,
46 sy-vline,
48 wa_tab-D1,
60 sy-vline,
62 wa_tab-STD,
72 sy-vline,
74 wa_tab-BES,
120 sy-vline.
ENDLOOP.
DATA: Answer.
UPDATE zlt_aztnew From Table itab.
* INSERT ZLT_aztnew From Table itab accepting duplicate keys.
If sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'TITLE '
* DIAGNOSE_OBJECT = ' '
text_question = 'Wollen Sie die vorhandenen Inhalte ändern'
TEXT_BUTTON_1 = 'Ja'(001)
* ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'Nein'(002)
* ICON_BUTTON_2 = ' '
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
answer = answer
* TABLES
* PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2
*IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
IF Answer = '1'.
WRITE: / 'Die vorhandenen Inhalte war geändernt'.
MODIFY zlt_aztnew From Table itab.
ENDIF.
ENDIF.
TO introduce a date range and pull data from the database table Zlt_AZTNEW--> I wrote the BELOW code SEPARATELY,
but after execution, the error I am getting is: Enter a valid Date (for example, 31.03.2014).
TABLES: ZLT_aztnew.
TYPES: Begin OF ty_AZTN,
M2 TYPE Zlt_AZTNEW-M2,
K2 TYPE Zlt_AZTNEW-K2,
A2 TYPE Zlt_AZTNEW-A2,
P2 TYPE Zlt_AZTNEW-P2,
S2 TYPE Zlt_AZTNEW-S2,
D1 TYPE Zlt_AZTNEW-D1,
STD TYPE Zlt_AZTNEW-STD,
BES TYPE Zlt_AZTNEW-BES,
END OF ty_AZTN.
DATA: gv_datum TYPE d.
DATA: it_aztn TYPE STANDARD TABLE OF ty_aztn with header line.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = zlt_aztnew-D1
* ACCEPT_INITIAL_DATE =
IMPORTING
DATE_INTERNAL = gv_datum
* EXCEPTIONS
* DATE_EXTERNAL_IS_INVALID = 1
* OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SELECT-OPTIONS: s_datum FOR gv_datum.
INITIALIZATION.
s_datum-low = sy-datum.
s_datum-high = sy-datum.
APPEND s_datum.
********** After this further code follows with "SELECT" wherein I want to use the gv_datum as Where condition.
SELECT M2
K2
A2
P2
S2
D1
STD
BES
FROM ZLt_AZTNEW
INTO TABLE it_AZTN
Where D1 = gv_datum.
Please provide me your valuable suggestion to correct any flaw in my code above.
Looking forward for your reply.
Best regards
Chandan KumarDear Rama,
Plz refer the following difference in naming conventions as compared to your suggestion:
it_flat_file --> itab, (internal table for AZT fiel upload and split)
ls_flat_file ---> wa_itab,
Ztable --> Zlt_aztnew2, (Dbase file)
it_ztable ---> it_zlt_aztnew2, (internal table)
ls_ztable --> wa_aztnew2,
I wrote the following code but it is not working. Please also refer the attached screen shot of the database table : ZLT_AZTNEW2.
Data it_string type stringtab.
Data lv_string type string.
DATA: file_str1 type string.
Data: it_tab TYPE STANDARD TABLE OF file_table,
lw_file LIKE LINE OF it_tab,
gd_subrc TYPE i.
TYPES: Begin of Ty_itab,
M2 TYPE Char7,
K2 TYPE Char3,
A2 TYPE Char3,
P2 TYPE Char3,
S2 TYPE Char3,
D1 TYPE Char8,
STD TYPE Char8,
BES TYPE Char80,
END OF ty_itab.
DATA: itab Type Standard Table of ty_itab,
wa_itab Type ty_itab.
DATA: it_zlt_aztnew2 type standard table of Zlt_aztnew2,
wa_aztnew2 TYPE Zlt_aztnew2.
SELECTION-SCREEN begin of block blk with frame title text-100.
SELECTION-SCREEN SKIP 2.
parameters : p_file like rlgrap-filename .
SELECTION-SCREEN end of block blk.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select only Text File'
default_filename = '.azt'
multiselection = 'X'
CHANGING
file_table = it_tab
rc = gd_subrc.
READ TABLE it_tab INTO lw_file INDEX 1.
p_file = lw_file-FILENAME.
Start-of-Selection.
file_str1 = P_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_str1
* filename = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\test.azt'
tables
data_tab = it_string
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_string INTO lv_string.
Clear wa_itab.
SPLIT lv_string AT ';' INTO wa_itab-M2 wa_itab-k2 wa_itab-A2 wa_itab-P2 wa_itab-S2 wa_itab-D1 wa_itab-STD wa_itab-BES.
append wa_itab to itab.
Write: sy-uline(120),
/ sy-vline,
2 wa_itab-M2,
11 sy-vline,
13 wa_itab-k2,
25 sy-vline,
27 wa_itab-A2,
32 sy-vline,
34 wa_itab-P2,
39 sy-vline,
41 wa_itab-S2,
46 sy-vline,
48 wa_itab-D1,
60 sy-vline,
62 wa_itab-STD,
72 sy-vline,
74 wa_itab-BES,
120 sy-vline.
ENDLOOP.
LOOP at itab into wa_itab.
CLEAR wa_aztnew2.
wa_aztnew2-D1+0(4) = wa_itab+6(4).
wa_aztnew2-D1+4(2) = wa_itab+3(2).
wa_aztnew2-D1+6(2) = wa_itab+0(2).
Append wa_aztnew2 to it_zlt_aztnew2.
ENDLOOP.
MODIFY Zlt_aztnew2 from table it_zlt_aztnew2.
Looking forward for your suggestiojn.
Regards
Chandan -
How can I Insert data into my msaccess Database table
Hello all,
I am new to Java programming and I have problem that how can i insert name into my database table.
The code which i have written is following:
String filename = "d:/test.mdb";
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
database+= filename.trim() + ";DriverID=22;READONLY=true}";
Connection con = DriverManager.getConnection(database,"","");
String s = String.valueOf(text.getText());
int k =10;
Statement st = con.createStatement();
st.execute("create table Test123(name text)");
st.execute("INSERT INTO Test123 values" +s);
on the INSERT program throws exception???
can any one help me how to insert data into tabel.
Thankshe INSERT program throws exception???
can any one help me how to insert data into tabel.I have never used the jdbc driver to access, but what do you think that the flag READONLY=true means? An insert is not a read.
Kaj
Maybe you are looking for
-
R/3 to CRM replication,'CRS_SEND_TO_SERVER'
Hi All, We have extended CRM BP using EEWB. We have created about 20 screen fields. So, they are available at screen and also in the table BUT000. Now I have the same 20 fields in KNA1(R/3) table but not on the screen. If I would like to update any o
-
Why are there weird boxes around text in the Apple apps I use in mavericks?
After I updated to Mavericks I noticed these weird grey boxes that appear around the text in some of the Apple-made apps I use lime Pages, Reminders, etc. Also, in a finder window, whenever some of my tabs are open, the tab's colour is different from
-
Requirement of keeping the Path field BLANK of HTTP_AAE Channel in NW PO 7.31
Hi , We are in a phase of migrating Interfaces from PI 7.1 to PO 7.31(Java Only). For one of the Interface in PI 7.1 there is a RFC Destination for vendor communication through HTTPS connectivity : Target-Host: IP Address Post: value Path Prefix: Bl
-
Shared folder read-only for other users
We setup a new iMac with three accounts for members of the family. Two have admin rights. We installed Quicken Essentials 2010 for Mac, and put the Quicken data file in the Users/Shared/Quicken folder. Everything worked great for user #1 who copied t
-
How to get program which is been processed in background
Hi Experts, While doing PI sheet (CO60) the document gets posted for movement type 101 in MIGO which is processed in background. I need know which standard program is processed to get the document posted in background. The two function module