abap:format_string:date
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| abap:format_string:date [2014/11/18 15:51] – ginko | abap:format_string:date [2014/11/18 16:07] (current) – ginko | ||
|---|---|---|---|
| Line 23: | Line 23: | ||
| gd_date+4(4) = sy-datum(4). | gd_date+4(4) = sy-datum(4). | ||
| + | data mydate like sy-datum. | ||
| + | data: year(4) type c, | ||
| + | month(2) type c, | ||
| + | date(2) type c. | ||
| + | |||
| + | year = mydate(4). | ||
| + | month = mydate+4(2). | ||
| + | date = mydate+6(2). | ||
| + | |||
| + | write: / year no-gap, month no-gap, date. | ||
| * Using Function modules | * Using Function modules | ||
| Line 37: | Line 47: | ||
| - | | + | * Do you want to WRITE it to a list screen? Use the formatting options described in the documentation and online help: |
| + | data : date(10) | ||
| WRITE l_my_date MM/DD/YYYY. | WRITE l_my_date MM/DD/YYYY. | ||
| - | write:/ gv_date edit mask ' | + | |
| - | data : date(10) type c value '01122004'. | + | write:/ date using edit mask '__/__/____' |
| - | write :/ date using edit mask ' | ||
| CONCATENATE: | CONCATENATE: | ||
| '/' | '/' | ||
| Line 50: | Line 60: | ||
| | | ||
| - | | + | * To set the date format in a SAPscript form, see the SET DATE MASK command. |
| - | | + | * To print the formatted date in a SmartForm, use the WRITE command and a temporary variable (yes, ugly, I know...) |
| - | | + | * Most controls (ALV Grid for example) should take care of the format automatically. |
| - | if w_country is initial. | + | if w_country is initial. |
| select single LAND1 | select single LAND1 | ||
| from T001W | from T001W | ||
| Line 68: | Line 78: | ||
| write w_the_date to w_export. | write w_the_date to w_export. | ||
| - | 1. Use the fm ' | + | * Use the fm ' |
| - | opcache.restrict_api | + | |
| - | *** | + | |
| - | data mydate like sy-datum. | + | |
| - | data: year(4) type c, | + | |
| - | month(2) type c, | + | |
| - | date(2) type c. | + | |
| - | + | ||
| - | year = mydate(4). | + | |
| - | month = mydate+4(2). | + | |
| - | date = mydate+6(2). | + | |
| - | + | ||
| - | write: / year no-gap, month no-gap, date. </ | + | |
abap/format_string/date.1416322280.txt.gz · Last modified: 2014/11/18 15:51 by ginko
