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: 

Tue Dec 14 00:00:00 CST 2021

周建华
Participant
0 Kudos

Tue Dec 14 00:00:00 CST 2021

how ?

Timestamp

to

Date

CL_PCO_UTILITY

cl_abap_datfm

1 ACCEPTED SOLUTION

周建华
Participant
0 Kudos

function zrfc_converter_billingdate .
*"----------------------------------------------------------------------
*"*"局部接口:
*" IMPORTING
*" VALUE(STR) TYPE STRING
*" EXPORTING
*" VALUE(DATE) TYPE DATS
*"----------------------------------------------------------------------

"Tue Dec 14 00:00:00 CST 2021
"认证日期
data:lt_date type table of string.
data:ls_date type string.

data:return_code type sy-subrc.
data:month_names type standard table of t247 with header line.

call function 'MONTH_NAMES_GET'
exporting
language = sy-langu
importing
return_code = return_code
tables
month_names = month_names[]
exceptions
month_names_not_found = 1
others = 2.

split str at space into table lt_date.

read table lt_date into ls_date index 6.
if sy-subrc eq 0.
date+0(4) = ls_date.
endif.

read table lt_date into ls_date index 2.
if sy-subrc eq 0.

clear:month_names.
translate ls_date to upper case.
month_names-ktx = ls_date.
read table month_names with key ktx = month_names-ktx.
if sy-subrc eq 0.
date+4(2) = month_names-mnr.
endif.

endif.

read table lt_date into ls_date index 3.
if sy-subrc eq 0.
date+6(2) = ls_date.
endif.


endfunction.

6 REPLIES 6

Sandra_Rossi
Active Contributor
0 Kudos

Could you ask a question in plain English please? You have translators if you don't speak English well.

周建华
Participant
0 Kudos

Tue Dec 14 00:00:00 CST 2021

周建华
Participant
0 Kudos

"Tue Dec 14 00:00:00 CST 2021
"认证日期
DATA:lt_date TYPE TABLE OF string.
DATA:ls_date TYPE string.

DATA:return_code TYPE sy-subrc.
DATA:month_names TYPE STANDARD TABLE OF t247 WITH HEADER LINE.

CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
language = sy-langu
IMPORTING
return_code = return_code
TABLES
month_names = month_names[]
EXCEPTIONS
month_names_not_found = 1
OTHERS = 2.

SPLIT invoice-deductibledate AT space INTO TABLE lt_date.

READ TABLE lt_date INTO ls_date INDEX 6.
IF sy-subrc EQ 0.
tb_zmmbw-zrzrq+0(4) = ls_date.
ENDIF.

READ TABLE lt_date INTO ls_date INDEX 2.
IF sy-subrc EQ 0.

CLEAR:month_names.
month_names-ktx = ls_date.
READ TABLE month_names WITH KEY ktx = month_names-ktx.
IF sy-subrc EQ 0.
tb_zmmbw-zrzrq+4(2) = month_names-mnr.
ENDIF.

ENDIF.

READ TABLE lt_date INTO ls_date INDEX 3.
IF sy-subrc EQ 0.
tb_zmmbw-zrzrq+6(2) = ls_date.
ENDIF.

周建华
Participant
0 Kudos

function zrfc_bw_converter_date.
*"----------------------------------------------------------------------
*"*"局部接口:
*" IMPORTING
*" VALUE(STR) TYPE STRING
*" EXPORTING
*" VALUE(DATE) TYPE DATS
*"----------------------------------------------------------------------

"Tue Dec 14 00:00:00 CST 2021
"认证日期
data:lt_date type table of string.
data:ls_date type string.

data:return_code type sy-subrc.
data:month_names type standard table of t247 with header line.

call function 'MONTH_NAMES_GET'
exporting
language = sy-langu
importing
return_code = return_code
tables
month_names = month_names[]
exceptions
month_names_not_found = 1
others = 2.

split str at space into table lt_date.

read table lt_date into ls_date index 6.
if sy-subrc eq 0.
date+0(4) = ls_date.
endif.

read table lt_date into ls_date index 2.
if sy-subrc eq 0.

clear:month_names.
translate ls_date to upper case.
month_names-ktx = ls_date.
read table month_names with key ktx = month_names-ktx.
if sy-subrc eq 0.
date+4(2) = month_names-mnr.
endif.

endif.

read table lt_date into ls_date index 3.
if sy-subrc eq 0.
date+6(2) = ls_date.
endif.


endfunction.

周建华
Participant
0 Kudos

function zrfc_converter_billingdate .
*"----------------------------------------------------------------------
*"*"局部接口:
*" IMPORTING
*" VALUE(STR) TYPE STRING
*" EXPORTING
*" VALUE(DATE) TYPE DATS
*"----------------------------------------------------------------------

"Tue Dec 14 00:00:00 CST 2021
"认证日期
data:lt_date type table of string.
data:ls_date type string.

data:return_code type sy-subrc.
data:month_names type standard table of t247 with header line.

call function 'MONTH_NAMES_GET'
exporting
language = sy-langu
importing
return_code = return_code
tables
month_names = month_names[]
exceptions
month_names_not_found = 1
others = 2.

split str at space into table lt_date.

read table lt_date into ls_date index 6.
if sy-subrc eq 0.
date+0(4) = ls_date.
endif.

read table lt_date into ls_date index 2.
if sy-subrc eq 0.

clear:month_names.
translate ls_date to upper case.
month_names-ktx = ls_date.
read table month_names with key ktx = month_names-ktx.
if sy-subrc eq 0.
date+4(2) = month_names-mnr.
endif.

endif.

read table lt_date into ls_date index 3.
if sy-subrc eq 0.
date+6(2) = ls_date.
endif.


endfunction.

周建华
Participant
0 Kudos

function zrfc_converter_deductibledate .
*"--------------------------------------------------------------------
*"*"局部接口:
*" IMPORTING
*" VALUE(STR) TYPE STRING
*" EXPORTING
*" VALUE(DATE) TYPE DATS
*"--------------------------------------------------------------------

"2022-01-25 00:00:00.0
"

call method cl_abap_datfm=>conv_date_ext_to_int
exporting
im_datext = str
im_datfmdes = '6'
importing
ex_datint = date.


endfunction.