Application Development and Automation 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: 
Read only

Date Format Issue

Former Member
0 Likes
714

Hi all,

There is a FM to convert sao format date to oracle format date?

Like: 20090521

To: 21-MAY-2009

Or, help me to made this update works:

vl_date = sy-datum.

TRY.

EXEC SQL.

UPDATE SAP_MUDANCA_MARGEM@DBLINK_63

SET SM_FLAG_LEITURA =: vl_err

SM_DATA_SAP =: TO_DATE(vl_date, 'YYYYMMDD')

WHERE SM_ID_SM =: wl_trlogic-chave

ENDEXEC.

CATCH cx_sy_native_sql_error INTO vl_excref.

vl_error_text = vl_excref->get_text( ).

MESSAGE vl_error_text TYPE 'I'.

ENDTRY.

5 REPLIES 5
Read only

former_member188829
Active Contributor
0 Likes
673

Hi,

Try this function module.

CONVERSION_EXIT_LDATE_OUTPUT

DATA:input TYPE sy-datum VALUE '20090521',
     output TYPE string.

START-OF-SELECTION.
  CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'
    EXPORTING
      input  = input
    IMPORTING
      output = output.

  WRITE output.

Read only

0 Likes
673

Hi,

DATA:input TYPE sy-datum VALUE '20090521',
     output TYPE string,
     month_names TYPE t247.

START-OF-SELECTION.

SELECT SINGLE * FROM t247 INTO month_names WHERE spras = sy-langu
                                           AND mnr = input+4(2).
  IF sy-subrc EQ 0.
   CONCATENATE input+6(2) '-' month_names-ltx '-' input+0(4) INTO output.
  ENDIF.

  WRITE output.

Read only

gautam_totekar
Active Participant
0 Likes
673

Try Moving it to character field variable by using offset for date month and year . then concatenate it using '-'

Read only

Former Member
0 Likes
673

Hi,

Try the following code.

DATA: X_MONTH(12).

START-OF-SELECTION.

CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'

EXPORTING

input = sy-datum

IMPORTING

output = x_month.

concatenate x_month(2) '-' x_month4(3) '-' x_month8(4) into x_month.

WRITE:/ x_month.

Thanks

Ramana

Read only

Former Member
0 Likes
673

I fixed my exeq sql. Thx all anyway.