How to set Date in input field by hard coding in application
Hi all,
1.I have to make a date(its my choice to set the date) to appear in input field which is date type.
2.How to compare two numbers of type decimal. for example greatest of two numbers
urgent requirement
Hi
Check the http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Date.html
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html
Sample Code
Date now = new Date();
DateFormat df = DateFormat.getDateInstance();
String s = df.format(now);
System.out.println("Today is " + s);
java.sql.Date descends from java.util.Date, but uses only the year, month and day values. There are two methods to create a Date object. The first uses a Calendar object, setting the year, month and day portions to the desired values. The hour, minute, second and millisecond values must be set to zero. At that point, Calendar.getTime().getTime() is invoked to get the java.util.Date milliseconds. That value is then passed to a java.sql.Date constructor:
Calendar cal = Calendar.getInstance();
// set Date portion to January 1, 1970
cal.set( cal.YEAR, 1970 );
cal.set( cal.MONTH, cal.JANUARY );
cal.set( cal.DATE, 1 );
cal.set( cal.HOUR_OF_DAY, 0 );
cal.set( cal.MINUTE, 0 );
cal.set( cal.SECOND, 0 );
cal.set( cal.MILLISECOND, 0 );
java.sql.Date jsqlD =
new java.sql.Date( cal.getTime().getTime() );
The second method is java.sql.Date's valueOf method. valueOf() accepts a String, which must be the date in JDBC time escape format - "yyyy-mm-dd". For example,
java.sql.Date jsqlD = java.sql.Date.valueOf( "2010-01-31" );
creates a Date object representing January 31, 2010. To use this method with a Calendar object, use:
java.sql.Date jsqlD = java.sql.Date.valueOf(
cal.get(cal.YEAR) + ":" +
cal.get(cal.MONTH) + ":" +
cal.get(cal.DATE) );
which produces a Date object with the same value as the first example.
Regards
Ayyapparaj
Similar Messages
-
How to enable/disable the input fields based on the data entered in the web dynpro application abap? If the user enters data in one input field then only the next input field should be enabled else it should be in disabled state. Please guide.
Hi,
Try this code.
First create a attribute with the name readonly of type wdy_boolean and bind it read_only property of input field of which is you want to enable or disable.
Next go to Init method.
Set the readonly value as 'X'.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_visible TYPE wd_this->element_context-visible.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* @TODO handle not set lead selection
IF lo_el_context IS INITIAL.
ENDIF.
* @TODO fill attribute
* lv_visible = 1.
* set single attribute
lo_el_context->set_attribute(
name = `READONLY`
value = 'X').
After that Go to the Action ENTER.
First read the input field ( first input field, which is value entered field) , next give a condition
if input value is not initial then set the readonly value is ' '.
DATA lo_nd_input TYPE REF TO if_wd_context_node.
DATA lo_el_input TYPE REF TO if_wd_context_element.
DATA ls_input TYPE wd_this->element_input.
DATA lv_vbeln TYPE wd_this->element_input-vbeln.
* navigate from <CONTEXT> to <INPUT> via lead selection
lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
* @TODO handle non existant child
* IF lo_nd_input IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_input = lo_nd_input->get_element( ).
* @TODO handle not set lead selection
IF lo_el_input IS INITIAL.
ENDIF.
* get single attribute
lo_el_input->get_attribute(
EXPORTING
name = `VBELN`
IMPORTING
value = lv_vbeln ).
if lv_vbeln IS not INITIAL.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_visible TYPE wd_this->element_context-visible.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* @TODO handle not set lead selection
IF lo_el_context IS INITIAL.
ENDIF.
* @TODO fill attribute
* lv_visible = 1.
* set single attribute
lo_el_context->set_attribute(
name = `READONLY`
value = ' ' ). -
How to set the table input in Query template?
Hi all.
I need to call a Bapi_objcl_change, with import parameter and a table as an input. I have done this, in BLS. I have set the table input in the
form of xml. In BLS, I get the output(the value gets change in SAP R3, what i have given in BLS). But if i set the same xml structure in
query template, I didn't get the output. Table input parameter does not take that xml source. How to set the table input in Query template?
can anyone help me?
Regards,
HemalathaHema,
You probably need to XML encode the data so that it will pass properly and then xmldecode() it to set the BAPI input value.
Sam -
How can we change the input field on a view stop showing zeros
Hello,
To make screen look consistent with other character input field. How can we change the input field on the view stop displaying zeros even though the data type is NUMC and data type should not be change?
Edited by: sap_learner on Mar 25, 2010 5:44 PM
Edited by: sap_learner on Mar 25, 2010 5:49 PM
Edited by: sap_learner on Mar 25, 2010 5:55 PMhello Manas Dua,
Thanks for your help. I am able to resolve my problem.
My code will help the future comers to resolve this kind of issues.
*The code is applied to method WDDOINIT of the default view.
DATA lo_nd_terms_input TYPE REF TO if_wd_context_node.
DATA lo_nd_terms_input_i TYPE REF TO if_wd_context_node_info.
DATA lv_zeros TYPE wdy_attribute_format_prop.
lv_zeros-null_as_blank = 'X'.
lo_nd_terms_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
lo_nd_terms_input_i = lo_nd_terms_input->get_node_info( ).
lo_nd_terms_input_i->set_attribute_format_props(
EXPORTING
name = `ENTER THE ATTRIBUTE NAME`
format_properties = lv_zeros ).
Edited by: sap_learner on Mar 26, 2010 5:02 PM -
How to set Date in RFC call.
Hi,
I am trying to set date in structure when calling RFC.
ICall = function.getImportParameterList();
ICall.getStructure("IORDER").setValue(eDate,"EDATE");
EDATE is date field in Structure in RFC with data type "D" and it is taking date in "dd.mm.yyyy"; formate.
I am setting date "dd.mm.yyyy"; in string format with eDate variable and it is throwing error.
Can any one tell me How I can set date for "EDATE" field in proper format.
Can I do JCO.TYPE_DATE date1 = new java.util.Date();
And How I can convert date in acceptable format "dd.mm.yyyy"; for RFC.
Thanks for your help
AshishHi Sateesh,
Thanks for your Answer.
I used java.util.date and it works fine.
Icall.getStructure("IOrder").setValue(new java.util.date(), "EDATE")
I came to know that java date variabel can be passed without any extra conversion to ABAP type D variable .
Is it OK? As I am setting java date variable directly to ABAP type d variable in RFC.
I have awarded you points for very helpful answer.
Thanks.
Ashish. -
How to set data in rtf document?
Hi friends,
I have a rtf document can anyone suggest how to set data in cells of an rtf document?Is there any way?
Thanks in advance..
Regards ,
SoumyanilConvert the resultSet from the db to a Object[][], let's call it result.
Then create a JTable (jTable1).
On the JTable you need to define the headers, and the data itself.
You can get the headers from ResultSetMetaData. Convert these to an array again (headers).
Now use these methods to create a model and set the model of the JTable.
Model model = new DefaultTableModel(result, headers);
jTable1.setModel(model);That's about the basics.
If you need more info, use at the tutorial at sun's homepage.
How to use Tables:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html -
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 to set date according to hjrah calender : nls_calender='English Hijrah
Hello frnds
how to set dates according to "English Hijrah".
I have set my database nls_calender='English Hijrah' ,
as many people aware that Hijrah dates are depend on moon ,
so I want to know how to set the calender for next month date in the database according to "English Hijrah"
I have set my database calender like this :
Example 3-17 NLS_CALENDAR='English Hijrah'
Set NLS_CALENDAR to English Hijrah.
SQL> ALTER SESSION SET NLS_CALENDAR='English Hijrah';
SELECT SYSDATE FROM DUAL;
You should see output similar to the following:
SYSDATE
24 Ramadan 1430
now I want to set the next month calender ...
I think my question is litte bit confusingmy db version 10.2.0.3
and above metalink id 121061.1 , I have tried from this document , but the change is not effected ,
the steps what I have down ;
1) shutdown the database
2)$oracle_home/nls/lxecal.nlt
i have created new file , and the contents is: syntax or algorithm
DEFINE calendar
calendar_name="English Hijrah"
DEFINE calendar_deviation
deviation_data= {
<"MAY-30-2009 ad">:11
ENDDEFINE calendar_deviation
ENDDEFINE calendar
note: i have to subract 1 day from current month
3) run the file
$ lxegen
4) sql>startup
5) sql>ALTER SESSION SET NLS_CALENDAR='English Hijrah';
6) sql>select sysdate+2 from dual;
SYSDATE+2
30 Jamada El Oula 1430
but my expected output should be like this
SYSDATE+2
01 Jamada El Thaniah 1430
note: that is after 2 days from today I need 1 st of next month , but its showing 30 th of present month , bcoz according to arabic month , present month is for 29 days only... -
How to set date and time on apple tv
how to set date and time on apple tv
Assuming this is not the first time you have used your Apple TV
1. You might try restarting the Apple TV by removing ALL the cables for 30 seconds.
2. Also try restarting the router.
3. If the problem persists, try a restore, you may want to try the previous procedures several times before doing this.
If this is a new Apple TV, it may also be that your network router is not allowing access to the timeserver, check that your router allows access over port 123. -
How to set cureent date as input field in alv
Hi Experts
I have created an Alv report.In that report i have an input field Created Date.
how to set the current date default in the alv input.Plz guideHi ,
In the internal table declare a field of type D and pass the sy-datum. this will solve ur problem.
Hope information shall be useful.
Regards
Santosh Kumaar.M -
How to make "Data Entry Profile" field input unable or display only in CAT2
hi ,
I have requiremnet where I need to make "Data Entry Profile" field in the CAT2 transaction as Display only .That is for each user it should come as default one .
The reason behind this is , user should not change this Profile and maintain an incorrect timesheet entries.
Is there any User exit where i can do this ?
Let me know as this is very urgent requirement.
Points will be definately rewarded.
Thanks .Hemant,
Got SHD0 transaction and create screen variant for that transaction there you can disable that field.
Create Transaction variant for that transaction and assign previously created screen variant to this transaction varient. actiavte.
Reward if it helps,
Satish -
How to do validation of input fields
Hi all,
I have a rquirement to do the validation of input fields.Can anybody explain me how to go for that???Please explain in detail.U can also give me a link where i can find the tutorial for doing this.Hi Amit,
What everyone has said above is correct - in the method of your action simply test for whatever condition you need to validate for. However, the following tutorial shows you how to use Web Dynpro's Message Manager to display the messages on the screen in an easy user-friendly way:
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/a%20simple%20input%20form%20with%20message%20and%20error%20service%20support.pdf">Enabling Message and Error Support</a>
In addition, there are some validations that are done automatically depending on what you have your input fields set to - for instance, if you bind your input field to a date and a user enters words into the field instead of an actual date, it will automatically display an error message. To learn how to turn this feature on and off, see this tutorial
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/edf6ea90-0201-0010-7696-a68662381c12">Using Validating and Non-Validating Actions</a> -
How to Fill value in Input fields before displaying ADOBE FORM
Hi to all,
Please can anyone tell me how to fill the entry in ADOBE FORM before displaying?
I have written a program to generate ADOBE FORM, but I need while displaying ADOBE FROM some input field should already be filled by value and can not be changed.
Please can anyone tell me how to do that in program?
Below is the program.
DATA: fm_name TYPE rs38l_fnam,
fp_docparams TYPE sfpdocparams,
fp_outputparams TYPE sfpoutputparams.
Parameters: p_pdf_form_name type fname.
fp_docparams-langu = 'E'.
fp_docparams-country = 'IN'.
fp_outputparams-preview = 'X'.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = p_pdf_form_name
IMPORTING
e_funcname = fm_name.
E_INTERFACE_TYPE = E_INTERFACE_TYPE
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
IMPORTING
/1BCDWB/FORMOUTPUT = fp_outputparams
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3.
CALL FUNCTION 'FP_JOB_CLOSE'
IMPORTING
E_RESULT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
I shall be thankful to you for this.
Regards
Pavneet Rana
Edited by: pavneet rana on Jul 25, 2011 2:57 PMHello,
you need to provide the information via the interface, which you create for the Adobe form.
And then pass this values via the following function module inside your generation report.
CALL FUNCTION fm_name
check standard report : FP_EXAMPLE_01 as an example! -
How to set the 'default to' field of a dashboard prompt to yesterday?
Hi everyone,
I have a dashboard prompt on a date (fully qualified name Date.Date and type Date).
I also have a simple report with two columns: Date.Date and a mesure (whatever the name).
I managed to filter on the day before the current date in the report by adding an advanced SQL filter:
Date.Date = Cast(TimestampAdd(SQL_TSI_DAY,-1,@{system.currentTime}) as Date)
Now, I would like the prompt to select the day before the current date by default.
The filter on Date.Date would be 'is prompted' or so.
How do I set the "Default to" field of the prompt?
Thanks in advanceHi
go to your prompt..
select SQL Results from Default to: dropdown..
here.. you need to write your Logical SQL..
which defaults to the previous date
some thing like this..
*select case when 1=0 then anydate column else timestampadd(sql_tsi_day, -1, CURRENT_DATE) end FROM SubjectArea name*
write like this.. and report back...
Thanks & Regards
Kishore Guggilla -
How to set Data Subsetting Parameters in MOBILE SERVER
Hello.
How can I set data subsetting parameters in Mobile Server with patch 5.0.2.10.0 NLS.
From Mobile Server "Control Center" -> "Applications" it's not appears at left screen the following field:
* Data Subsetting
* Registry
* Access
* Files
The browser appears this error message:
"http://120.0.0.1:2000/webtogo/admin/console/apppropinfo?applicationvp=%2FMyApp"
Have you any idea for this problem?
Thanks All.Thanks Oliver,
I have to go in control center in "applications tab" then i have the list of application and i edit one of them, on the left clic Data Subsetting it's not appears.
The following it not appears:
* Data Subsetting
* Registry
* Access
* Files
The browser (internet explorer) appears (at buttom on the left browser) this error message:
"error http://127.0.0.1:2000/webtogo/admin/console/apppropinfo?applicationvp=%2FMyApp missing link".
Whereas (Oliver's solution) in Mobile Server "Control Center" -> "Users Tabs"
i have the list of users go and i edit one of them, on the left clic Data Subsetting then clic on the right pan platform and then i see but not parameter are definited.
Help me please.
Maybe you are looking for
-
How to get the data from Pooled Table T157E.
Hi Experts, How to get the data from Pooled Table T157E. Any help. Thanks in Advance, Ur's Harsha.
-
How do i remove my old phone from my account
How do i remove my old phone from my Apple account and link this new one?
-
How to get the purchase order's delivery completed date in the dictionary
Hi consutant : In me23n transaction code ,I set the delivery completed indicator mannul . I can see the state of delivery completeed by click environment->item changes menu . But I don't find the date that I set the state of delivery completed in t
-
When working with a number of files from a folder somewhere down the heirarchy, it used to be the case that saving a file went directly to the last used location. Now, with OS10.8, it is simply directed to the top level requiring either repeated navi
-
I have just purchased an activation key for iWork but when I enter it it is rejected as invalid. Any help or suggestions please?