on 05-23-2008 7:30 AM
Hi Gurus,
How to print Date as 23-May-2008 in smartforms
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Jul 10, 2008 3:49 PM
Hi,
Another simple way is to do this way.
SELECT SINGLE ltx FROM t247
INTO lv_month_name
WHERE spras = nast-spras
AND mnr = lv_date+4(2).
Where lv_month_name is to be declared type FCLTX.
Then in the smartforms, use the date offsets to print the day first and then lv_month_name and then year with offset like below.
Text node :
&lv_date6(2)& - &lv_month_name& - &lv_date0(4)&
This is the way you can do it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
v_creation_date = sy-datum+4(2).
IF v_creation_date IS NOT INITIAL.
*Read internal table it_month for the month in numeric form to the month
*in text form
READ TABLE it_month INTO l_wa_month WITH KEY
mnr = v_creation_date.
IF sy-subrc = 0.
CLEAR v_creation_date.
CONCATENATE sy-datum+6(2)
l_wa_month-ltx
INTO v_creation_date
SEPARATED BY v_slash.
CONDENSE v_creation_date.
CONCATENATE v_creation_date
v_slash
INTO v_creation_date.
CONCATENATE v_creation_date
sy-datum(4)
INTO v_creation_date.
CONDENSE v_creation_date.
ENDIF.
ENDIF.
this will surely work...
pls reward pts
regards
palak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is possible by adding a Programming code before this text element.
In the code, you have to handle this via ABAP -
Code:
data: l_month like t247-mnr,
l_month_descr like t247-ltx.
l_month = sy-datum+4(2).
select single ltx
into l_month_descr
from t247
where spras = zzsf_billdoch-printlanguage and
mnr = l_month.
if not l_month_descr is initial.
concatenate sy-datum6(2) l_month_descr sy-datum0(4)
into v_faxdate separated by '-'.
endif. " L_Month_Descr.
Referring to the above code you can also use FM HR_IN_GET_DATE_COMPONENTS to get month description. this FM also uses T247 table.
Regards,
Joy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can create your own program lines in the smartform.
Below is the example to get the date as 23-May-2008
DATA : l_date type char2,
l_month type char2,
l_year type char4,
l_dat type char8,
l_mon type char3.
MOVE DATA-WADAT TO l_dat.
l_date = l_dat+6(2).
l_month = l_dat+4(2).
l_year = l_dat+2(2).
CASE l_month.
WHEN '01'.
l_mon = 'JAN'.
WHEN '02'.
l_mon = 'FEB'.
WHEN '03'.
l_mon = 'MAR'.
WHEN '04'.
l_mon = 'APR'.
WHEN '05'.
l_mon = 'MAY'.
WHEN '06'.
l_mon = 'JUN'.
WHEN '07'.
l_mon = 'JUL'.
WHEN '08'.
l_mon = 'AUG'.
WHEN '09'.
l_mon = 'SEP'.
WHEn '10'.
l_mon = 'OCT'.
WHEN '11'.
l_mon = 'NOV'.
WHEN '12'.
l_mon = 'DEC'.
ENDCASE.
CONCATENATE l_year '-' l_mon '-' l_date into G_DATE.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi!
Before writing the Date_variable concatenate date to the needed format in the Program Line
Rclick the Text --> Create --> Flow Logic --> Program Lines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
u can write ur own FM which will take DATE as input and give DATE as required by u as OUT PUT in character string format.
inside FM write IF ELSE based on months
like IF DATE+4(02) EQ 1.
S_text = 'Jan'.
CONCATENATE DATE6(02) S_text DATE1(04) into F_DATE.
ELSE
like wise for all months.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Jul 10, 2008 3:48 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check the below one :
Global data declaration:
-
G_LANGU LIKE NAST-SPRAS
G_MON TYPE TP_MON
IG_MONTH TYPE TABLE OF TP_MONTH
WG_MONTH TYPE TP_MONTH
G_SY_DATE TYPE STRING
Types:
-
types: begin of tp_month.
include structure t247.
types end of tp_month.
initialization:
-
clear g_langu.
g_langu = sy-langu.
Code:
-
refresh: ig_month.
clear: wg_month,
g_mon,
g_sy_date.
call function 'MONTH_NAMES_GET'
exporting
language = g_lang
tables
month_names = ig_month .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
read table ig_month into wg_month with key mnr = sy-datum+4(2). " supplying the month value from current date .
g_mon = wg_month-ktx.
concatenate sy-datum+6(2) g_mon sy-datum+0(4) into g_sy_date separated by '-'.
clear g_mon.
The variable "g_sy_date" contains ur required date format.
Regards,
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.