2009 Mar 05 9:48 AM
Hi,
I have two problems 1:to change the length of the date from 8 to 6 but unfortunately it is giving me an error. 2: there is fields that I need to display lfart from likp it has a value of zslr or zslf but the client want to see d for zslf only not a zslr. this means this field must only display d and d id the default.
Regards,
Fred
2009 Mar 05 9:52 AM
Your question was confusing and not clear. Can you look into your question and post it back with example in date format. Explain clearly.
2009 Mar 05 10:42 AM
Hi,
This is my question how do you change the length of the date? Currently the length of the date is 8 YYYYMMDD and I am expected to change it 6 YYMMDD, that is the first part of the question.
The second part is that there is a field by the name of lfart from likp, currently it has the value zslf and zslr but the client only wants to see the default value of which is zslf, but they do not want to see full zslf they only want to see D.
Hope it is now clear.
Best Regards,
Fred.
2009 Mar 05 10:47 AM
Hi,
Suppose I m getting values in var1 = YYYYMMDD .
Use VAR1+2(6)
Regards,
2009 Mar 05 11:26 AM
Hi,
I am happy the length of the date is now 6 but the format must be MMDDYY.
Regards,
Fred.
2009 Mar 05 9:55 AM
1. your requirement is not clear
2.
If itab-lfart = 'ZSLF'.
itab-lfart = 'd'.
else.
-----------
-----------
endif.
2009 Mar 05 10:01 AM
1.you cannot change the length of date field because the default internal length for date field is 8 which is fixed. And date get stored internally in YYYYMMDD format.
2009 Mar 05 10:13 AM
2009 Mar 05 11:29 AM
Hi
Can you explain your requirement in clear.
It is not possible to change date format from 8 to 6.
Regards,
Rajani
2009 Mar 05 11:50 AM
Hi,
I got my anwer, but just to refresh your mind i wanted to display the date in 6 characters and i got the answer. As for now I need to change the format from YYMMDD to MMDDYY, if this can be sorted my question is answered.
Best Regards,
Fred.
2009 Mar 05 12:01 PM
Hi Fred,
The internal format for the date is YYMMDD but when you output that field in the output screen then it will change the format of the Date.
Please get into the table from which you are extacting this field and double click on Data element
and then double click on Domain.
Let me know if you have any Convers. Routine available in that field...?
Please let me know if this is not the case...
Regards,
Kittu
2009 Mar 05 12:01 PM
Hi Fred,
The internal format for the date is YYMMDD but when you output that field in the output screen then it will change the format of the Date automatically.
Please get into the table from which you are extacting this field and double click on Data element
and then double click on Domain.
Let me know if you have any Convers. Routine available in that field...?
Please let me know if this is not the case...
Regards,
Kittu
Sorry for the same message, it was typo...
Edited by: Kittu on Mar 5, 2009 1:01 PM
2009 Mar 05 12:08 PM
Hi,
The Convers. Routine is empty there nothing on it.
Best Regards,
Fred.
2009 Mar 05 12:32 PM
Hi Fred,
If you want to change the Date format from YYYYMMDD to MMDDYY,
I am sure this will help you.
*****************************************************************************
data :var1(6) type c,
var2(8) type c,
date1 like sy-datum.
date1 = sy-datum.
concatenate date14(4) date12(2) into var1.
concatenate date14(2) '.' date16(2) '.' date1+2(2) into var2.
write: date1, / , var1, /, var2.
**************************************************************************************
output is,
DD.MM.YYYY
MMDDYY
MM.DD.YY
As per your requirement I have written this.
The internal format of date would be YYYYMMDD (of 8 characters)
The external format of date would be DD.MM.YYYY
Using the above program logic you can convert it to any format you wish.
Thank you.
Veera Karthik.
Edited by: veera Karthik on Mar 5, 2009 1:33 PM
2009 Mar 05 12:55 PM
hi,
Take that date in a variable Var (YYMMDD).
Declare three more variables, var1, var2, var3.
var1 = var+0(2).
var2 = var+2(2).
var3 = var+4(2).
Then Concatenate these three variables the way u want.
ie MMDDYY.
Hope this helps.
Thanks
Suraj S Nair
2009 Mar 05 12:57 PM
HI,
Now you are getting DDMMYYYY.
Just Change ur declaration.
Data: Var(6).
So now u will get DDMMYY in VAR variable.
Regards
2009 Mar 06 9:11 AM
Hi,
I still have a problem, when I view my downloaded data it displays with 8 characters instead of 6... Can anyone help me with that?
Regards
Fred
2009 Mar 06 9:15 AM
Hi,
In your code where ever u download the Date, get it into a variable and then do the necessary things that I mantioned earlier and then desplay it.
Hope this will help u,
Or else pls paste ur code
Thanks and Regards
Suraj S Nair
2009 Mar 06 9:19 AM
2009 Mar 06 9:31 AM
Hi,
If its only with the display part,
Declare the variables as char , ie
var1(2) type C, var2(2) type C, var3(2) type C.
Now the date that u get after downloading i.e for e.g var.
Then
var1 = var+0(2).
var2 = var+2(2).
var3 = var+4(2).
Then Concatenate these three variables the way u want.
ie MMDDYY. or DDMMYY or YYMMDD
Hope this helps.
Thanks and Regards
Suraj S. Nair
2009 Mar 06 9:34 AM
Hi,
This code displays the date 092705 (MMDDYY) and that is what I want but in the downloaded data the date is in this format: (27.09.2005)
data: var1 type d, var2 type d, var3 type d, var like sy-datum.
var1 = itab-lfdat+2(2).
var2 = itab-lfdat+6(2).
var3 = itab-lfdat+4(2).
concatenate var3 var2 var1 into itab-lfdat.
write: itab-lfdat(6),
Please advice!
Best Regards,
Fred
2009 Mar 06 9:35 AM
2009 Mar 06 9:44 AM
Hi,
I am sorry I am not getting U , but if I am understanding u then this should solve ur problem,
var1 = var+0(2).
var2 = var+3(2).
var3 = var+6(2).
and then concatenate.
Thanks and Regards
Suraj S. Nair.
2009 Mar 09 10:19 AM
Hi All,
I have tried all of your suggestion but there are two things, the date can display in sap but when I go and check on notepad the downloaded data, there format of the date is back to normal i.e dd/mm.yyyy. the format of the dat must be mmddyy in both sap and downloaded notepad. The second problem is that the other fields of my internal table are not appearing on the on the sap output.
Hope this is clear!
Thanks
Edited by: Fred Mogaadile on Mar 9, 2009 4:10 PM
2009 Mar 06 9:20 AM
data :var1(6),
var2(8) c,
date1 like sy-datum.
date1 = sy-datum.
concatenate date14(4) date12(2) into var1.
concatenate date14(2) '.' date16(2) '.' date1+2(2) into var2.
write: date1, / , var1, /, var2.