Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Writing flow logic program lines in Samrtforms..

Former Member
0 Kudos
294

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
128

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

10 REPLIES 10

Former Member
0 Kudos
128

Is there some wise solution to my problem.

Former Member
0 Kudos
128

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

0 Kudos
128

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

Former Member
0 Kudos
129

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

0 Kudos
128

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 ?

0 Kudos
128

Hi Tushar,

You can use

write AENR-DATUV to W_Date MM/DD/YYYY.

Regards,

gagan

0 Kudos
128

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

0 Kudos
128

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

Former Member
0 Kudos
128

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.

jayanthi_jayaraman
Active Contributor
0 Kudos
128

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.