How do store a time type field in a database table?
We added a UDF of time type. SQL Server says its a small integer. After I pull the time off a date, I convert it to an integer. For example, I convert 6:00 AM to 600. When I try to store 600 in the field, I get a type mismatch exception. What am I doing wrong?
Adele,
Thanks a bunch!
Your code was syntactically incorrect but it moved me in the right direction. Here is the code I ended up with:
DateString = DateIn.ToString("yyyyMMdd HHmm")
Time = Date.ParseExact(DateString, "yyyyMMdd HHmm", system.Globalization.DateTimeFormatInfo.InvariantInfo)
Then update the Time field with the Time variable.
This does the trick. It looks like it is only necessary to save a date data type in a time type field and only the time piece of it is saved.
Thanks again,
Mike
Similar Messages
-
How to delete data from single field in a database table?
Hi guys,
Plz suggest me How to delete data from single field in a database table?
thnks,
pavanhi
in addition to abv details..chk this:
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
http://dev.mysql.com/doc/maxdb/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm
regards,
madhu -
How can i update the REMARK field in ADRT database table
Hi all,
How can i update the REMARK field in ADRT database table
By using Function modules or BAPIs
Please reply me fastHi,
you can try this code:
SELECT SINGLE * FROM KNA1 WHERE KUNNR = wa_kunnr.
IF sy-subrc = 0.
CLEAR adrct.
SELECT SINGLE * FROM adrct WHERE addrnumber = kna1-adrnr.
IF sy-subrc = 0.
adrct-remark = wa_remark.
MODIFY adrct.
ENDIF.
ENDIF
best regards,
Thangesh -
How can I Insert a Text field in a DATABASE TABLE???
Hello at all,
i have a database Table ZTEST with 2 columns.
MANDT TYPE CLNT
TEXT TYPE char (255)
In my internal table tab, i have a text content. I want insert this content in my database table ZTEST.
DATA: tab TYPE TABLE OF ZTEST,
lin TYPE ZTEST.
lin-text = 'HELLO WORLD'
APPEND lin TO tab.
INSERT INTO ZTEST VALUES tab.
Commit Work.
Is this correct???? BECAUSE it doesnt work.
Edited by: ETN_58 on Mar 31, 2010 10:27 AMHi All,
Here table ZTEST has two fields kunnr and text where kunnr is the key field.
REPORT ZATEST .
tables ztest.
DATA: itab TYPE TABLE OF ZTEST with header line.
itab-kunnr = '67890'.
itab-text = 'HELLO WORLD'.
APPEND itab.
if sy-subrc eq 0.
INSERT ZTEST from table itab.
Commit Work.
endif.
Check with this, its working fine.
Regards,
Md Ziauddin. -
How to store images in BLOB field in MySql database using java
Hi....
Currently am able to store character string into BLOB using byte array....in MySql.
but i cannot store images or pictures.......
to do this.........please help me out...............
Thanx..........:)Bye...........Hello,
I have done this for Oracle but it should be similar in MySQL also. Try reading thru these links below. Mail us if you have succeeded or not.
http://forum.java.sun.com/thread.jspa?forumID=48&threadID=654086
http://forum.java.sun.com/thread.jspa?forumID=48&threadID=384768
http://forum.java.sun.com/thread.jspa?forumID=48&threadID=549705
Thanks and regards,
Pazhanikanthan. P -
How to create the sub type field in hr abap infotype
hi ,
how to create the sub type field in hr abap infotype.
regards,
venkat.Try like this also
creating of infotype please follow these steps ...
Step 1: Create Infotypes
i. Goto Transaction PM01 To create Infotypes:
ii. Enter the Infotype Number and say create all.
iii. The following message would display:
i. PSnnnn Does not exist. How do you want to proceed?
iv. Click
v. A maintain Structure screen appears.
Fill in the short text description and the PS structure of the Infotype.
Since the fields Personnel No, Employee Begin Date, End Date, Sequential Number,Date of Last Change, Name of user who changed the object are available in the PAKEY and PSHD1 structure, define the PSnnnn structure with only the fields you required.
vi. Once the PS Structure is created, save and activate the structure.
vii. In the initial screen of PM01, now click on .
Create a new entry for the infotype.
Fill in the values as mentioned below and save.
Infotype Characteristics:
Infotype Name of the infotype_ Short Text: __Short Description________
*General Attributes :
Time constraint = 1
Check Subtype Obligatory
Display and Selection:
Select w/ start = 3 Valid record for entered data
Select w/ end = 5 Records with valid dates within the period entered
Select w/o date = 6 Read all records
Screen header = 02 Header ID
Create w/o end = 1 Default value is 31.12.9999
Technical Data:
Single screen = 2000
List screen = 3000; List Entry Checked.
viii. In the initial screen of PM01, now click on .
Choose the infotype entry in the list.
Fill in the values as mentioned below and save.
Technical Attributes:
In tab section,
The following attribute values are given:
Applicant DB Tab = PAnnnn Infotype Name
Subtype field = SUBTY
Subtype table = T591A
Subty.text tab. = T591S
Time cnstr.tab. = T591A
Prim. /Sec. = I Infotype
Period/key date = I Interval
and .
ix. Infotype Screen Modification:
Edit Screen 2000 from PM01 for the Infotype.
ABAP Editor for the Infotype Program MPnnnn00 will be displayed.
Click . Flow Logic will be displayed. There string coding of your own logic.
Regards
Pavan -
How to Find the Data Type of the Field In a Database Table
Hi Experts,
I'm currently working on a program which needs to find out the data type of the given field in a database table. In addition to accessing DD03L directly, is there any other workaround such as function module to help me achieve this? It would be helpful if a demo example could be provided.
Thanks a lot.Hi,
Use this..
DESCRIBE FIELD dobj TYPE typ.
write typ.
type will contain the data type of the object.
and check this thread also....
Re: How to get datatype of fields in dynamic structures
Cheers,
Simha.
Reward all the helpful answers.. -
Input Help for TIME type field
I saw below discussion regarding a dropdown for a "TIME" type field.
Re: Time Search Help
It's a resuable component (that Thomas Jung created) and find it very slick.
I just couldn't make it to work. I'm getting a dump when I pressed the dropdown on the "TIME" field.
I was wondering, has anyone used this in conjunction with select-options (WDR_SELECT_OPTIONS) ?
I'm getting a system-dump, "Component usage VALUE_HELP does not exist". I double checked the name that I used on the "USED COMPONENT" tab and it is VALUE_HELP.
During method ADD_SELECTION_FIELD (for IF_WD_SELECT_OPTIONS) I'm using two parameters I_VALUE_HELP_TYPE = 'APPLDEV' and I_VALUE_HELP_ID = 'VALUE_HELP'.
Maybe I'm not using the right parameters ?
Anyway, I would appreciate if anyone could give me directions to correct the problem.Or maybe there is another and better way of having an input help for a "TIME" type field on select-option.
Thanks.
VicThat is because the TIME is a freely programmed value help and freely programmed value helps are not supported by the Select-Options component. That limited is listed in the online help:
Type of input help specified as type IF_WD_VALUE_HELP_HANDLER.
Note that only ABAP Dictionary-based input help and OVS input help are supported; freely programmable input help is not supported.
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/bf07361248003de10000000a11466f/frameset.htm
The reason for this is that the freely programmed value help is accessed via a component usage. The Select-Options however are a separate component. They have no declaration to your components, component usages. Therefore they produce the error that the component usage doesn't exist - which is correct. It doesn't exist in the Select-Options Component. -
How To Store pdf or doc file in Oracle Database using Java Jdbc?
can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.
Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
for Adding PDF in DB i used image.jsp
Database table structure (table name. pictures )
Name Null? Type
ID NOT NULL NUMBER(11)
IMAGE BLOB
<%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
File file =
new File("D:/info.pdf");
FileInputStream fs = new FileInputStream(file);
ps.setInt(1,4);
ps.setBinaryStream(2,fs,fs.available());
int i = ps.executeUpdate();
if(i!=0){
out.println("<h2>PDF inserted successfully");
else{
out.println("<h2>Problem in image insertion");
catch(Exception e){
out.println("<h2>Failed Due To "+e);
%>
O/P: PDF inserted successfully
i tried to display that pdf using servlet. i am giving the code below.
import java.io.IOException;
import java.sql.*;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DispPDF extends HttpServlet {
* The doGet method of the servlet. <br>
* This method is called when a form has its tag value method equals to get.
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//response.setContentType("text/html"); i commented. coz we cant use response two times.
//PrintWriter out = response.getWriter();
try{
InputStream sPdf;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
ResultSet rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
//out.println(bytearray);
int size=0;
sPdf = rs.getBinaryStream(1);
response.reset();
response.setContentType("application/pdf");
while((size=sPdf.read(bytearray))!= -1 ){
//out.println(size);
response.getOutputStream().write(bytearray,0,size);
catch(Exception e){
System.out.println("Failed Due To "+e);
//out.println("<h2>Failed Due To "+e);
//out.close();
OP
PDF-1.4 %âãÏÓ 2 0 obj <>stream x+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2KüsSSS4C²ê Pkø$VãGÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
plz help me out. -
How to get the object class field value in CDHDR table for vendor
hi
how to get the object class field value in CDHDR table for vendorTry KRED/KRED_N as object class in CDHDR for Vendor.
-
How to modify or put entry in a particular field of a database table
i want to to modify a field in a database table record identification by primary key fileds
the situatio is like this
there are two primay key in database table
customer number PK
status PK
date
and third field which i want to modify is customer part number.
based on condition that
database table1-cuspip = wa_record-cuspip.
database table1-status <> wa_record-status
and database table-date = wa_record-date
if above is true a particular field the database table for that record
ie customer_part_number = 'FAiled'.
loop at it_record into wa_Record
endloop.
please suggest how to modify the database table record if the avove condition is tru and please give me full working code
regards
AroraDear Nishant,
Use UPDATE function for updating the customer part number.
But please do mention the database table and the keys used for update.
if en entry already exists with the key then the Entry will fail so use MODIFY statement to modify the Consumber Part Number with the specificed keys and transport the modified customer part number and then do COMMIT the changed entry to database.
Hope this helps you in some way.
Encourage others to answer you queries by suitably rewarding them.
Thanks
Venugopal -
How to find the structure fields data in database tables?
how to find the structure fields data in database tables?
Your question doesn't appear to be Web Dynpro ABAP related. Please only post questions in this forum if they are directly Web Dynpro ABAP related. There are several other more general ABAP related forums.
-
How to deal with time zone while upgrading the database?
Hi,
How to deal with time zone while upgrading the database?
Thanks
Edited by: user12135020 on Jul 4, 2011 3:06 AMHello,
I answered to a Wrong post.
Best regards,
Jean-Valentin
Edited by: Lubiez Jean-Valentin on Jul 4, 2011 12:15 PM -
Extracting Values of a Field from a Database Table in SAP ECC System
Hi,
I downloaded Extracting Values of a Field from a Database Table in SAP ECC System Using MII 12.0
senario from sdn. I'm trying to do that senario in MII 12.05. But I have problem with section 6 in page 7 (you can supply senario from sdn)
"6- Under the loop of Repeater, use action u2018Rowu2019 to append just the string part of the WA which will display only values for field u2018Batchu2019"
I did not find WA elemen in Output element of Repeater_0
How can I create WA element?
Thanks.Cemil,
Set up a SAP JCo Interface action block. Use the RFC name RFC_READ_TABLE.
In the link editor map the table to "MARA", set RowCount to something small (20 is good sample size) and create an xml transaction property named FIELDS and copy the following into it:
<?xml version="1.0" encoding="UTF-8"?><FIELDS>
<item>
<FIELDNAME>MATNR</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>MTART</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>BSTME</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>XCHPF</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>DATAB</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
</FIELDS>
Then link the Transaction.FIELDS to SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/TABLES/FIELDS}. You may run into problems with two other fields and optionally they can be removed (set link type to remove xml). I usually remove them initially for testing. The two fields are:
SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/INPUT/NO_DATA}
SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/INPUT/DELIMITER} (or you can set this to something like a semicolon,";" or tilda,"~". I find it easier to caclulate position by length, but that is my own idiosyncrasy.)
Once you get this one working, we can explore how to do filtering on the dataset. Your output should be something like this:
<?xml version="1.0" encoding="utf-8"?>
<RFC_READ_TABLE>
<INPUT>
<DELIMITER />
<NO_DATA />
<QUERY_TABLE>MARA</QUERY_TABLE>
<ROWCOUNT>20</ROWCOUNT>
<ROWSKIPS>0</ROWSKIPS>
</INPUT>
<TABLES>
<DATA>
<item>
<WA>000000000000000023ROH 00000000</WA>
</item>
<item>
<WA>000000000000000038HALB 00000000</WA>
</item>
<item>
<WA>000000000000000043HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000058HIBE 00000000</WA>
</item>
<item>
<WA>000000000000000059HIBE 00000000</WA>
</item>
<item>
<WA>000000000000000068FHMI 00000000</WA>
</item>
<item>
<WA>000000000000000078DIEN 00000000</WA>
</item>
<item>
<WA>000000000000000088FERT 00000000</WA>
</item>
<item>
<WA>000000000000000089FERT 00000000</WA>
</item>
<item>
<WA>000000000000000098HALB 00000000</WA>
</item>
<item>
<WA>000000000000000170NLAG 00000000</WA>
</item>
<item>
<WA>000000000000000178NLAG 00000000</WA>
</item>
<item>
<WA>000000000000000188NLAG 00000000</WA>
</item>
<item>
<WA>000000000000000288HALB 00000000</WA>
</item>
<item>
<WA>000000000000000358HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000359HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000521HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000578FERT 00000000</WA>
</item>
<item>
<WA>000000000000000597HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000598VERP 00000000</WA>
</item>
</DATA>
<FIELDS>
<item>
<FIELDNAME>MATNR</FIELDNAME>
<OFFSET>000000</OFFSET>
<LENGTH>000018</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Material Number</FIELDTEXT>
</item>
<item>
<FIELDNAME>MTART</FIELDNAME>
<OFFSET>000018</OFFSET>
<LENGTH>000004</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Material Type</FIELDTEXT>
</item>
<item>
<FIELDNAME>BSTME</FIELDNAME>
<OFFSET>000022</OFFSET>
<LENGTH>000003</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Purchase Order Unit of Measure</FIELDTEXT>
</item>
<item>
<FIELDNAME>XCHPF</FIELDNAME>
<OFFSET>000025</OFFSET>
<LENGTH>000001</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Batch management requirement indicator</FIELDTEXT>
</item>
<item>
<FIELDNAME>DATAB</FIELDNAME>
<OFFSET>000026</OFFSET>
<LENGTH>000008</LENGTH>
<TYPE>D</TYPE>
<FIELDTEXT>Valid-From Date</FIELDTEXT>
</item>
</FIELDS>
<OPTIONS />
</TABLES>
</RFC_READ_TABLE>
Add a repeater sourced on:
SAP_JCo_Interface_0.Response{/RFC_READ_TABLE/TABLES/DATA/item}
Link your repeater output to a tracer with this:
Repeater_0.Output{/item/WA}
What you will see in each tracer message is a single line of data with all the fields contents concatenated together. You can look up what each field in the string represents by the length of the field as returned in the Response segment of the RFC_READ_TABLE rfc. Then you can parse out the data you are interested in.
Give this a try and let me know how you succeeded.
By the way, I could not find the scenario you referred to. Can you post a link?
Regards,
Mike
Edited by: Michael Appleby on Jan 12, 2009 5:16 PM -
To replace values of one of the field in the database table
How to replace values of one of the field in the database table with a new values? Pls help to solve
Hi
You can use the UPDATE command to update one of the field value in a table
see the UPDATE syntax and use it
but in real time you should not do like this
Regards
Anji
Maybe you are looking for
-
Subtitles in Movies on the iPod Touch
so, ive converted some of my dvds to video files and put them on my touch. i chose to have subtitles in english when i converted the video file. is there any way to turn off the subtitles while on the touch? thank you!
-
My laptop randomly turned off and now it won't turn back on. What do I do now?
I was just on my laptop like any other regular day but than all of a sudden it turned off. I tried to turn it back on but nothing happen. The battery is full and everything seems normal (except the reason it won't turn on) HELP!
-
Hello all.. I have an entity object which represents a table of type: description(VARCHAR),date(Date), Id(Numeric). The Id is FK for table: Id(Numeric PK), Name VARCHAR Now in my application I have a gridControl which should represent table1 but inst
-
Cannot delete record in master detail form in apex 4.0.1
Dear all, I've created a master detail form in apex 4.0.1. Inserting and updating records is working. But when i want to delete a detail or master record, nothing is happening. The delete button is just not working. Can someone please tell me if this
-
While doing J1iex how do I change the Excise duty rate; I donot want to change the PO everytime. I maintain the Exceptional Duty rate in J1id. Still that does not get effected in J1iex. It only takes the value from PO.