‎2005 Aug 03 5:00 PM
Hi,
I am working on smartforms.
In general attricutes of field of a particular text, I have to print a field as follows:
Date: &AENR-DATUV&
-
Now if Date is 00/00/0000 then it should print NA instead
of 00/00/0000.
I know I have to write logic in flow logic -> program lines.
IF AENR-DATUV = '00/00/0000'.
W_DATE = 'NA'. (Here the data type of W_Date is char)
ELSE.
W_DATE = AENR-DATUV.(Here the data type is DATS)
Then, declare field as follows in general attributes of text.
Date: &W_Date&
So how do I declare the data type of w_date in global definitions since the data type changes according to value of AENR-DATUV.
Tushar.
‎2005 Aug 03 7:23 PM
HI Tushar,
Yes, You can define W_Date as char10 in global definition.
and you can assign date or char 'NA'.
IF AENR-DATUV is initial.
( don't check for '00/00/0000' , it will always fail )
W_DATE = 'NA'. (Here the data type of W_Date is char)
ELSE.
W_DATE = AENR-DATUV.(Here the data type is DATS)
( here you can use write to using format also. )
ENDIF.
regards,
Gagan
‎2005 Aug 03 5:01 PM
‎2005 Aug 03 5:19 PM
hi
You can straigt away declare W_DATE as a 10 char field.
This will solve u rporoblem in both populating 'NA' and Date into it.
Thanks
Balu
‎2005 Aug 03 7:10 PM
Hi Tushar,
Please use "MOVE" instead of "=" command while you are writing to the character string or you can use the "Write to" command. Just look for the additions that you can use when you have the "Write to" command.
Regards,
Sudhi
‎2005 Aug 03 7:23 PM
HI Tushar,
Yes, You can define W_Date as char10 in global definition.
and you can assign date or char 'NA'.
IF AENR-DATUV is initial.
( don't check for '00/00/0000' , it will always fail )
W_DATE = 'NA'. (Here the data type of W_Date is char)
ELSE.
W_DATE = AENR-DATUV.(Here the data type is DATS)
( here you can use write to using format also. )
ENDIF.
regards,
Gagan
‎2005 Aug 05 4:36 PM
Hi,
If I declare W_Date as char10 in global definition in msartforms then the following statement:
W_Date = AENR-DATUV displays date as 20050803 instead of 08/03/2005.
How do I solve this problem ?
‎2005 Aug 05 4:40 PM
Hi Tushar,
You can use
write AENR-DATUV to W_Date MM/DD/YYYY.
Regards,
gagan
‎2005 Aug 05 4:43 PM
Or..... don't know if you can do this internal to smartforms or not.
call function 'CONVERT_DATE_TO_EXTERNAL'
exporting
date_internal = aenr-datuv
importing
date_external = w_date
exceptions
date_internal_is_invalid = 1
others = 2.
Doing it this way, it will use the system level formatting. So if your system level format is DD.MM.YYYY, then it should convert it to that, if it is MM/DD/YYYY, it will convert like that. By using the WRITE statement with an edit mask, you are saying that you want it as MM/DD/YYYY regardless of the system level format.
Please make sure that you remember to award points for all the helpful answers. Thanks.
Regards,
Rich Heilman
Message was edited by: Rich Heilman
‎2005 Aug 05 4:55 PM
If you want to change the format regardless of user defauls ( maintained in User profile , Sytem > User profile > Own data ), then you can use SET COUNTRY 'US' before write . In that case, it will format all the data in US format.
Other option is break at char level and concatenate.
concatenate aenr-datuv4(2) '/' aenr-datuv6(2) '/' aenr-datuv(4) into w_date.
Regards,
Gagan
‎2005 Aug 04 4:52 AM
You can make use of a Character field of length 10. This shd solve ur problem.
Alternatively u can also do this...
Use the "ALternative note" or condition node is smartforms.
Put the condition as
aenr-datuv = '00000000'
Yes => u can hard code NA.
No => display aenr-datuv as is.
This way, u dont need the extra variable.
Remember to reward points to the replies that answered your question.
‎2005 Aug 04 5:06 AM
Hi,
Declare a variable of type char of size 10(say v) in Global declaration.
Then Create Alternative node.
Give condition AENR-DATUV 00/00/0000.
True condition.
Inside that create program line.
In that declare v as output parametrers.
v = 'NA'.
False condition.
Inside that create program line.
In that declare aenr-datuv as input parameters and v as output.
v = aenr-datuv.
Then display v as text element.
Hope this helps.If so,kindly reward points.Otherwise,get back.