‎2007 May 22 2:38 PM
Hi SDN's
I have a field ANLA-LEABG. And i upload the value from an excel sheet into ITAB.
so while writing the value from Excel to ITAB if the value in excel is 12.02.2005 while writing it to ITAB i use a FM to convert to type DATE so i get the value of date as 20050212.
Now i need to pass the Date value to a BAPI. and my BAPI accpets only in format __.__.____ (DD.MM.YYYY)
so now how do i convert the value to that format. i use a FM : Conversion_Exit_pdate_output But its converting into 12022005. But i want it as 12.02.2005.
How can i get it ? how do i declare the date format for passing it to the BAPI.
Regards
Pratyusha
‎2007 May 22 2:43 PM
Hi check this,
DATA: e_date(10) type c VALUE '2/2/2006',
i_date(10).
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = e_date
IMPORTING
date_internal = i_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
WRITE : / 'CONVERT_DATE_TO_INTERNAL',
/ 'My Date:' , e_date ,
'Conv Date:', i_date.
skip 2.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = sy-datum
IMPORTING
DATE_EXTERNAL = e_date
EXCEPTIONS
DATE_INTERNAL_IS_INVALID = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE : / 'CONVERT_DATE_TO_EXTERNAL',
/ 'My Date:' , sy-datum,
'Conv Date:', e_date.
rEWARD POINTS IF HELPFUL
tHANKS
VENKI
‎2007 May 22 2:45 PM
Hello,
Use <b>Write to</b> to pass top the BAPI Field.
Check this code :-
Data: date type dats.
Write '20050212' to date.
write:/ date.
Regards,
Deepu.K
‎2007 May 22 2:46 PM
Hello,
Use Write to to pass top the BAPI Field.
Check this code :-
Data: date type dats.
Write '20050212' to date.
write:/ date.
Regards,
Deepu.K
‎2007 May 22 2:55 PM
Hi,
Check this link.
https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-FunctionmoduleforconvertinganyExternaldateformattoInternalformat
Reward points if useful.
Thanks
Aneesh.