Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Formatting SY-SUBRC.

$
0
0

Hi Friends,

I have worked in various implementions of routines, Transformation routines and DTP routines and exit variable creations, where we have extensive use of changing the format of system date. So I thought to make a consolidated blog which will have all the ways we can format a sy-subrc or syst-subrc variable.

 

By using the WRITE statement

 

data: gd_date(10). "field to store output date 

* Converts SAP date from 20020901 to 01.09.2002

write sy-datum to gd_date dd/mm/yyyy.

* Converts SAP date from 20020901 to 01.09.02

write sy-datum to gd_date dd/mm/yy. 

 

 

* By using data manipulation techniques

data: gd_date(8). "field to store output date 

* Converts SAP date from 20010901 to 01092001

gd_date(2) = sy-datum+6(2).

gd_date+2(2) = sy-datum+4(2).

gd_date+4(4) = sy-datum(4).

 

 

* Using Function modules

* Converts date from 20010901 to 01SEP2001

  gd_date = sy-datum.

 

  CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'

  EXPORTING

  input = gd_date

  IMPORTING

  OUTPUT = gd_date.

 

By this way we can change the date format and use them for reporting. PFB some more Function modules which will have more options to make things more easier and fill the Gap with the client need.

 

CONVERSION_EXIT_PDATE_OUTPUT

Eg: input = 24012008 and output = 24.01.2008

 

CONVERSION_EXIT_SDATE_OUTPUT

Eg: input = 20070201 and output = 01.FEB.2007

 

CONVERSION_EXIT_IDATE_INPUT

Eg: input = 01.02.2008 and Output = 20080201

 

CONVERSION_EXIT_LDATE_OUTPUT

Eg: input = 20070301 and output = 01. March 2007

 

CONVERSION_EXIT_PDATE_OUTPUT

Eg: input = 20070301 and output = 03.01.2007

 

 

Hope this will helps a BI technical consultant while making use of these FMs in Transformations.

 

 

Source:

http://help.sap.com/saphelp_erp60_sp/helpdata/en/9f/dba1ef35c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_470/helpdata/en/9f/dba1ef35c111d1829f0000e829fbfe/content.htm


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>