Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

fg

Former Member
0 Kudos

Hi

Is there any function module which does the following conversion

07.07.2007 to 7th July 2007

regards

rahul

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi Rahul,

Try this code

data: datum type sy-datum.
data: datum_out type string.
data: it247 type table of  t247 with header line.
 
datum = sy-datum.
 
call function 'MONTH_NAMES_GET'
     tables
          month_names = it247.
 
 
read table it247 with key spras = sy-langu
                             mnr = datum+4(2).
 
concatenate it247-ltx sy-datum+6(2) sy-datum+0(4)
          into datum_out separated by space.
 
write:/ datum_out.

2 REPLIES 2

Former Member
0 Kudos

Hi Rahull

<b>CONVERT_DATE_TO_EXTERNAL</b> Converts date from system storage format to users specified display format

<b>BAPI_COMPANYCODE_GET_PERIOD</b> Retrieve fiscal year and payrole period (based on date and company code)

REPORT  zfiscalyr NO STANDARD PAGE HEADING.

TABLES: ekko.

PARAMETERS:     p_bukrs TYPE ekko-bukrs,
                p_bedat TYPE ekko-bedat.

DATA: gd_fiscalyr  TYPE bapi0002_4-fiscal_year,
      gd_fiscalp   TYPE bapi0002_4-fiscal_period.
DATA: gd_fiscalyr2 TYPE T009B-BDATJ,
      gd_fiscalp2  TYPE bapi0002_4-fiscal_period.

DATA: gd_periv     TYPE t009-periv.

************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

* get fiscal year and period - (requires date and company code)
  CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
    EXPORTING
      companycodeid = p_bukrs
      posting_date  = p_bedat
    IMPORTING
      fiscal_year   = gd_fiscalyr
      fiscal_period = gd_fiscalp.



* Alternative fiscal year function module
* - (requires date and fiscal year variant code from T009 table)
*--------------------------------------------------------------------

* gets first entry in fiscal year variant table (will need to choose
* correct one from table rather than just using first entry)
  SELECT SINGLE periv
    FROM t009
    INTO gd_periv.

* get fiscal year and period
  CALL FUNCTION 'DETERMINE_PERIOD'
    EXPORTING
      date                      = p_bedat
*    PERIOD_IN                 = '000'
      version                   = gd_periv
   IMPORTING
      period                    = gd_fiscalp2
      year                      = gd_fiscalyr2
   EXCEPTIONS
      period_in_not_valid       = 1
      period_not_assigned       = 2
      version_undefined         = 3
      OTHERS                    = 4.


************************************************************************
*END-OF-SELECTION.
END-OF-SELECTION.
  WRITE:/ 'From function module: BAPI_COMPANYCODE_GET_PERIOD',
        / 'Fiscal year is:', gd_fiscalyr,
        / 'Fiscal period is:', gd_fiscalp.
  SKIP.

  WRITE:/ 'From function module: DETERMINE_PERIOD',
        / 'Fiscal year is:', gd_fiscalyr2,
        / 'Fiscal period is:', gd_fiscalp2.

<b>CALCULATE_DATE</b> Increase/decrease DATE by a specific number of Days/Months

<b>DATE_COMPUTE_DAY</b> Returns day of the week for a particular date(1=Monday, 5=Friday etc.)

<b>DATE_TO_DAY</b> Returns day of the week for a particular date('Monday', 'Friday', 'Sat.')

<b>DYNP_VALUES_UPDATE</b> Return values (i.e. from an F4 value request) into respective fields on a dynpro.

<b>HR_SEN_CRULE_0100_DATE</b> Increase/decrease DATE by a specific number of Days/Months/Years

Reward all helpfull answers

Regards

Pavan

Former Member
0 Kudos

hi Rahul,

Try this code

data: datum type sy-datum.
data: datum_out type string.
data: it247 type table of  t247 with header line.
 
datum = sy-datum.
 
call function 'MONTH_NAMES_GET'
     tables
          month_names = it247.
 
 
read table it247 with key spras = sy-langu
                             mnr = datum+4(2).
 
concatenate it247-ltx sy-datum+6(2) sy-datum+0(4)
          into datum_out separated by space.
 
write:/ datum_out.