Page 1 of 1

Smartform, how use command SET DATE MASK like in SAPSCRIPT

Posted: Mon May 12, 2003 9:35 am
by Chris96
Hi,

I want to use the command SET DATE MASK in SMARTFORM.
Like with SAPSCRIPT :
/: SET DATE MASK 'MMM DD, YYYY'
&DATE&

for the result : May 12, 2003

Posted: Tue May 13, 2003 6:01 pm
by Chaps
Hi Chris,

This is possible by adding a Programming code before this text element.
In the code, you have to handle this via ABAP -

Code: Select all

  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 l_month_descr sy-datum+6(2)
    into v_faxdate separated by space.

    concatenate v_faxdate ',' into v_faxdate.
    concatenate v_faxdate sy-datum(4) into v_faxdate separated by space.

  endif. " L_Month_Descr.
Thanks,
Chaps.

Posted: Tue May 13, 2003 10:46 pm
by Guest
referring to Chaps code u can use FM HR_IN_GET_DATE_COMPONENTS to get month description. this FM also uses T247 table.

Cheers :)
DSC

Posted: Wed May 14, 2003 1:58 pm
by MikeM
Unfortunately these are the only ways around the issue. Here's what SAP once said to me:
Hello Michael,

I am sorry, but the SET DATE MASK command doesn't exist in the
Smart Forms. The reason is this: In Sapscript you have a print
program and a layout set, which are seperated. So you need two
possibilities to set the date mask: In the print program e.g. via
the ABAP command SET COUNTRY and in the layout set via the
SET DATE MASK command. Unfortunately this often resulted in
some confusion.

Now in the Smart Forms you have the possibility to use
ABAP coding directly. So there was no need for a 'special Sapscript'
solution any more. You can set the date format directly by adding
a 'program lines' node into the Smart forms and setting the date
format e.g. via the SET COUNTRY command. The ABAP SET COUNTRY command
only sets the date format and the display of the decimal point.
If you need a more complicated date format, you may also create
a function module for the conversion and call that function module
in the Smart forms.

Yours sincerely
Holger Eichmann
SAP Support Center Europe