cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting a date

Former Member
0 Kudos

Hi,

I'm doing a BDC using the following ;

bdcdtab-dynpro = '0000'.

bdcdtab-dynbegin = ' '.

bdcdtab-fnam = 'BKPF-BUDAT'.

bdcdtab-fval = '12.07.2005'. "ybsid-budat Change this

APPEND bdcdtab.

And I want to ensure that the date is always in the format dd.mm.yyyy like 12.07.2005 above. I have the date from the variable 'BKPF-BUDAT', how can format to always be the way I want?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Use function module : CONVERT_DATE_TO_EXTERNAL

Regards,

Subramanian V.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos


data: bdc_date(10) type c.

call function 'CONVERT_DATE_TO_EXTERNAL'
     exporting
          date_internal            = ybsid-budat
     importing
          date_external            = bdc_date
     exceptions
          date_internal_is_invalid = 1
          others                   = 2.

Regards,

Rich Heilman

Answers (2)

Answers (2)

Former Member
0 Kudos

You can use WRITE BKPF-BUDAT TO bdcdtab-FVAL.

This will write date in format defined in used setting.

Regards,

Gagan

Former Member
0 Kudos

Hi,

This FM 'CONVERSION_EXIT_PDATE_OUTPUT' converts date to output user format.

Another approach:

concatenate date6(2) date4(2) date+0(4) into string separated by '.'. - converts in dd.mm.yyyy

Svetlin