2014 Mar 19 12:45 PM
Hello,
I'm a newbie and I'm working with smartforms.
My requirement is to get the following format of date and time in a text within a template.
'MMM DD HH:MM'
Like : Jan 01 12:45
I have tried SAPScript Commands like 'SET DATE MASK' but that doesn't appear to work.
Do I have to use a Function Module?
Please help out. A sample code will be appreciated!
Regards & Thanks,
Arun G Nair
2014 Mar 19 12:58 PM
Hi,
please see this code
DATA: V_DATE1 TYPE STRING
.
SELECT SINGLE LTX FROM T247
INTO MONTH_NAME
WHERE SPRAS = SY-LANGU
AND MNR = SY-DATUM+4(2).
CONCATENATE MONTH_NAME SY-DATUM+6(2) DATE1(4)
INTO V_DATE1 SEPARATED BY SPACE.
Hello,
I'm a newbie and I'm working with smartforms.
My requirement is to get the following format of date and time in a text within a template.
'MMM DD HH:MM'
Like : Jan 01 12:45
I have tried SAPScript Commands like 'SET DATE MASK' but that doesn't appear to work.
Do I have to use a Function Module?
Please help out. A sample code will be appreciated!
Regards & Thanks,
Arun G Nair
2014 Mar 19 12:54 PM
Hi,
You need to create a code
data: l_yy(4), l_dd(2).
l_yy= sy-datum+0(4).
l_dd = sy-datum+6(2).
and then use them in them in the text. The time you can get it easy.
Regards
Miguel
2014 Mar 19 1:05 PM
Hi,
You can get month description in respective language from T247 table.
Concatenate it with sy-datum+0(4) sy-uzeit+0(2) sy-uzeit+3(2).
Regards,
Jaideep,
2014 Mar 19 12:58 PM
Hi,
please see this code
DATA: V_DATE1 TYPE STRING
.
SELECT SINGLE LTX FROM T247
INTO MONTH_NAME
WHERE SPRAS = SY-LANGU
AND MNR = SY-DATUM+4(2).
CONCATENATE MONTH_NAME SY-DATUM+6(2) DATE1(4)
INTO V_DATE1 SEPARATED BY SPACE.
2014 Mar 19 1:12 PM
If your required format does not exist in standard output option (Check Output Options for Field Contents) else convert to a character field in a small form either with one of the many availabale FM or a small code.
Regards,
Raymond
2014 Mar 19 1:16 PM
Hey Guys,
Thanks for your replies. But where do I try these codes?
Is it in the 'Initialization' section in Global Definitions?
In that case what all should i declare in the 'Global Data' tab?
2014 Mar 19 1:23 PM
Hi declare all variables in global declaration of smartform, then create a program lines in your smartforms, then define it in input and output parameters (variables).
Then you can show it in output as v_date1, please add sy-uzeit for time
use &v_date1&, where you wants to show this date format.
2014 Mar 19 1:39 PM
Where do I declare MONTH_NAME? I tried under Global Data tab in Global Definitions and then in Form Interface. Please help...
Thanks.
2014 Mar 19 1:44 PM
Define the text field in Global Settings/Global Definitions tab Global Data. Then if the date is unique during the form executuion, initialize this text in Initialization tab, else create a form in tab form routines and call this form in a program lines node before the text nodes that use its value. Also don't forget the import/export parameters of every node.
Regards,
Raymond
2014 Mar 19 1:56 PM
Goto gobal definition then gobal data..
Variable name type assignment associated type
v_month_name TYPE T247-KTX
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |