on 09-17-2008 2:09 PM
Hi Experts,
I have a requirement that i have to display date in format dd-mmm-yyyy eg. 23-Nov-2007.
Now if i create a context attribute of type Dats or D what format i get by default is dd-mm-yyyy.
Please note that not only i have to enter date in input field but also the search help i.e. the calander icon, which automatically appears when we bind the input field with a attribute of type Dats, sholud also appear.
Thanks in advance.
Regards
Pranav.
Hi Pranav,
I can give you a solution but its not very neat.
All you have to do is to have 2 input fields
input1 bind to dat2 type string
input2 bind to dat type dats (width = 0)
on enter of the input 2 write the following code
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_dat LIKE ls_context-dat.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `DAT`
IMPORTING
value = lv_dat ).
DATA lv_dat2 LIKE ls_context-dat2.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
case lv_dat+4(2).
when '01'.
lv_dat2 = 'JAN'.
when '02'.
lv_dat2 = 'FEB'. " Do for rest of the month or may be there is a FM doing this
endcase.
concatenate lv_dat+6(2)
'-'
lv_dat2
'-'
lv_dat+0(4)
into lv_dat2.
* set single attribute
lo_el_context->set_attribute(
EXPORTING
name = `DAT2`
value = lv_dat2 ).
Hope this helps.
Regards,
Kinshuk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thnks every one...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The date formatting varies according to user profile settings just as in any SAPgui transaction.
Just go to transaction SU3 and change it.
If it's not possible and it must be fixed for all users, you should go with SET COUNTRY statement:
http://help.sap.com/saphelp_scm50/helpdata/en/9f/dba1ef35c111d1829f0000e829fbfe/content.htm
Some customizing must be done with table T005X to use this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Then you can probably get around with creating a new Z domain with DATS type and using Z conversion routines (CONVERSION_EXIT_Zxxxx_INPUT / CONVERSION_EXIT_Zxxxx_OUTPUT) which convert YYYYMMDD from / to your format. You can use T247 table for the month conversion as the SDATE routine does.
Then create a data element for that domain and finally your context attribute should have that data element as type.
I think this would work.
With that said, it's quite a lot of work for such a small result. I would try to redefine the date format to one of the standard options with the stakeholders.
Edited by: Alejandro Bindi on Sep 18, 2008 3:52 PM
I did some tests and you wouldn't be able to use the CALENDAR automatic search help along with my last suggestion, because it returns the selected date according to user profile. So you're left with the Date Navigator UI element as an alternative.
Edited by: Alejandro Bindi on Sep 18, 2008 5:26 PM
hi,
sorry for getting back so late... but one of my colleague came up with an idea to use freely programmable help here... wht we did was, we have created another component with date navigator and use this component in main component as a freely programmable help.......
if someone faces similar problem reply back i will explain whole procedure......
regards
Pranav
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.